Skip to content

Commit cce2cd8

Browse files
committed
[SECURITY-2705] Documentation
1 parent 77f0e8b commit cce2cd8

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/fileParameters.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# File Parameters
2+
3+
Prior to `449.v77f0e8b_845c4` the `input` step allowed the specification of all parameters including `FileParametersValue`s.
4+
This was both flawed (it caused errors persisting the build, and only worked on the controller thus required builds to run on the controller which is insecure), as well as being insecure in itself (potentially allowing overwriting of arbitrary files).
5+
6+
As the support is now been disabled if you were using this idiom before, you now need to update your pipelines to continue working.
7+
8+
## Migration
9+
10+
To migrate we suggest the [File Parameter plugin](https://plugins.jenkins.io/file-parameters/).
11+
12+
Where a pipeline was before doing something similar to the following:
13+
14+
```groovy
15+
def file = input message: 'Please provide a file', parameters: [file('myFile.txt')]
16+
node('built-in') {
17+
// do something with the file stored in $file
18+
}
19+
```
20+
21+
it can be changed to use the following syntax
22+
23+
```groovy
24+
def fileBase64 = input message: 'Please provide a file', parameters: [base64File('file')]
25+
node {
26+
withEnv(["fileBase64=$fileBase64"]) {
27+
sh 'echo $fileBase64 | base64 -d > myFile.txt'
28+
// powershell '[IO.File]::WriteAllBytes("myFile.txt", [Convert]::FromBase64String($env:fileBase64))'
29+
}
30+
// do something with the file stored in ./myFile.txt
31+
}
32+
```
33+
34+
Please see the [File Parameter plugin documentaion](https://github.com/jenkinsci/file-parameters-plugin#usage-with-input) for more details

0 commit comments

Comments
 (0)