feat(942440): reduce false positive#4346
Conversation
Removed exclusion rules for Facebook and Google click identifiers to reduce false positives.
for more information, see https://pre-commit.ci
|
📊 Quantitative test results for language: |
for more information, see https://pre-commit.ci
Refactor regex patterns for base64 and dot handling.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
EsadCetiner
left a comment
There was a problem hiding this comment.
Can you make your changes via the regex assembly file instead of deleting it? More complex regexes like you have here are harder to read and maintain which is why we have the format.
Can you add some positive/negative tests to make sure your change doesn't accidently break anything?
|
If you have an existing use case that shows how to create this regex in .ra, I’d be happy to look at it; otherwise, no. I feel I’ve already wasted enough time trying to implement this use case in .ra and nothing works. |
|
You can always refer to regex assembly and the crs-toolchain docs to get an idea as to how they work.
Keep in mind that Also can you add some positive/negative tests, and especially tests for the false positive that this PR is meant to fix? |
Added a chained rule for matching JWT base64-urlencoded tokens with detailed documentation.
for more information, see https://pre-commit.ci
Added multiple test cases for false positives against various tokens.
|
Thanks @EsadCetiner for your feedback. I updated the PR accordingly and added unit tests. I'm having an issue with the .ra file that I don't understand, and the debugging output is really not verbose. Could you please help me? |
Updated descriptions for multiple tests to include truncation note for the linter.
There was a problem hiding this comment.
If you run crs-toolchain regex format --all with crs-toolchain then that should resolve the errors for the assembly file
Also see my comments on the tests you need to fix
|
I have absolutely no idea how to do that through the GitHub interface. |
|
@touchweb-vincent You need to run the command locally on your machine then push your changes to GitHub via the CLI. I've fixed this one for you. |
|
Thanks @EsadCetiner |
|
I can't merge since I pushed a commit to this PR |
|
@touchweb-vincent Happened again - no information in the PR description. I had to read the code and tests to understand what are you trying to achieve and only AFTER that i was able to start a real review. Recently, you were asking on Slack what can you do to speed up reviewing of your PRs, so now i'm telling it to you for the second time: Write full and complete descriptions and provide all information which you are asked for. It's that simple. |
|
@azurit I understand, and I will try to do better, but I don’t have the required skills to clearly distinguish what seems obvious from what isn’t. So if I add more explanations, you might think I’m treating you like idiots - please don’t hold it against me; I’m just not good at gauging this, and communication really isn’t one of my strong points. |
…440.yaml Co-authored-by: azurit <jozef@sudolsky.sk>
|
Rule of thumb: Additional information and redundancy in a PR description is almost always a good thing. I see that it can look a bit idiotic at a given level, but it's definitely better to write too many explanations than not enough. PR descriptions are also for future reference when Slack conversations, other PRs and even issues are long forgotten. People should be able to make sense of a PR without any other explanation. Optional links welcome, but the information better be with the PR. And agreed: It takes practice. |
|
@touchweb-vincent Thank you. |
Hello,
Since we’re now handling a few false positives using a chained rule, I suggest excluding
[\w\-]+to avoid common false positives from this rule against tokens or URL slugsI didn’t add
\."just in case", but we could if needed. As far as I know, it’s impossible to have a full and dangerous injection within a[\w\-]+scope - at best it could catch fragmented injections or very exotic use cases, which I’ve never encountered in 20 years.This will certainly weaken the rule when it comes to capturing this type of payload (1--x-) but 942100 stay in backup.
What do you think?