Skip to content

Commit

Permalink
refactor: Java Security Ultimate Scan 2023
Browse files Browse the repository at this point in the history
Disclaimer: Automated Commit Alert

Please be aware that this commit, generated through automated processes, may contain false alerts or not be precisely targeted. This automated commit is part of a large-scale effort to enhance software security over time. It is sent to various repositories to improve code quality and security. Exercise caution when reviewing the changes, and ensure that any necessary adjustments are made to maintain the integrity and functionality of the software.

Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/MtR7dypUE?organizationId=SmVua2lucyBDSQ%3D%3D

Co-authored-by: Moderne <[email protected]>
  • Loading branch information
2 people authored and kinow committed Oct 18, 2023
1 parent 9472adc commit 730afa8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void setUp() throws Exception {
// scriptler setup
scriptler = j.getInstance().getExtensionList(ScriptlerManagement.class).get(0);
ScriptlerHelper scriptlerHelper = new ScriptlerHelper(scriptler);
scriptFile = File.createTempFile("uno-choice", "dummy.groovy");
scriptFile = Files.createTempFile("uno-choice", "dummy.groovy").toFile();
FileUtils.writeStringToFile(scriptFile, SCRIPT_PARAM001, Charset.defaultCharset(), false);
FileItem fi = new FileItemImpl(scriptFile);
scriptlerHelper.saveScript(fi, true, "dummy.groovy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

import java.io.File;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.Collections;

@Issue("63983")
Expand All @@ -61,7 +62,7 @@ public void testGroovyScriptApprovedNoSandboxOK() throws Exception {
final String scriptText = "import hudson.model.Hudson;\n" +
"Hudson.getInstance();\n" +
"return \"Got instance!\";";
final File scriptFile = File.createTempFile("uno-choice", "63983");
final File scriptFile = Files.createTempFile("uno-choice", "63983").toFile();
FileUtils.writeStringToFile(scriptFile, scriptText, Charset.defaultCharset(), false);
final FileItem fi = new FileParameterValue.FileItemImpl(scriptFile);
scriptlerHelper.saveScript(fi, true, "63983");
Expand All @@ -85,7 +86,7 @@ public void testGroovyScriptPendingSandboxRejected() throws Exception {
final String scriptText = "import hudson.model.Hudson;\n" +
"Hudson.getInstance();\n" +
"return \"Got instance!\";";
final File scriptFile = File.createTempFile("uno-choice", "63983");
final File scriptFile = Files.createTempFile("uno-choice", "63983").toFile();
FileUtils.writeStringToFile(scriptFile, scriptText, Charset.defaultCharset(), false);
final FileItem fi = new FileParameterValue.FileItemImpl(scriptFile);
scriptlerHelper.saveScript(fi, true, "63983");
Expand All @@ -111,7 +112,7 @@ public void testGroovyScriptPendingNoSandboxRejected() throws Exception {
final String scriptText = "import hudson.model.Hudson;\n" +
"Hudson.getInstance();\n" +
"return \"Got instance!\";";
final File scriptFile = File.createTempFile("uno-choice", "63983");
final File scriptFile = Files.createTempFile("uno-choice", "63983").toFile();
FileUtils.writeStringToFile(scriptFile, scriptText, Charset.defaultCharset(), false);
final FileItem fi = new FileParameterValue.FileItemImpl(scriptFile);
scriptlerHelper.saveScript(fi, true, "63983");
Expand All @@ -137,7 +138,7 @@ public void testGroovyScriptApprovedSandboxRejected() throws Exception {
final String scriptText = "import hudson.model.Hudson;\n" +
"Hudson.getInstance();\n" +
"return \"Got instance!\";";
final File scriptFile = File.createTempFile("uno-choice", "63983");
final File scriptFile = Files.createTempFile("uno-choice", "63983").toFile();
FileUtils.writeStringToFile(scriptFile, scriptText, Charset.defaultCharset(), false);
final FileItem fi = new FileParameterValue.FileItemImpl(scriptFile);
scriptlerHelper.saveScript(fi, true, "63983");
Expand Down

0 comments on commit 730afa8

Please sign in to comment.