Repository navigation
fix: prevent scan stalls and restore all bundle formats - #233
Conversation
Reject unrelated inputs before the PKCS#7 BER parser can consume excessive CPU. Keep the current scan file or phase visible during slow work and clear progress before warnings. Restore all 12 managed export formats by default while preserving explicit subsets, so CSR and YAML artifacts are no longer omitted. Add regression coverage and update the CLI help and documentation.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
The PKCS#7 guard still permits attacker-controlled recursive BER parsing, alongside several mandatory convention violations.
4 open findings
What changed in this PR
Prevents scan stalls, improves terminal progress, and restores all managed bundle formats.
Changes:
- Prevalidates PKCS#7 envelopes and adds regressions.
- Adds live scan activity and elapsed-time progress.
- Defaults managed exports to all 12 formats.
| File | Description |
|---|---|
README.md |
Documents default formats. |
EXAMPLES.md |
Updates export examples. |
CHANGELOG.md |
Records user-facing fixes. |
.claude/docs/architecture.md |
Updates architecture notes. |
pkcs.go |
Adds PKCS#7 envelope precheck. |
pkcs_test.go |
Tests DER, BER, and malformed inputs. |
internal/certstore/export_formats.go |
Restores all default formats. |
cmd/certkit/scan.go |
Integrates scan progress. |
cmd/certkit/scan_progress.go |
Implements terminal progress. |
cmd/certkit/scan_progress_test.go |
Tests progress behavior. |
cmd/certkit/scan_feedback_test.go |
Tests JSON scan regression. |
cmd/certkit/scan_export.go |
Updates formats help. |
cmd/certkit/scan_export_test.go |
Verifies format artifacts. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: afad16e30a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Accepted PKCS7 identifiers still allowed malformed nested BER values into an unbounded recursive decoder. Validate and normalize the full structure iteratively, bound nesting, and retain definite and indefinite BER support. Keep default exports usable with CN-derived names. Preserve progress cleanup errors and refresh progress through managed bundle operations.



Description
Directory scans could stall when unrelated JSON or malformed PKCS#7 input reached the recursive BER decoder. Validate the complete BER structure, enforce child boundaries, and limit nesting to 32 constructed values. Normalize BER lengths before upstream parsing. Valid definite- and indefinite-length BER bundles remain supported.
Terminal progress now shows the active file or phase and elapsed time through scanning, managed planning, writes, and trust checks. Warnings stay separate from progress. Cleanup failures retain the original scan error.
Managed exports select all 12 formats by default, including CSR, CSR JSON, YAML, and Kubernetes YAML. Explicit
--formatsselections still limit output. CN-derived bundle directories keep their names; invalid derived Secret names get a valid label with a stable hash suffix, reported in the plan. Explicit bundle names remain unchanged. Update the help and documentation.Test Plan
Checklist
CHANGELOG.mdupdated (if user-facing change)