step ca sign rejects CSRs for GitLab CI OIDC tokens: the token is classified as a JWK token because of its sha claim
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 65/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ệ
- go
- Lĩnh vực
- authentication, cli, security
Hướng nghiên cứu
Start with token/parse.go and command/ca/sign.go, the two files named in the issue, and trace how Payload.Type() classifies tokens and how signing applies the CN check. Reproduce with a GitLab CI OIDC token containing a sha claim and a CSR whose common name differs from the token subject. Done when the CLI accepts the CSR for server-side validation while preserving the intended check for step-issued JWK tokens.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version: step CLI, current master (token/parse.go, command/ca/sign.go). I didn't reproduce this on a release build, but I saw the same error in CI.
What happens
Signing a CSR with an ID token minted by GitLab CI (id_tokens:) fails when the CSR's common name differs from the token's sub:
token subject 'project_path:group/project:ref_protected:true' and CSR CommonName 'my-service' do not match
The CA is an OIDC provisioner, and the CA itself doesn't enforce this. Its OIDC AuthorizeSign attaches no CN-vs-token comparison, and the certificate template sets the subject. The error comes from command/ca/sign.go, which skips the CN check only when jwt.Payload.Type() is OIDC, AWS, GCP, Azure or K8sSA. It does so because, in its words, the CN "will be validated on the server side, it depends on server configuration."
Why
Payload.Type() in token/parse.go checks for JWK before OIDC:
case p.SHA != "" || len(p.SANs) > 0:
return JWK
case len(p.Audience) > 0 && p.Issuer != "" && p.Subject != "" && ...:
return OIDC
GitLab CI ID tokens always include a sha claim, the commit SHA (GitLab docs). In step's own JWK tokens, sha is the CSR fingerprint. A GitLab token is therefore classified as JWK and gets the JWK CN check, even though it is an OIDC token from another issuer.
Expected
A token from an OIDC issuer is treated as OIDC and step ca sign leaves the CN validation to the server.
Actual
The CLI rejects the CSR before sending it. Calling POST /1.0/sign directly with the same token and CSR, with a different CN, is accepted by the CA.
Repro
- Configure an OIDC provisioner trusting https://gitlab.example.com and a GitLab job with id_tokens: { TOKEN: { aud: } }.
- Create a CSR with step certificate create my-service svc.csr svc.key --csr.
- Run step ca sign svc.csr svc.crt --token "$TOKEN" in the job.
- You get the error above.
Possible fixes
- Don't treat sha as a JWK marker on its own. For example, also require the issuer or the step-cli conventions that step-issued tokens have.
- Or, in sign.go, skip the client-side CN comparison unless the token is a step-issued JWK token.
Happy to send a PR if you want one of these.
- Ngôn ngữ chính
- Go
- Star
- 4.3k
- Fork
- 320
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của smallstep/cli
-
[Bug]: `Match exec "step ssh check-host %h"` causes SSH connections through ProxyJump to hangĐang mởbug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 57/100
smallstep/cli#1713 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
build s390x and riscv64 binariesĐang mởenhancement needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
smallstep/cli#1710 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: `step ca provisioner add --ca-config` requires `--ca-url`/`--root` even for purely local/offline editsCó thể đã có người làm @vulragrag-star đã nhận 72 ngày trước. Đang mởbug needs triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
smallstep/cli#1705 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của smallstep/cli
Issue tương tự
-
bug(terraform): a `kubernetes_manifest` the scan can't fully read is dropped and nothing says soĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
OneBusAway/watchdog#455 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rootsiemen/loophole#97 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug needs triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
smallstep/certificates#2863 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
SocialGouv/iterion#3889 ·
Maintainer thường phản hồi trong vòng 1 ngày