improve error handling for policy store sceanrio

This commit is contained in:
Varun Sharma
2025-09-06 11:26:42 -07:00
parent 92fc5d4bf7
commit b3fc98e4df
3 changed files with 16 additions and 5 deletions
+8 -2
View File
@@ -88140,8 +88140,14 @@ var setup_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _ar
lib_core.setFailed('Policy store requires id-token write permission as it uses OIDC to fetch the policy from StepSecurity API. Please add "id-token: write" to your job permissions.');
}
else {
// Log other errors but don't fail the job
lib_core.error(`Failed to fetch policy: ${err}`);
// Handle different HTTP status codes
if (err.statusCode >= 400 && err.statusCode < 500) {
lib_core.error('Policy not found');
}
else {
lib_core.error(`Unexpected error occurred: ${err}. Falling back to egress policy audit`);
confg.egress_policy = 'audit';
}
}
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -2
View File
@@ -89,8 +89,13 @@ interface MonitorResponse {
if (err.message && err.message.includes('Unable to get ACTIONS_ID_TOKEN_REQUEST')) {
core.setFailed('Policy store requires id-token write permission as it uses OIDC to fetch the policy from StepSecurity API. Please add "id-token: write" to your job permissions.');
} else {
// Log other errors but don't fail the job
core.error(`Failed to fetch policy: ${err}`);
// Handle different HTTP status codes
if (err.statusCode >= 400 && err.statusCode < 500) {
core.error('Policy not found');
} else {
core.error(`Unexpected error occurred: ${err}. Falling back to egress policy audit`);
confg.egress_policy = 'audit';
}
}
}
}