Store token as Secret instead of String#335
Merged
bitwiseman merged 1 commit intojenkinsci:masterfrom Sep 8, 2020
Merged
Conversation
bitwiseman
commented
Sep 4, 2020
|
|
||
| @SuppressWarnings("deprecation") // preview features are required for GitHub app integration, GitHub api adds deprecated to all preview methods | ||
| static AppInstallationToken generateAppInstallationToken(String appId, String appPrivateKey, String apiUrl, String owner) { | ||
| JenkinsJVM.checkJenkinsJVM(); |
Contributor
Author
There was a problem hiding this comment.
This method now only runs on a controller, let's enforce that.
1dbbb71 to
f59647b
Compare
bitwiseman
commented
Sep 4, 2020
| long expiration = getExpirationSeconds(appInstallationToken); | ||
| AppInstallationToken token = new AppInstallationToken(appInstallationToken.getToken(), | ||
| AppInstallationToken token = new AppInstallationToken( | ||
| Secret.fromString(appInstallationToken.getToken()), |
Contributor
Author
There was a problem hiding this comment.
The app installation token only exists as a bare string inside this method.
dwnusbaum
approved these changes
Sep 4, 2020
Member
Yeah, I don't think this affects the security of the implementation, but if it makes things simpler/less error prone then it seems fine to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow on to #326. We shouldn't keep the app installation token as a bare
String.I don't think this is a huge deal given how
Secretis actually stored and serialized, but this is more correct regardless.Submitter checklist
Reviewer checklist
Documentation changes
Users/aliases to notify