Repository navigation
fix(cli): accept hyphen-leading --subject values in workspace member add/remove - #4911
Closed
viwe-monai wants to merge 1 commit into
Closed
viwe-monai wants to merge 1 commit into
viwe-monai wants to merge 1 commit into
Conversation
…add/remove
OIDC subjects are opaque strings and can start with '-', but the
workspace member add/remove --subject flags were plain #[arg(long)], so
the remediation hint the gateway prints on a permission denial
openshell workspace member add --workspace '<ws>' --subject '<subject>' --role user
failed to copy-paste for such principals: clap parsed the quoted value
as flags ('error: unexpected argument -o found').
Mark both --subject arguments allow_hyphen_values so the hint works
verbatim, and cover both sides: a CLI parsing test for add/remove with a
hyphen-leading subject, and a gateway hint test asserting the quoted
--subject '-...' form is emitted intact.
|
Thank you for your interest in contributing to OpenShell, @viwe-monai. This project uses a vouch system for first-time contributors. Before submitting a pull request, you need to be vouched by a maintainer. To get vouched:
See CONTRIBUTING.md for details. |
|
Thank you for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text: I have read the DCO document and I hereby sign the DCO. You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot. |
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.
Fixes #4889
Problem
OIDC subjects are opaque strings and can start with
-, butworkspace member add/remove --subjectis a plain#[arg(long)], so the remediation hint the gateway prints on a permission denial cannot be copied verbatim for such principals:Fix
--subjectarguments (workspace member addandworkspace member remove)allow_hyphen_values = true, so the quoted hint form parses as one value. The server-side hint already shell-quotes the subject (covered by the existingnon_member_remediation_shell_quotes_untrusted_subjecttest), so with the CLI fixed the printed command now works as printed.allow_hyphen_valuesroute; the hint keeps its current shape (no server-side change needed).Tests
openshell-cli:workspace_member_parses_hyphen_leading_subject— parses--subject -oAbC123on bothaddandremoveand keeps the value intact. (Previously:error: unexpected argument '-o' found.)openshell-server:non_member_remediation_handles_hyphen_leading_subject— the deny hint for a hyphen-leading subject keeps--subject '-oAbC123'quoted and intact for copy-paste.cargo fmtclean for the touched crates.