Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jglick
Copy link
Member

@jglick jglick commented Aug 20, 2020

More verbose but probably safer version of #329. Untested.

The idea here is that the agent never sees the private key in plaintext, nor does it have the opportunity to create a spoofed API endpoint or whatever. It just gets an opaque, encrypted cookie, and any time it wants to look up the app token, it must ask the controller. Compared to #329 this is stateless.

Rather than Secret, which can be constructed in other ways, I would rather use CryptoConfidentialKey. Unfortunately that has IV-related methods which are still not available for use from plugins. There does not seem to any easy-to-use and safe way of constructing an encrypted cookie in Jenkins, much less one from structured data like this.

@jglick jglick requested a review from bitwiseman August 20, 2020 19:33
@jglick
Copy link
Member Author

jglick commented Aug 20, 2020

java.lang.AssertionError: expected:<1> but was:<0>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotEquals(Assert.java:835)
	at org.junit.Assert.assertEquals(Assert.java:647)
	at org.junit.Assert.assertEquals(Assert.java:633)
	at org.jenkinsci.plugins.github_branch_source.ApiRateLimitCheckerTest.NormalizeThrottleWithBurnedBuffer(ApiRateLimitCheckerTest.java:361)

seems to be a flake.

Copy link
Contributor

@bitwiseman bitwiseman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me. Do you mind if I add the caching back into this PR?

@jglick
Copy link
Member Author

jglick commented Aug 20, 2020

Do you mind if I add the caching back into this PR?

Sure, feel free to use this as a starting point for something more polished.

@bitwiseman bitwiseman closed this Aug 25, 2020
@jglick jglick deleted the GitHubAppCredentials-SlaveToMasterCallable branch August 25, 2020 20:32
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.

2 participants