Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjects

Đang mở Phù hợp với người mới
#4,889 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #4911 của @viwe-monai — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu tại crates/openshell-cli/src/main.rs, ở các đối số subject của workspace member add và workspace member remove, rồi đọc crates/openshell-server/src/auth/workspace_authz.rs, nơi gợi ý khắc phục được tạo bằng shell_quote_for_hint. Kiểm tra các bài kiểm thử hiện có về phân tích đối số CLI và tạo gợi ý. Công việc hoàn tất khi cả hai lệnh chấp nhận subject bắt đầu bằng dấu gạch nối, gợi ý được sao chép chạy thành công và có bài kiểm thử bao quát cả hai hành vi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

User Story

I use OpenShell with OIDC sign-in and workspaces. When a workspace denied me, I copied the suggested openshell workspace member add command from the error and it failed, because my OIDC subject starts with -. I need the suggested command to work as printed, so a user can grant access without working out clap's argument parsing.

Problem Statement

When a principal lacks workspace access, the gateway's permission-denied message suggests a remediation command (crates/openshell-server/src/auth/workspace_authz.rs, built with shell_quote_for_hint):

openshell workspace member add --workspace '<ws>' --subject '<subject>' --role user

The subject is shell-quoted, but quoting doesn't stop clap from parsing it. OIDC subjects are opaque strings and can start with -. When one does, --subject '-oAbC…' fails with error: unexpected argument '-o' found, because --subject in crates/openshell-cli/src/main.rs (workspace member add and workspace member remove) is a plain #[arg(long)] that doesn't accept hyphen-leading values.

Impact / Why This Matters

  • The copy-paste remediation fails for any user whose subject starts with -, and clap's error points at a flag that doesn't exist, not at the cause.
  • The workaround, --subject=-oAbC…, isn't obvious and isn't mentioned anywhere.

Acceptance Criteria

  • openshell workspace member add --subject '<value starting with ->' … and workspace member remove accept the subject (for example via allow_hyphen_values), or the hint emits --subject=<quoted>.
  • The remediation hint, copied verbatim, succeeds for a subject that starts with -.
  • A test covers a hyphen-leading subject in both the hint and the CLI parsing.

Reproduction Steps

  1. Sign in to an OIDC-enabled gateway as a user whose sub claim starts with -.
  2. Run any command against a workspace you aren't a member of, and copy the suggested openshell workspace member add … --subject '-…' --role user command.
  3. As a workspace admin, run the copied command.
  4. Observe error: unexpected argument '-o' found.

Environment

  • OpenShell: CLI 0.1.5-dev.124+g92434dcb2; gateway 0.1.6-dev.26+g229382e51
  • OS: macOS (arm64)
  • Runtime, deployment, or integration: OIDC authentication with workspaces

Suggested UX (if applicable)

openshell workspace member add --workspace 'my-ws' --subject='-oAbC123…' --role user

Logs

error: unexpected argument '-o' found
Ngôn ngữ chính
Rust
Star
17.1k
Fork
1.8k
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
329

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA/OpenShell

Tất cả issue của NVIDIA/OpenShell

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.