Added ability to hide sensative logs#825
Added ability to hide sensative logs#825JackSeaton wants to merge 1 commit intoscrapinghub:masterfrom
Conversation
|
Hi! I think it makes sense to have a way to prevent args from being put to logs. It is not only about security: if you're doing large crawls, and use lua scripts or cookies heavily, args may take a lot of disk space, and cause quite a lot of IO. |
|
|
||
| if self.hide_passed_json_and_lua_source: | ||
| if 'posted_json' in options: | ||
| del options['posted_json'] |
There was a problem hiding this comment.
I don't think we should be hard-coding specific keys. I can see two ways of handling it:
dont_logargument, which can disable logging of specific fields per-request (posted_json and lua_source in this case);--log-args 0startup argument, which disables logging of args completely
There was a problem hiding this comment.
Yeah, I didn't think this was necessarily the best way to go about it. I was more so trying to get the idea out and we can go from there.
--log-args 0 would be great as long as it only stops the logging of this startup/shutdown args and not stops the logging from within the script (e.x. print())
There was a problem hiding this comment.
I was thinking --log-args 0 disables logs only for Splash arguments, nothing else - i.e. "args" value in the log you've pasted
I know this isn't ready to be merged, but the main idea is there.
Below is an example of posting some splash code, along with some variables to be executed (I pretty printed the JSON for readability):
As you can clearly see it logs
posted_jsonwhich contains our sensitive info (email, password, proxy configs, etc.) as well aslua_sourcewhich can also contain sensitive information.As a solution I've added a command line arg that will disable the logging of these features.
Below is an example of the same code being posted to the endpoint with my changes in place
As you can see, there's no
lua_sourceorposted_jsonPlease feel free to comment on this PR and we can work together to get the feature wrapped into splash!
Thanks
Jack