[Bug]: can't remove or replace invalid x509 template

Open
#2,449 8 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@hslatman is already working on this.

Since Nov 11, 2025.

Assessment

This issue has not been assessed yet.

Description

bug needs triage
Steps to Reproduce
  1. Import this template with step ca provisioner update SSO --x509-template template.tpl
{
      "subject": {{ toJson .Subject }},
      "sans": {{ toJson .SANs }}
{{- if .Token.groups }}
      {{- range .Token.groups }}
      , {{ "urn:group:{{ . }}" | toJson }}
      {{- end }}
{{- end }},
{{- if typeIs "*rsa.PublicKey" .Insecure.CR.PublicKey }}
      "keyUsage": ["keyEncipherment", "digitalSignature"],
{{- else }}
      "keyUsage": ["digitalSignature"],
{{- end }}
      "extKeyUsage": ["serverAuth", "clientAuth"]
}
  1. try to get a new certificate with step ca certificate "[email protected]" cert.pem key.pem --san "[email protected]"
  2. error:
✔ Provisioner: SSO (OIDC) [client: ***********]
Your default web browser has been opened to visit:

https://login.microsoftonline.com/******

✔ CA: https://ca.example.org
error applying certificate template
  1. try to remove it with step ca provisioner update SSO --x509-template "", error:
❯ step ca provisioner update SSO --x509-template ""                               
No admin credentials found. You must login to execute admin commands.
✔ Provisioner: SSO (OIDC) [client: ******]
Your default web browser has been opened to visit:

https://login.microsoftonline.com/*******

error applying certificate template
Your Environment
  • OS - Docker
  • step-ca Version -
    Smallstep CA/0.28.3 (linux/arm64)
    Release Date: 2025-03-18 15:56 UTC
Expected Behavior
  • server complains about wrong template before saving it
  • server allows to remove invalid template
Actual Behavior

See errors above

Additional Context

in server's logs I see

time="2025-10-28T17:09:13Z" level=error duration=5.391514ms duration-ns=5391514 error="error applying certificate template: invalid character ',' after object key at offset 319" fields.time="2025-10-28T17:09:13Z" method=POST name=ca ott=*******
Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Dominant language
Go
Stars
8.9k
Forks
599
Avg merge
21h 20m
Merged PRs (30d)
15

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from smallstep/certificates

All issues in smallstep/certificates

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.