step ca sign rejects CSRs for GitLab CI OIDC tokens: the token is classified as a JWK token because of its sha claim
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 65/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- go
- Domaine
- authentication, cli, security
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Go
- Étoiles
- 4.3k
- Forks
- 320
- Merge moyen
- 1 j 21 h
- PR mergées (30 j)
- 10
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de smallstep/cli
-
[Bug]: `Match exec "step ssh check-host %h"` causes SSH connections through ProxyJump to hangOuvertebug needs triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement needs triage
Difficulté 4/5 3-5 jours Accessibilité débutants 32/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement needs triage
Difficulté 3/5 1-2 jours Accessibilité débutants 57/100
smallstep/cli#1713 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
build s390x and riscv64 binariesOuverteenhancement needs triage
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
smallstep/cli#1710 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
[Bug]: `step ca provisioner add --ca-config` requires `--ca-url`/`--root` even for purely local/offline editsPeut-être pris @vulragrag-star l’a pris il y a 72 jours. Ouvertebug needs triage
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
smallstep/cli#1705 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de smallstep/cli
Issues similaires
-
bug(terraform): a `kubernetes_manifest` the scan can't fully read is dropped and nothing says soOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
OneBusAway/watchdog#455 ·
Les mainteneurs répondent en général sous 1 jour
-
help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
rootsiemen/loophole#97 ·
Les mainteneurs répondent en général sous 1 jour
-
bug needs triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 84/100
smallstep/certificates#2863 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
SocialGouv/iterion#3889 ·
Les mainteneurs répondent en général sous 1 jour