[WIP] ascanrules: Fix for XSS issues related to javascript context.#3838
[WIP] ascanrules: Fix for XSS issues related to javascript context.#3838jokrsec wants to merge 4 commits intozaproxy:mainfrom
Conversation
...ascanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/parserapi/JavaScriptLexer.java
Outdated
Show resolved
Hide resolved
|
Is some of this generated or third party code? |
|
The parser code is generated by antlr. I'll add the unit tests for the fixed issues 🙂 |
This should be noted somehow, so that people don't try to maintain the classes manually. (@thc202 advice/ideas on that front?)
Great. There's unfortunately also a conflict you're going to need to address. I think I mentioned on the other PR that I'd look at it but I haven't had a chance yet. The XSS scan rule was made less monolithic so hopefully adapting your changes isn't too bad/hard. |
|
It does say |
|
That's a good start, sorry I overlooked it. Should we exclude the license header from those then? (I think that will help it to stand out.) |
|
FYI I've been chatting to @jokrhub about this, and will manually override the DCO check :) |
|
If the antlr files are generated we should also document the steps needed to update. |
...scanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/CrossSiteScriptingScanRule.java
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
1 similar comment
This comment was marked as duplicate.
This comment was marked as duplicate.
...scanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/CrossSiteScriptingScanRule.java
Outdated
Show resolved
Hide resolved
...s/src/test/java/org/zaproxy/zap/extension/ascanrules/CrossSiteScriptingScanRuleUnitTest.java
Show resolved
Hide resolved
|
To address the DCO requirement you'll need to sign-off the commit(s):
You could also fixup all the commits into a single and force push. Then use commit --amend and force push on subsequent changes |
kingthorin
left a comment
There was a problem hiding this comment.
Looks good overall. The DCO and squash/fixup still need to be addressed. Plus there's one thing here that could probably be simplified.
...scanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/CrossSiteScriptingScanRule.java
Outdated
Show resolved
Hide resolved
|
We spoke on slack, I understand you're having trouble getting an interactive rebase to work nicely. Don't worry, it isn't terribly straight forward and is daunting if you haven't done it successfully in the past. If you can just confirm that you agree with https://developercertificate.org/ we can manually set it to pass. |
Yes I agree. |
|
We should add the grammar and a Gradle task to (re)generate the code. |
|
@jokrhub if you can just add a comment with some details on how the code was generated we can discuss adding a gradle task 😀 |
...scanrules/src/main/java/org/zaproxy/zap/extension/ascanrules/CrossSiteScriptingScanRule.java
Show resolved
Hide resolved
|
Below are the steps to generate lexer and parser files using antlr:
|
|
Grr I don’t see the push here anymore, got the id? Or can you just push it again and I’ll deconflict things more carefully. |
|
Found it: 7beed33 |
|
Restored. |
|
Thanks! Feel free to fix up if it looks sane. |
|
It does look sane. I still need to address earlier comments about logic changes and additional tests. Which I intend to tackle but I need to take the time to figure out what the original logic was catching, write tests, then figure out why/how the logic was changed. (Unless @jokrhub or someone else has interest in tackling that.) All that to say, there’s still more change coming that will probably also need to be flattened. |
|
Sounds good, I can take a look at adding the tests cases. |
|
Thanks, I'd appreciate that! |
0d361a7 to
50a375a
Compare
Signed-off-by: jokrhub <loganalex007@gmail.com>
Reduce code duplication, extract constants, remove unnecessary comments. Signed-off-by: thc202 <thc202@gmail.com>
Update to latest versions. Exclude 3rd-party code from Error Prone to avoid the need to do manual changes when updated. Signed-off-by: thc202 <thc202@gmail.com>
Use the same listener for all parsers, it has no state. Use the same exception since it's only used for control flow and do not use an error where a runtime exception is enough. Signed-off-by: thc202 <thc202@gmail.com>
d224ac7 to
e003d42
Compare
e003d42 to
73fe039
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
73fe039 to
8ead4e0
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Rebased current |
8ead4e0 to
73fe039
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
73fe039 to
e003d42
Compare
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA 1 out of 2 committers have signed the CLA. |
|
This is pending me fixing things after the rebase. Between the previous one and now another 10 param method was introduced so now that conflicts with these changes. |

Fixes zaproxy/zaproxy#7212
Integrated a javascript parser to extract the contexts. Updated the scanner to fix the issues.