From f632dd009d5956be39c9f65a4a216b7ce24de8ed Mon Sep 17 00:00:00 2001 From: Jonathan Leitschuh Date: Wed, 27 Jul 2022 16:55:43 +0000 Subject: [PATCH] [tests] Temporary Directory Hijacking or Information Disclosure This fixes either Temporary Directory Hijacking, or Temporary Directory Local Information Disclosure. Weakness: CWE-379: Creation of Temporary File in Directory with Insecure Permissions Severity: High CVSSS: 7.3 Detection: CodeQL & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.UseFilesCreateTempDirectory) Reported-by: Jonathan Leitschuh Signed-off-by: Jonathan Leitschuh Bug-tracker: https://github.com/JLLeitschuh/security-research/issues/10 Co-authored-by: Moderne Co-authored-by: Violeta Georgieva --- .../src/test/java/reactor/netty/ByteBufFluxTest.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reactor-netty-core/src/test/java/reactor/netty/ByteBufFluxTest.java b/reactor-netty-core/src/test/java/reactor/netty/ByteBufFluxTest.java index 89d4478485..5a8cb47b32 100644 --- a/reactor-netty-core/src/test/java/reactor/netty/ByteBufFluxTest.java +++ b/reactor-netty-core/src/test/java/reactor/netty/ByteBufFluxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021 VMware, Inc. or its affiliates, All Rights Reserved. + * Copyright (c) 2017-2022 VMware, Inc. or its affiliates, All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,9 +139,7 @@ void testFromPath() throws Exception { private static File createTemporaryDirectory() { try { - final File tempDir = File.createTempFile("ByteBufFluxTest", "", null); - assertThat(tempDir.delete()).isTrue(); - assertThat(tempDir.mkdir()).isTrue(); + final File tempDir = Files.createTempDirectory("ByteBufFluxTest").toFile(); return tempDir; } catch (Exception e) {