Skip to content

fix: reject CA startup when commonName collides with issuer certificate CN#2621

Open
FlorianGross wants to merge 1 commit intosmallstep:masterfrom
FlorianGross:master
Open

fix: reject CA startup when commonName collides with issuer certificate CN#2621
FlorianGross wants to merge 1 commit intosmallstep:masterfrom
FlorianGross:master

Conversation

@FlorianGross
Copy link
Copy Markdown

Name of feature:

Startup validation: reject configuration when commonName or authority.template.commonName collides with the issuing CA certificate's CommonName

Pain or issue this feature alleviates:

When config.commonName or authority.template.commonName in ca.json is set to the same value as the intermediate CA certificate's CommonName, all affected certificates will have Subject == Issuer. TLS stacks and certificate validators interpret this as a self-signed certificate, causing handshake failures and trust errors — even though the certificate chain is technically correct. The root cause is difficult to diagnose because the error appears on the client side (e.g. PowerShell: "Could not establish trust relationship for the SSL/TLS secure channel") and nothing in the CA log indicates a misconfiguration.

Why is this important to the project:

The misconfiguration is easy to make (especially when setting up step-ca manually without step ca init) and produces a silent, hard-to-diagnose failure. A clear startup error pointing directly to the problematic field saves significant debugging time.

Is there documentation on how to use this feature? If so, where?

No documentation needed — the feature is a startup guard that emits a self-explanatory error message and exits. The error message itself contains the corrective action:

"use a distinct name or leave commonName empty to use the default"
"use a distinct name or remove authority.template.commonName"
In what environments or workflows is this feature supported?
All SoftCAS deployments (default step ca init setup). Validation runs during authority.init() after the intermediate certificate chain is loaded.

In what environments or workflows is this feature explicitly NOT supported (if any)?

External CAS deployments (CloudCAS, StepCAS/RA mode) — in those cases the intermediate certificate is not loaded locally, so the check is skipped.

The PR and the commit was created using Claude AI.

…suing

CA certificate's CommonName, any certificate signed by that CA will have
Subject == Issuer and be treated as self-signed by TLS stacks and validators,
causing handshake failures and trust errors.

Added validateCommonNames() which is called during authority initialization
(SoftCAS path) after the intermediate certificate chain is loaded. It returns
a clear error message pointing to the misconfiguration, covering both the
top-level commonName field (used for the CA's own TLS cert) and the
authority.template.commonName field (used as the default subject CN for
issued leaf certificates).
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Mar 27, 2026
@hslatman hslatman self-assigned this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs triage Waiting for discussion / prioritization by team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants