Skip to content

Commit c2d9ba0

Browse files
committed
fix: handle '401 Bad credentials' as invalid token in privateer auth check
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent da949b3 commit c2d9ba0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • services/apps/security_best_practices_worker/src/activities

services/apps/security_best_practices_worker/src/activities/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export async function getOSPSBaselineInsights(repoUrl: string, token: string): P
4444

4545
const combinedOutput = `${stdout}\n${stderr}`
4646

47-
if (combinedOutput.includes('401 Unauthorized')) {
47+
if (combinedOutput.includes('401 Unauthorized') || combinedOutput.includes('401 Bad credentials')) {
4848
svc.log.warn('Detected 401 error in privateer output - token invalid or expired!')
4949
throw ApplicationFailure.create({
5050
message: 'GitHub token invalid or expired',
@@ -63,7 +63,7 @@ export async function getOSPSBaselineInsights(repoUrl: string, token: string): P
6363

6464
// check for auth errors in captured output if available
6565
const output = `${err.stdout || ''}\n${err.stderr || ''}`
66-
if (output.includes('401 Unauthorized')) {
66+
if (output.includes('401 Unauthorized') || output.includes('401 Bad credentials')) {
6767
svc.log.warn('Detected 401 error in failed privateer output - token invalid or expired!')
6868
throw ApplicationFailure.create({
6969
message: 'GitHub token invalid or expired',

0 commit comments

Comments
 (0)