Skip to content

mk-ca-bundle.pl: add -x option to exclude specific CA roots - #23508

Closed
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:mk-bundle-exclude-option
Closed

vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:mk-bundle-exclude-option

Conversation

@vszakats

@vszakats vszakats commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Examples:

./mk-ca-bundle.pl -x <sha256>
./mk-ca-bundle.pl -x <sha256-1>,<sha256-2>

Where sha256* are stripped from whitespace, colons (:) and matched
case-insentively with CA root fingerprints in the source bundle.

Note: delete any existing certdata.txt to force a rebuild when -x
option is added/modified/removed and a re-generation is necessary as a
result.


  • on the fence with regeneration behavior. We do want to regen if -x is passed first,
    but not after, unless the source changed again.
    With forced regen, a new bundle may be created in an automated scenario,
    which is undesried.
    → adding/updating -x in a scheduled regen script also needs to manually clear
    the previous source certdata.txt to trigger a regen and apply -x exclusions.

Examples:
```sh
..mk-ca-bundle.pl -x <sha256>
..mk-ca-bundle.pl -x <sha256-1>,<sha256-2>
```

Where `sha256` is stripped from whitespace, colons (:) and matched
case-insentively with CA root fingerprints in the source bundle.
This reverts commit 75e32e7.

It can cause more problems than it solves, by regenerating
unconditionally while `-x is passed. It's perhaps better to
force a regen manually when `-x` is added/changed/removed,
or not force a regen once its removal is a no-op (because
upstream removed the excluded roots.)
@bagder
bagder requested a balanced review from Copilot October 20, 2026 11:10
@bagder

bagder commented Oct 20, 2026

Copy link
Copy Markdown
Member

I think deleting the old first is fine

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Omitting -x produces an uninitialized-value warning, including in quiet mode.

1 open issue
What changed in this PR

Adds optional SHA-256 fingerprint exclusions to curl’s CA bundle generator.

Changes:

  • Adds -x for comma-separated fingerprints, ignoring case, whitespace, and colons.
  • Skips matching roots and reports exclusions.
  • Updates command help and the script version.
File Description
scripts/​mk-ca-bundle.pl Parses fingerprint exclusions and filters matching CA roots.

Review effort: Balanced

Comment thread scripts/mk-ca-bundle.pl Resolved
@vszakats

Copy link
Copy Markdown
Member Author

@vszakats
vszakats requested a lite review from Copilot October 20, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Document -x and include exclusions in regeneration invalidation.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Document the new -x exclusion option in the manual and synopsis

scripts/​mk-ca-bundle.pl:191

This adds a public command-line option, but the user-facing mk-ca-bundle manual does not document -x (and the script's usage synopsis at line 165 is also unchanged). Users invoking the installed/documented tool will not learn how to supply the exclusion fingerprints or the regeneration caveat; please update the generated documentation and synopsis alongside the help text.

Medium severity Include exclusions in regeneration detection to refresh changed bundles

scripts/​mk-ca-bundle.pl:309

The exclusion list is not part of the regeneration decision: oldhash is compared with the downloaded source hash before this processing block, so adding, changing, or removing -x after a bundle has been generated exits without applying the new list. Deleting certdata.txt does not fix this—the file is downloaded again and has the same hash—so the regeneration procedure in the PR description cannot produce the requested bundle. Please include the normalized exclusions in the cache key/header or otherwise explicitly invalidate the existing output when this option changes.

Review effort: Lite

vszakats added a commit to curl/curl-for-win that referenced this pull request Oct 20, 2026
@vszakats

Copy link
Copy Markdown
Member Author

Document the new -x exclusion option in the manual and synopsis

Pushed a fix.

The exclusion list is not part of the regeneration decision: oldhash is compared with the downloaded source hash before this processing block, so adding, changing, or removing -x after a bundle has been generated exits without applying the new list. Deleting certdata.txt does not fix this—the file is downloaded again and has the same hash—so the regeneration procedure in the PR description cannot produce the requested bundle. Please include the normalized exclusions in the cache key/header or otherwise explicitly invalidate the existing output when this option changes.

I'm aware, and decided against doing this as overkill.

@vszakats vszakats closed this in 2637791 Oct 20, 2026
@vszakats
vszakats deleted the mk-bundle-exclude-option branch October 20, 2026 12:55
vszakats added a commit to curl/curl-for-win that referenced this pull request Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants