Skip to content

Commit ac27663

Browse files
committed
Potential bug in access_token retrieval method
- currently it's working due to 2 facts - the keys are alphabetically ordered and for the moment `access_token` is the first one - there is no key containing access_token like `optional_access_token` or `access_token_primary` - this modification will prevent change in the key set to affect our retrieval technique
1 parent 7065713 commit ac27663

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ private String getAccessToken(@Nonnull String code) throws IOException {
426426
}
427427
String parts[] = content.split("&");
428428
for (String part : parts) {
429-
if (content.contains("access_token")) {
429+
if (part.startsWith("access_token=")) {
430430
String tokenParts[] = part.split("=");
431431
return tokenParts[1];
432432
}

0 commit comments

Comments
 (0)