Skip to content

Commit ccb9f57

Browse files
committed
Use .match in isAuthToken and add repeated call to test
1 parent 0a0c3a2 commit ccb9f57

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/artifact-scanner.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ test("isAuthToken", (t) => {
3131

3232
// Token types for strings that are tokens.
3333
t.is(isAuthToken(`ghp_${makeTestToken()}`), TokenType.PersonalAccessClassic);
34+
t.is(isAuthToken(`ghp_${makeTestToken()}`), TokenType.PersonalAccessClassic);
3435
t.is(
3536
isAuthToken(`ghs_${makeTestToken(255)}`),
3637
TokenType.AppInstallationAccess,

src/artifact-scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export function isAuthToken(
8888
patterns: TokenPattern[] = GITHUB_TOKEN_PATTERNS,
8989
) {
9090
for (const { type, pattern } of patterns) {
91-
if (pattern.test(value)) {
91+
if (value.match(pattern)) {
9292
return type;
9393
}
9494
}

0 commit comments

Comments
 (0)