-
Notifications
You must be signed in to change notification settings - Fork 374
Store token as Secret instead of String #335
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
Conversation
@@ -115,6 +115,7 @@ public void setOwner(String owner) { | |||
|
|||
@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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method now only runs on a controller, let's enforce that.
1dbbb71
to
f59647b
Compare
@@ -149,7 +150,8 @@ static AppInstallationToken generateAppInstallationToken(String appId, String ap | |||
.create(); | |||
|
|||
long expiration = getExpirationSeconds(appInstallationToken); | |||
AppInstallationToken token = new AppInstallationToken(appInstallationToken.getToken(), | |||
AppInstallationToken token = new AppInstallationToken( | |||
Secret.fromString(appInstallationToken.getToken()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app installation token only exists as a bare string inside this method.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
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
Secret
is actually stored and serialized, but this is more correct regardless.Submitter checklist
Reviewer checklist
Documentation changes
Users/aliases to notify