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

Add property permissions so groovy scripts can serialize json #14500

Merged
merged 1 commit into from
Nov 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ grant {
// groovy IndyInterface bootstrap requires this property for indy logging
permission java.util.PropertyPermission "groovy.indy.logging", "read";

// groovy JsonOutput, just allow it to read these props so it works (unsafe is not allowed)
permission java.util.PropertyPermission "groovy.json.faststringutils.disable", "read";
permission java.util.PropertyPermission "groovy.json.faststringutils.write.to.final.fields", "read";

// needed by Rhino engine exception handling
permission java.util.PropertyPermission "rhino.stack.style", "read";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public void testEvilGroovyScripts() throws Exception {
assertSuccess("def range = 1..doc['foo'].value; def v = range.get(0)");
// Maps
assertSuccess("def v = doc['foo'].value; def m = [:]; m.put(\"value\", v)");
// serialization to json (this is best effort considering the unsafe etc at play)
assertSuccess("def x = 5; groovy.json.JsonOutput.toJson(x)");
// Times
assertSuccess("def t = Instant.now().getMillis()");
// GroovyCollections
Expand Down