mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 23:07:29 +00:00
Classify non-finite risk bands as critical
This commit is contained in:
parent
a50fc8714e
commit
af1d971477
2 changed files with 10 additions and 0 deletions
|
|
@ -24,6 +24,13 @@ describe("account-core", () => {
|
|||
expect(riskBandForScore(score)).toBe("high");
|
||||
});
|
||||
|
||||
it.each([Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY])(
|
||||
"classifies a non-finite risk score of %s as critical",
|
||||
(riskScore) => {
|
||||
expect(riskBandForScore(riskScore)).toBe("critical");
|
||||
}
|
||||
);
|
||||
|
||||
it("requires approval for gated actions with matching grants", () => {
|
||||
const result = evaluateAccountPolicy({
|
||||
action: "email:send",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ const WRITE_ACTIONS = new Set([
|
|||
]);
|
||||
|
||||
export function riskBandForScore(score: number): LogicSrcRiskBand {
|
||||
if (!Number.isFinite(score)) {
|
||||
return "critical";
|
||||
}
|
||||
if (score >= 0.75) {
|
||||
return "critical";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue