Skip to content

fix(responsible-ai): a Low rating showed as "moderate" risk - #130

Merged
vsn411 merged 2 commits into
mainfrom
fix/responsible-ai-risk-mapping
Nov 15, 2026
Merged

vsn411 merged 2 commits into
mainfrom
fix/responsible-ai-risk-mapping

Conversation

@vsn411

@vsn411 vsn411 commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

While verifying the Responsible AI activity end to end (real secfoo run --skill responsible-ai-compliance --agent claude against openai/openai-quickstart-python, then secfoo serve), the run rated the system Low and every view showed moderate with an amber badge: /responsible-ai, /assessments/1, the assessments list, and secfoo assessment show.

Cause: RunRepository._responsible_ai_badges did "high-risk" if rating == "high" else "moderate". Only High was mapped; Low, Medium, Critical and even an unparsable rating all became "moderate".

Fix

  • RESPONSIBLE_AI_RISK_BY_RATING: critical/high → high-risk, medium → moderate, low → low-risk; anything else → not rated (None, so the assessment is not listed or counted).
  • low-risk gets badge--success in the templating filter.
  • Tests: parametrized storage test over all four ratings plus the unknown-rating case and the coverage count; a web test asserting the Low run renders low-risk (green) and never "moderate" on /responsible-ai and the assessment page.

Verified working (no change needed)

  • Report contract: the real run produced **Overall risk rating:** Low, six ### [Low] Fn: findings, register and coverage notes; CLI counted 0/0/0/6.
  • Auto-created assessment picks up the rating; assessment update --status completed flips provisional → confirmed.
  • AI-BOM upload (JSON and CSV) parses and the overview shows the model/tool counts; a malformed AI-BOM is kept with a yellow warning, as the code intends.
  • /, /responsible-ai, /activities/responsible-ai-compliance, /assessments, /assessments/1, /runs/<id> all 200 with no server errors.

Gaps that are bigger than a fix are filed as hackathon issues (Responsible AI output contract and per-dimension dashboard; persisted rating and end-to-end tests).

🤖 Generated with Claude Code

The Responsible AI badge was derived with `"high-risk" if rating == "high"
else "moderate"`, so a system the skill rated Low showed as "moderate"
risk on the Responsible AI page, the assessment page, the assessments
list and `secfoo assessment show`. Found on a real run against
openai/openai-quickstart-python: "Overall risk rating: Low", badge
"moderate". A Critical rating would have been downgraded the same way,
and an unparsable rating became a tier instead of "not rated".

Map critical/high -> high-risk, medium -> moderate, low -> low-risk (green
badge), anything else -> not rated. Tests cover every tier, the unknown
rating, the coverage count, and the dashboard pages for a Low run.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@vsn411
vsn411 merged commit f24043b into main Nov 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant