Skip to content

[JENKINS-55557] Add support for state parameter #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2019

Conversation

jkakavas
Copy link

Use of state parameter [1] when using the authorization code grant
flow of oAuth2, mitigates CSRF attacks as described in "OAuth 2.0
Threat Model and Security Considerations" [2]

[1] https://tools.ietf.org/html/rfc6749#section-4.1.1
[2] https://tools.ietf.org/html/rfc6819#section-4.4.1.8

which mitigates CSRF attacks when using the authorization code grant
flow of oAuth2
Generate a random string satisfying the specification's
requirements without using Base64 so that the plugin can be used
with installations using Java 7
@jkakavas
Copy link
Author

Is there any interest in this ? Would someone like to review or give some feedback?

@samrocketman
Copy link
Member

This looks good to me. I'll test it; thank you for contributing 👍

@samrocketman samrocketman merged commit 962a063 into jenkinsci:master Apr 12, 2019
samrocketman added a commit that referenced this pull request Apr 12, 2019
This octomerge simplifies merging multiple pull requests.  They've all
been tested in conjunction and don't cause any upgrade issues.
@samrocketman
Copy link
Member

This has been released in github-oauth 0.32

@samrocketman
Copy link
Member

@jkakavas
Copy link
Author

jkakavas commented May 3, 2019

@samrocketman will take a look tomorrow my morning, thanks for the ping

@jkakavas
Copy link
Author

jkakavas commented May 5, 2019

@samrocketman Given that the error described in https://issues.jenkins-ci.org/browse/JENKINS-57154 is about fetching the details of a user, maybe this bug could be a byproduct of #109 that explicitly touches loadUserByUsername(String username) and not this PR ?

cc @agentgonzo

@jkakavas
Copy link
Author

jkakavas commented May 5, 2019

@samrocketman I have verified that 0.32 shows the problematic behavior that users describe in https://issues.jenkins-ci.org/browse/JENKINS-57154 even with the changes from this PR reverted. As such, I believe that something else that has changed between 0.31 was released and now is at fault. I'll probably find some time to troubleshoot further in the week, but maybe someone who is more accustomed with the plugin's codebase can offer some insights

@samrocketman
Copy link
Member

Ok thanks

@samrocketman
Copy link
Member

I’ll also debug it from my end and see if I can figure it out.

@jondkelley
Copy link

jondkelley commented Jun 21, 2019

Jenkins ver 2.176.1

We upgraded to 0.32 github oauth and experience this issue. (Previous: 0.29 worked)

We can't edit global settings, security settings, security permissions on jobs or even edit workspace permissions. "No valid crumb was included in the request" errors all around

  [EDIT] Upgrading this bug to CRITICAL if you don't mind. Restarted Jenkins after "downgrading" to github-oauth 0.29 and we are still on github-oauth 0.32, we have no workaround for this bug. We may be able to force CSRF disabled in Jenkins v2.176.1 by setting java startup option hudson.security.csrf.GlobalCrumbIssuerConfiguration=false but that is a really bad idea with the oauth integration and always. That is why prioritization is critical on this issue.

Thanks guys, CSRF implementations are never fun.  

 

@jkakavas
Copy link
Author

jkakavas commented Jul 1, 2019

We should move the discussion about https://issues.jenkins-ci.org/browse/JENKINS-57154 in that issue, or in a relevant issue here as this specific PR seems to be unrelated to the reported issue.

@kaze-nomamani
Copy link

Hello... I am the first reporter of the issue... I didn't notice this issue was fixed...

https://issues.jenkins-ci.org/browse/SECURITY-443

Can I get a credit for the issue?? All of message from jenkins went to my spam folder...so, I didn't notice about that:( In this case, can i still list my name on security advisory?

https://jenkins.io/security/advisory/2019-04-30/

@kaze-nomamani
Copy link

Reporter Name was added on original report.

https://issues.jenkins-ci.org/browse/SECURITY-443

Sorry for the delay...

@samrocketman
Copy link
Member

@Testtest1234test I have no way of verifying this is Takashi Suzuki's GitHub account. If this is your account then please comment in https://issues.jenkins-ci.org/browse/SECURITY-443 verifying that this is Takashi Suzuki's GitHub account?

cc @daniel-beck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants