Skip to content

Commit

Permalink
[SECURITY-1826] Use conservative constructors
Browse files Browse the repository at this point in the history
Update YAML usage to be more conservative in how it parses YAML into Java
Objects.  Restricts it to basic objects like HashMap or LinkedList.

See also:

- [SECURITY-1826][SECURITY-1826]

[SECURITY-1826]: https://issues.jenkins-ci.org/browse/SECURITY-1826
  • Loading branch information
samrocketman committed Apr 19, 2020
1 parent d4d1158 commit a36e8bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ jenkinsPlugin {

dependencies {
implementation "org.codehaus.groovy:groovy-all:${groovyVersion}"
implementation 'net.gleske:jervis:1.5'
implementation 'org.yaml:snakeyaml:1.25'
implementation 'net.gleske:jervis:1.7'
implementation 'org.yaml:snakeyaml:1.26'

jenkinsPlugins 'org.jenkins-ci.plugins:credentials:2.1.18'
jenkinsPlugins 'org.jenkins-ci.plugins:scm-api:2.2.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import java.util.logging.Level
import java.util.logging.Logger
import java.util.regex.Pattern
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.constructor.SafeConstructor


public class JervisFilterTrait extends SCMSourceTrait {
Expand Down Expand Up @@ -191,7 +192,7 @@ public class JervisFilterTrait extends SCMSourceTrait {
LOGGER.fine("On target ref ${target_ref}, found ${yamlFile}:\n${['='*80, yamlText, '='*80].join('\n')}\nEND YAML FILE")

// parse the YAML for filtering
Map jervis_yaml = (new Yaml()).load(yamlText)
Map jervis_yaml = (new Yaml(new SafeConstructor())).load(yamlText)
if(head in TagSCMHead) {
// tag
if(!('tags' in jervis_yaml)) {
Expand Down

0 comments on commit a36e8bd

Please sign in to comment.