Skip to content

Account policy treats non-finite risk scores as low risk #55

@lazyGPT07

Description

@lazyGPT07

Bug

evaluateAccountPolicy clamps the supplied riskScore with Math.min/Math.max, but NaN remains NaN. riskBandForScore(NaN) then falls through to low, so a matching grant can allow the action instead of failing closed. Negative infinity similarly clamps to zero.

Reproduction

Call evaluateAccountPolicy with a matching grant and riskScore: Number.NaN (or Number.NEGATIVE_INFINITY). The result can be allow with a non-finite/low score.

Expected

Non-finite externally supplied risk scores should fail closed by normalizing them to the maximum risk score before policy evaluation.

Proposed fix

Normalize non-finite risk values to 1, retain the existing [0, 1] clamp for finite values, and add regression coverage for NaN and infinities.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions