Skip to content

feat(asm): add 403 Forbidden response to all ASM API endpoints#9

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-N6eky
Open

feat(asm): add 403 Forbidden response to all ASM API endpoints#9
dmchaledev wants to merge 1 commit into
mainfrom
claude/elegant-edison-N6eky

Conversation

@dmchaledev
Copy link
Copy Markdown
Contributor

Problem

Every endpoint in asm/openapi.yaml was missing a 403 Forbidden response. The spec only described 401 Unauthorized, which leaves a meaningful gap for SDK consumers and API client authors:

Status Meaning Correct client action
401 Token missing or invalid Re-authenticate / prompt for new key
403 Token valid, but insufficient permissions Show a permissions error; re-auth won't help

For a security product where API keys can be scoped (e.g. read-only vs. admin), treating these identically leads to confusing UX — clients may prompt users to log in again when the real fix is a permissions change.

Changes

  • Added a reusable Forbidden response component to components/responses with a clear description and example error body
  • Referenced $ref: '#/components/responses/Forbidden' under the '403' key on all 11 endpoints:
    • GET /assets, GET /assets/{id}, PATCH /assets/{id}, DELETE /assets/{id}
    • GET /scans, POST /scans, GET /scans/{scan_id}
    • GET /vulnerabilities, GET /vulnerabilities/{vuln_id}, PATCH /vulnerabilities/{vuln_id}
    • GET /tags, POST /tags

Test plan

  • CI Spectral lint passes on this branch (validate-openapi.yml)
  • No existing 403 references were present before, so no regressions possible
  • Confirm the Forbidden component renders correctly in a Swagger/Redoc viewer

https://claude.ai/code/session_01NSCBkwTnx3dp2co9rQjpWg


Generated by Claude Code

Every endpoint was missing a 403 response, meaning SDK generators and
API clients had no contract for the "valid token, wrong permissions"
case — which is distinct from 401 and requires different handling
(show a permissions error rather than prompting re-auth).

Adds a reusable Forbidden component to components/responses and
references it from all 11 endpoints in the ASM spec.

https://claude.ai/code/session_01NSCBkwTnx3dp2co9rQjpWg
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.

2 participants