Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

whitelist replaceAll(pattern, String) #565

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ method java.util.regex.MatchResult group int
method java.util.regex.MatchResult group java.lang.String
method java.util.regex.MatchResult groupCount
method java.util.regex.MatchResult hasMatch
method java.util.regex.MatchResult namedGroups
method java.util.regex.MatchResult namedGroups
method java.util.regex.MatchResult start
method java.util.regex.MatchResult start int
method java.util.regex.MatchResult start java.lang.String
Expand Down Expand Up @@ -1373,8 +1373,10 @@ staticMethod org.codehaus.groovy.runtime.StringGroovyMethods readLines java.lang
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods readLines java.lang.String
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.CharSequence java.lang.CharSequence groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.CharSequence java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.CharSequence java.util.regex.Pattern java.lang.CharSequence
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.String java.lang.String groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.String java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceAll java.lang.String java.util.regex.Pattern java.lang.String
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is deprecated: https://github.com/apache/groovy/blob/GROOVY_2_4_21/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2613-L2620

Since String implements CharSequence, the sandbox should not be calling this.

I would recommend adding unit tests demonstrating that an entry in this whitelist is actually required.

I suspect StaticWhitelistTest is failing to mechanically detect useless entries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷 Either way, should be harmless to allow it.

staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.lang.CharSequence groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.CharSequence java.util.regex.Pattern groovy.lang.Closure
staticMethod org.codehaus.groovy.runtime.StringGroovyMethods replaceFirst java.lang.String java.lang.String groovy.lang.Closure
Expand Down
Loading