Skip to content

Commit

Permalink
fixed spotbugs PATH_TRAVERSAL_IN issue
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanSpieker committed Aug 21, 2024
1 parent 94aadfc commit 68d873c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/jenkins/util/io/FileBoolean.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.apache.commons.io.FilenameUtils;

/**
* Uses a presence/absence of a file as a persisted boolean storage.
Expand All @@ -29,7 +30,7 @@ public FileBoolean(File file) {
}

public FileBoolean(Class owner, String name) {
this(new File(Jenkins.get().getRootDir(), owner.getName().replace('$', '.') + '/' + name));
this(new File(Jenkins.get().getRootDir(), FilenameUtils.getName(owner.getName().replace('$', '.') + '/' + name)));
}

/**
Expand Down
1 change: 0 additions & 1 deletion core/src/spotbugs/excludesFilter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@
<Class name="jenkins.slaves.restarter.UnixSlaveRestarter"/>
<Class name="jenkins.SoloFilePathFilter"/>
<Class name="jenkins.util.groovy.GroovyHookScript"/>
<Class name="jenkins.util.io.FileBoolean"/>
<Class name="jenkins.util.JavaVMArguments"/>
<Class name="jenkins.util.SystemProperties"/>
<Class name="jenkins.util.VirtualFile$FilePathVF"/>
Expand Down

0 comments on commit 68d873c

Please sign in to comment.