Skip to content

Commit

Permalink
Update DV access key regex to be more selective
Browse files Browse the repository at this point in the history
This should address the code-scanning alert
  https://github.com/gradle/actions/security/code-scanning/1
  • Loading branch information
bigdaz committed Jun 13, 2024
1 parent e3bc05f commit 433fceb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sources/src/develocity/short-lived-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ type HostnameAccessKey = {
}

export class DevelocityAccessCredentials {
static readonly accessKeyRegexp = /^(\S+=\w+)(;\S+=\w+)*$/
static readonly accessKeyRegexp = /^([^;=\s]+=\w+)(;[^;=\s]+=\w+)*$/
readonly keys: HostnameAccessKey[]

private constructor(allKeys: HostnameAccessKey[]) {
Expand Down Expand Up @@ -201,6 +201,6 @@ export class DevelocityAccessCredentials {
}

private static isValid(allKeys: string): boolean {
return this.accessKeyRegexp.test(allKeys)
return this.accessKeyRegexp.test(allKeys) && this.accessKeyRegexp2.test(allKeys)
}
}

0 comments on commit 433fceb

Please sign in to comment.