-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
disable javascript execution by default #3818
Conversation
Pretty bold @himanshug :) There should be a doc change for this too, at least to javascript.md and probably a few other files. Maybe also add a property That all being said, I'm not sure how I feel about making this change. JavaScript being off by default appeals to me because it's generally not recommended except for prototyping, and is not sandboxed at all (which, even though documented, is likely surprising to users). But I am also reticent to go buck wild with incompatible changes. I'll go along with whatever the consensus is though. |
I am 👍 with the changes. I agree with Gian, I think we can just have an |
@@ -73,8 +73,8 @@ public String toString() | |||
'}'; | |||
} | |||
|
|||
public static JavaScriptConfig getDefault() | |||
public static JavaScriptConfig getEnabled() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a double-take on this, thinking it was a method getting whether or not something was enabled. getEnabledInstance()
or enabledInstance()
would probably be clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
@gianm I can make all the other doc updates etc , if we conclude that it makes sense to disable javascript by default. yes, it is backward incompatible and that is why 0.10.0 would be the right time to do it. |
I think having javascript disabled is a good default, and IMO it doesn't impose a huge incompatibility transition cost on users (just add the enable property to the config) Also agree on flipping the setting name from |
efe1136
to
27de087
Compare
3a5b4bf
to
e73a915
Compare
👍 |
👍 |
|
||
Druid does not execute JavaScript functions in a sandbox, so they have full access to the machine. So Javascript | ||
functions allow users to execute arbutrary code inside druid process. So, by default, Javascript is disabled. | ||
However, on dev/staging environments or a secured production environments you can enable those by setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a secured production environments
-> remove the a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jon-wei updated
Had a minor comment on doc wording, otherwise 👍 |
e73a915
to
8603162
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but can I request we keep this open until next weeks dev sync?
@@ -22,6 +22,14 @@ without needing to write and deploy Druid extensions. | |||
|
|||
Druid uses the Mozilla Rhino engine at optimization level 9 to compile and execute JavaScript. | |||
|
|||
## Security | |||
|
|||
Druid does not execute JavaScript functions in a sandbox, so they have full access to the machine. So Javascript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"arbitrary"
👎 booo JavaScript makes the world go round. There are a number of cool things in Plywood that would stop working if JavaScript was disabled. |
The specific things that JS is used for as a gap filler are:
=> {
"dimension": "__time",
"extractionFn": {
"function": "function(s){try{\nvar d = new org.joda.time.DateTime(s);\nd = d.getSecondOfDay();\nreturn d;\n}catch(e){return null;}}",
"type": "javascript"
},
"outputName": "Time",
"type": "extraction"
} |
@vogievetsky those are compelling reasons to have js enabled on cluster ( and by default specially for Pivot users) |
so, we discussed both options in the dev sync and concluded that it should be secure by default and by making users explicitly enable it, they will know the risks versus current default where users have it enabled inadvertently and not even using the JS features. |
Ok, that sounds fair @himanshug. One request I have is to edit the docs for the "javascript" things to point out that it's disabled by default, otherwise users might get confused when the things they read about in the docs don't work. One way to do this is to change the info note that is next to all the javascript things to something like:
|
If you search in the docs for "JavaScript programming guide" you should then find all the boxes. |
b672c5d
to
266351f
Compare
@gianm docs for "JavaScript programming guide" are updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
@himanshug I am OK with this patch as-is after fixing conflicts
266351f
to
563e0b0
Compare
most users don't use javascript but still have it enabled because it happens to be default behavior and are surprised that it is enabled by default even with severe security threat.
with 0.10.0, we can disable javascript by default.