Repository navigation
fix: Explain refused org-wide listing and reject org/project names - #360
Merged
Merged
Conversation
The authorizer refuses to list a namespaced resource across all namespaces at organization scope, for every role: an organization's resources live in one namespace, and project resources live in each project's own control plane. The get help still recommended that form, and the refusal printed a bare Forbidden with no next step. The hint is attached only when the server actually returns Forbidden, so datumctl does not duplicate the server's rule and will not block the form if the server ever allows it. Key changes: - Show listing across every namespace in a project in the get example - After a Forbidden for get -A at organization scope, print a hint naming the project form and how to find project names - Carry the hint in the JSON and YAML error envelopes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'datumctl ctx list' prints project contexts as org/project, and that form passed to --project or DATUM_PROJECT went straight into the control plane URL, failing with discovery errors that did not name the cause. Project names cannot contain "/", so the value is now refused up front with a hint that names the bare project. Refusing is preferred over splitting the value: the project control plane URL carries no organization, so a split would silently ignore a wrong organization. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xmc
enabled auto-merge
November 6, 2026 19:16
ecv
approved these changes
Nov 6, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
The project-name check can only reject strings containing "/", which no valid project name has (names are Kubernetes object names), and it never rewrites or redirects scope: a rejected name stops before any request is sent. The new hint output is additive.
- Validation runs only for
--projectandDATUM_PROJECT; a project taken from the active context is not checked, so theorg/projectstrings thatctx listprints cannot be mistaken for context-sourced values. The hint's suggested--project webmatches the segment the user typed. main.goandroot.gotouch every command's fatal path only throughFatalHint, which returns "" unless agetcommand at organization scope with-Arecorded a hint. For JSON/YAML output,NewUserErrorWithHint(clean, "")renders the same envelope as the old plain error (empty code and hint, same message), so existing consumers see no change for other errors.- The
get -Ahint is attached to any(Forbidden)fatal, not only the cross-namespace refusal. A genuine RBAC denial at organization scope with-Awould also be told the list is "not allowed at organization scope", whatever the caller's role.
Follow-ups:
- Match the refusal's text (the tests already use "cross-namespace queries not allowed for organization-scoped requests") in
FatalHintso an ordinary RBAC Forbidden gets no hint. - The title says it rejects org names as well, but only
--projectis validated;--organization acme/webstill goes through unchecked. getFatalHintis a package-level variable set byWrapGetCommand. That is fine for a one-shot CLI, but a test or embedder running twogetcommands in one process will see stale state.
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.
Summary
Listing a resource across all namespaces at organization scope is refused for every role, yet the get help recommended it and the refusal gave no next step.
The help example now lists across a project, and a refused org-wide listing prints a hint naming the project form and how to find project names.
Passing the org/project form that context listing prints as a project name now fails up front with a hint naming the bare project, instead of failing on discovery errors.
Test plan
Fixes #357
🤖 Generated with Claude Code