Repository navigation
fix(cli): a role refusal on run register and publish says forbidden_role and why - #1146
Merged
Merged
Conversation
Contributor
Auto-review did not completeThe
Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal): Show partial reviewYou've hit your session limit · resets 7:40am (UTC) |
…ole and why Signed-off-by: Nik Cubrilovic <[email protected]>
nc9
force-pushed
the
fix/cli-role-refusals
branch
from
October 26, 2026 06:48
c9764c8 to
486a816
Compare
Contributor
Auto-review did not completeThe
Partial findings recovered from the session (incomplete, unverified, and NOT a merge signal): Show partial reviewYou've hit your session limit · resets 7:40am (UTC) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cloud now enforces the organization role matrix (squirrelscan/repo#3293, and #1138 here documents it). A viewer or billing member signed in to the CLI cannot run audits in that organization, so the server refuses two calls with
403:POST /v1/agent-runs/register);POST /v1/reports).Both refusals come in the bare shape
{ error: "forbidden_role", message, role, missing_scope }.The CLI did not handle that shape:
error.codefrom an allowlist.error.codeanderror.messageoff a string, so it returned a command error with no code and no message.Now:
forbidden_roleis a definitive failure. The audit prints "⚠ Run not tracked in your dashboard: Your role (viewer) in this organization does not include audits:write". Other bare-string errors, such as a 429 rate limit, still stay quiet.forbidden_rolereturns the command errorforbidden_rolewith the server's reason, plus "Ask an owner or admin for a role that runs audits, or run with --no-publish to keep the report local". Any other bare-string error returnsAPI_ERRORnaming the status and the error.Tests:
tests/lib/run-tracker.test.ts: a new case for the bareforbidden_rolewarning. The existing 429-stays-quiet case still passes.tests/controllers/publish-role-refusal.test.ts: new, covering the role refusal and another bare-string error.format:checkand oxlint pass forapps/cli.Docs:
docs/cli/audit.mdx, under "Publishing to the dashboard", now says which roles publish and what a viewer or billing member sees;bun x [email protected] check --strictpasses. CHANGELOG has an Unreleased "Fixed" entry. Skill: no change; the agent skill's role-error guidance is tracked in repo#3378.