Changes to check for response other than 200 OK#15
Changes to check for response other than 200 OK#15amitamathkar wants to merge 4 commits intoluh2:masterfrom
Conversation
fenceposterror
left a comment
There was a problem hiding this comment.
Thanks for your pull request! I started reviewing the code. Please improve the pull request according to the comments.
DetectDynamicJS.py
Outdated
| scan_issues.append(issue) | ||
| return scan_issues | ||
| else: | ||
| if(self.hasScriptContent(newRequestResponse)): |
There was a problem hiding this comment.
small change - please check if it does not have script content - return None -> less indentation for the rest. :)
DetectDynamicJS.py
Outdated
|
|
||
| def hasScriptContent(self,requestResponse): | ||
| """ | ||
| Checks if the response of the request contains the scipt content |
There was a problem hiding this comment.
somehow this did not make it all the way to your commit
There was a problem hiding this comment.
Typo is fixed in recent commit.
DetectDynamicJS.py
Outdated
| secondRequestResponse) | ||
| scan_issues.append(issue) | ||
| return scan_issues | ||
| else: |
There was a problem hiding this comment.
It looks to me like this else is not necessary. safe an indent. safe a little cats life. Makes the code more readable.
There was a problem hiding this comment.
This is fixed as per comments.
DetectDynamicJS.py
Outdated
| secondRequestResponse) | ||
| scan_issues.append(issue) | ||
| return scan_issues | ||
| if(self.isScannableRequest(newRequestResponse)): |
There was a problem hiding this comment.
Looks like this could be flattened out by an early return as well.
There was a problem hiding this comment.
This is modified by changing the if conditions, the code is more flattened out in recent pull commit.
|
If I understand your first pull request correctly, all it needs in |
I think |
|
You get a login oracle if the second request is not a scannable request. You want to lose that information? Maybe it would be good to introduce a new finding. Take it out for now, and I'll open an issue about that. |
|
So please take it out, and we'll fix that in a separate commit. It's true, we can stop earlier testing, but this is mixing up things, and is still a finding |
|
@luh2, you are making a good point about the login oracle. I know Sebastian mentions "login state" in the paper, but how would you protect data otherwise. Having an access control where "if the user is logged in, the user can access X", and "if the user is not logged it, respond with Unauthorized" is a standard practice. I find that when these issues are flagged by DetectDynamicJS, they are marked as false positives in real assessments and are treated as noise. My understanding is that this whole pull request is targeting exactly that scenario, when the unauthenticated response doesn't return cookies, 200 Ok, or any script in the body. And as you suggest, taking out the condition of checking if the unauthenticated response contains any script basically makes the whole pull request unnecessary. |
|
You could make js files not require authentication. Fairly simple. I guess most apps prefer to just leak their login state, which doesn't make me less want to know about them. |
|
Just merged another pull request - that might solve lots of what you were trying to achieve already. #16 |
Improvement to the plugin checks the status code of the response and does not report the issue for responses other than 200 OK (e.g. 401 Unauthorized) if the response is not a dynamic script (contribution by Synopsys).