Skip to content

Commit

Permalink
Pass SafeConstructor
Browse files Browse the repository at this point in the history
for preventing remote code execution vulnerability
https://bitbucket.org/asomov/snakeyaml/wiki/Documentation
  • Loading branch information
sue445 committed Apr 6, 2020
1 parent a299e13 commit 356a7ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import groovy.transform.TupleConstructor
import hudson.FilePath
import hudson.Util
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor

@TupleConstructor
class YamlFileLoader extends YamlLoader {
Expand All @@ -17,7 +18,7 @@ class YamlFileLoader extends YamlLoader {
return null
}

Yaml yaml = new Yaml()
Yaml yaml = new Yaml(new SafeConstructor())
InputStream input = createFilePath().read()

try{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.yamlaxis
import groovy.transform.TupleConstructor
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor

@TupleConstructor
class YamlTextLoader extends YamlLoader {
Expand All @@ -10,7 +11,7 @@ class YamlTextLoader extends YamlLoader {

@Override
Map getContent() {
Yaml yaml = new Yaml()
Yaml yaml = new Yaml(new SafeConstructor())
yaml.load(yamlText)
}
}

0 comments on commit 356a7ba

Please sign in to comment.