mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-13 03:52:05 +00:00
Adding separate check for symlink to prevent jailbreak
Otherwise a symlink can be created to point to a file outside $JENKINS_HOME and be read
This commit is contained in:
1 parent
ec1e47c053
commit
8a105ce57c
6 files changed
+41
-3
No files matched your search
@@ -617,7 +617,7 @@ public final class FilePath implements Serializable {
|
||||
act(new SecureFileCallable<Void>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
||||
writing(f);
|
||||
symlinking(f);
|
||||
Util.createSymlink(f.getParentFile(),target,f.getName(),listener);
|
||||
return null;
|
||||
}
|
||||
@@ -2692,6 +2692,17 @@ public final class FilePath implements Serializable {
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass through 'f' after ensuring that we can create that symlink.
|
||||
*/
|
||||
private File symlinking(File f) {
|
||||
FilePathFilter filter = filterNonNull();
|
||||
if (!f.exists())
|
||||
filter.create(f);
|
||||
filter.symlink(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass through 'f' after ensuring that we can delete that file.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user