CWE-352: Use of constant state in Oauth2 flow#259
Conversation
state in Oauth2 flow
owen-mc
left a comment
There was a problem hiding this comment.
Thanks, this looks good. My only reservation is how this would treat a combination of a constant value and a non-constant value. I think that currently the query would report that, but it shouldn't. Luckily this is easy to change: just make ConstantStateFlowConf extend DataFlow::Configuration instead of TaintTracking::Configuration. Please also add a test case for this situation.
Yep, found that in a test run on lgtm.com I think the best solution would be to keep the taint analysis, but only exclude cases where the constant joins a variable. Now I just need to figure out how to write that into the query. Any suggestions? Maybe a similar situation in another query? |
It seems to me like this isn't really necessary. What patterns are you hoping to catch by using taint flow? I think it might be better to include those specifically. |
Co-authored-by: intrigus-lgtm <60750685+intrigus-lgtm@users.noreply.github.com>
I was thinking about cases where a call |
You know what? I'll leave that out. So far haven't found a single example. |
|
How do I fix the stubbed dependencies? |
|
@gagliardetto could you elaborate what's wrong? |
|
This query tests depend on I need to somehow add this dependency without completely revolutionizing the go.mod file of I'm obviously doing something wrong with those two elements, but I'm not sure what. |
|
That's the reason why the test fails, BTW. |
|
@gagliardetto I believe it is failing because it doesn't have a |
|
Thank you @owen-mc ! |
owen-mc
left a comment
There was a problem hiding this comment.
Everything looks good. Thanks again for this contribution.
|
Thanks everyone! |


CWE-352: Cross-Site Request Forgery (CSRF)
This query looks for cases where the oauth2 client uses a constant-value
statestring when creating the auth URL, which makes CSRF possible.