fix(security): surface refreshed gateway warnings

This commit is contained in:
Jesse Merhi
2026-08-10 15:03:18 +10:00
committed by jesse-merhi
parent 5ffbd24cbb
commit 7412828da8
2 changed files with 22 additions and 2 deletions
@@ -375,6 +375,19 @@ describe("legacy file install scan compatibility", () => {
expect(result?.blocked).toMatchObject({
code: "security_scan_blocked",
installPolicyWarning: {
targetName: "payload",
targetType: "plugin",
requestMode: "install",
reason: "review the new finding",
findings: [
{
ruleId: "changed-warning",
severity: "warn",
message: "new finding",
},
],
},
});
expect(result?.blocked?.reason).toContain("Reason: review the new finding");
expect(result?.blocked?.reason).toContain("new finding");
+9 -2
View File
@@ -878,6 +878,13 @@ async function runOperatorInstallPolicy(params: {
return {
blocked: {
code: "security_scan_blocked",
installPolicyWarning: {
targetName: params.targetName,
targetType: params.targetType,
requestMode: params.requestMode,
reason: reevaluated.warning.reason,
...(reevaluated.findings?.length ? { findings: reevaluated.findings } : {}),
},
reason: formatInstallPolicyNotice({
decision: "warn",
findings: reevaluated.findings,
@@ -895,8 +902,8 @@ async function runOperatorInstallPolicy(params: {
} else {
logPolicyResult(reevaluated);
}
// Approval covers this warning only after a fresh evaluation. Callers that
// offer one-shot approval still reject warnings from later scan stages.
// Approval covers only an unchanged warning after a fresh evaluation.
// One-shot callers still reject later or changed warnings.
return undefined;
}
if (acknowledgement.status === "unavailable") {