crl_override (and extensions) in /api/v1/sign request body are silently ignored by the HTTP API
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in api/signhandler/signhandler.go seguendo jsonSignRequest attraverso jsonReqToTrue(), quindi confronta il percorso HTTP con signer/local/local.go. Riproduci la richiesta usando il comando curl fornito e ispeziona il certificato con openssl. Il lavoro è completo quando crl_override ed extensions vengono preservati attraverso entrambi i percorsi di firma dell’API e il certificato risultante mostra l’estensione richiesta.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Version: 1.6.5 (also present on master as of this writing) · Go 1.20.14
Summary
signer.SignRequest defines a CRLOverride field (JSON tag crl_override) that the local signer honors to set a per-request CRL Distribution Point. However, when signing through the HTTP /api/v1/sign (and /api/v1/authsign) API, the field is silently dropped. The issued certificate contains no CRL Distribution Points extension (2.5.29.31), and no error or warning is returned. The same applies to the extensions field.
Expected behavior
Posting crl_override to /api/v1/sign embeds a CRLDistributionPoints (2.5.29.31) extension in the issued certificate, matching the behavior of the local signer library and the documented SignRequest schema.
Actual behavior
The request succeeds, but the returned certificate has no 2.5.29.31 extension. crl_override is accepted (no validation error) yet has no effect.
Root cause
The HTTP handler does not unmarshal the body into signer.SignRequest. It uses an intermediate jsonSignRequest struct, then jsonReqToTrue() copies only a fixed subset of fields into the real SignRequest. Neither crl_override nor extensions is part of that struct or the copy:
api/signhandler/signhandler.go:
// This type is meant to be unmarshalled from JSON so that there can be a
// hostname field in the API
// TODO: Change the API such that the normal struct can be used.
type jsonSignRequest struct {
Hostname string `json:"hostname"`
Hosts []string `json:"hosts"`
Request string `json:"certificate_request"`
Subject *signer.Subject `json:"subject,omitempty"`
Profile string `json:"profile"`
Label string `json:"label"`
Serial *big.Int `json:"serial,omitempty"`
Bundle bool `json:"bundle"`
}
func jsonReqToTrue(js jsonSignRequest) signer.SignRequest {
// ... never sets CRLOverride or Extensions ...
return signer.SignRequest{
Hosts: js.Hosts,
Subject: sub,
Request: js.Request,
Profile: js.Profile,
Label: js.Label,
Serial: js.Serial,
}
}
By contrast, signer/local/local.go does honor CRLOverride (so it works when CFSSL is used as a Go library), which makes the API behavior surprising:
if req.CRLOverride != "" {
safeTemplate.CRLDistributionPoints = []string{req.CRLOverride}
}
// ... preserved across FillTemplate via save/restore of distPoints ...
The existing TODO: Change the API such that the normal struct can be used. comment acknowledges this divergence.
Steps to reproduce
Run a CFSSL server with any signing profile (no crl_url set in config.json):
cfssl serve -address 0.0.0.0 -port 8888 -ca ca.pem -ca-key ca-key.pem -config config.json
Sign a CSR via the HTTP API with crl_override:
curl -s http://localhost:8888/api/v1/cfssl/sign -d '{
"certificate_request": "'"$(awk 'NF {sub(/\r/,""); printf "%s\\n",$0}' test.csr)"'",
"crl_override": "http://example.com/my.crl"
}' | jq -r '.result.certificate' > out.pem
Inspect the issued certificate:
openssl x509 -in out.pem -noout -text | grep -A2 "CRL Distribution"
# (no output — extension is absent)
Observed: no X509v3 CRL Distribution Points in the certificate.
Expected: the extension present with URI http://example.com/my.crl.
Workaround
Set crl_url in the signing profile (config.json), which FillTemplate applies server-side:
{ "signing": { "default": { "crl_url": "http://example.com/my.crl", "expiry": "8760h", "usages": ["signing","server auth"] } } }
This works but is static per-profile and cannot vary per request.
Suggested fix
Add CRLOverride string \json:"crl_override"(andExtensions) to jsonSignRequestand copy them in both branches ofjsonReqToTrue(), or follow the existing TODO and unmarshal directly into signer.SignRequest. Alternatively, if per-request override is intentionally unsupported over HTTP, document it and return a validation error when these fields are supplied.
- Lingua principale
- Go
- Stelle
- 9.5k
- Fork
- 1.2k
- Merge medio
- 8g 2h
- PR unite (30g)
- 3
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudflare/cfssl
-
gencrl: serial numbers that fail to parse are added to the CRL as 0 or a partial valueForse già presa @sebxt l’ha presa 16 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudflare/cfssl#1460 ·
I maintainer di solito rispondono entro 3 giorni
-
gencrl silently revokes the wrong serial number when a line is not plain decimalForse già presa @RaphaelFakhri l’ha presa 18 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
cloudflare/cfssl#1458 ·
I maintainer di solito rispondono entro 3 giorni
-
config: LoadConfig panics when not_after is before not_beforeForse già presa @sebxt l’ha presa 19 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
cloudflare/cfssl#1456 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
cloudflare/cfssl#1446 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
cloudflare/cfssl#1443 · 4 commenti ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di cloudflare/cfssl
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
openmcp-project/service-provider-crossplane#330 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
openmcp-project/service-provider-kro#220 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
[FEATURE]: Set fieldPath and reason on the CEL validation rulesForse già presa @bjosv l’ha presa oggi. Apertaenhancement needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
valkey-io/valkey-operator#618 ·
I maintainer di solito rispondono entro 3 giorni