Skip to content

Parse SCT and CRL Distribution Points extensions - #20

Merged
hewigovens merged 6 commits into
mainfrom
feature/parse-sct-crl-extensions
Mar 20, 2026
Merged

Parse SCT and CRL Distribution Points extensions#20
hewigovens merged 6 commits into
mainfrom
feature/parse-sct-crl-extensions

Conversation

@hewigovens

Copy link
Copy Markdown
Owner

Summary

  • Parse SCT extension (OID 1.3.6.1.4.1.11129.2.4.2) from raw hex into structured fields: log name, timestamp, signature algorithm, and signature (RFC 6962)
  • Parse CRL Distribution Points (OID 2.5.29.31) from raw hex into distribution point URIs
  • Include a known CT logs lookup table (38 logs from Google, Cloudflare, DigiCert, Sectigo, Let's Encrypt) sourced from Google's official log list
  • Add scripts/update_ct_logs.py to regenerate the lookup table from https://www.gstatic.com/ct/log_list/v3/log_list.json
  • Split CustomExtensionDecoders into focused files: SCTDecoder, CRLDistributionPointsDecoder, CertificatePoliciesDecoder
  • New detail view sections: "Certificate Transparency" and "CRL Distribution Points"

Closes #19

Test plan

  • Existing 104 tests pass
  • New test assertions for SCT parsing (log, timestamp, algorithm, signature fields)
  • New test assertions for CRL DP parsing (multiple URIs)
  • macOS app builds successfully
  • python3 scripts/update_ct_logs.py regenerates KnownCTLogs.swift from upstream

Instead of showing raw hex for OID 1.3.6.1.4.1.11129.2.4.2 (SCT) and
2.5.29.31 (CRL DP), parse them into human-readable data:

- SCT: log name (via known-logs lookup), timestamp, algorithm, signature
- CRL DP: distribution point URIs extracted from DER tree

Split CustomExtensionDecoders into focused per-domain files
(SCTDecoder, CRLDistributionPointsDecoder, CertificatePoliciesDecoder).

Add scripts/update_ct_logs.py to regenerate the known CT logs table
from Google's official log list.

Closes #19
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the certificate inspection capabilities by introducing robust parsing for Signed Certificate Timestamps (SCTs) and CRL Distribution Points. It provides a more detailed and structured view of these critical certificate extensions, improving the clarity and depth of information available to users. The changes also include a refactoring of extension decoders for better organization and maintainability, alongside an automated mechanism to keep the Certificate Transparency log list up-to-date.

Highlights

  • SCT Extension Parsing: Implemented parsing for the SCT extension (OID 1.3.6.1.4.1.11129.2.4.2) from raw hex into structured fields: log name, timestamp, signature algorithm, and signature, adhering to RFC 6962.
  • CRL Distribution Points Parsing: Implemented parsing for CRL Distribution Points (OID 2.5.29.31) from raw hex into distribution point URIs.
  • Known CT Logs Lookup Table: Included a lookup table for 38 known Certificate Transparency logs from Google, Cloudflare, DigiCert, Sectigo, and Let's Encrypt, sourced from Google's official log list.
  • CT Logs Update Script: Added a Python script (scripts/update_ct_logs.py) to automatically regenerate the KnownCTLogs.swift lookup table from the upstream Google log list.
  • Extension Decoder Refactoring: Refactored CustomExtensionDecoders into more focused, dedicated files: SCTDecoder, CRLDistributionPointsDecoder, and CertificatePoliciesDecoder.
  • New Detail View Sections: Introduced new sections in the certificate detail view for 'Certificate Transparency' and 'CRL Distribution Points' to display the parsed information.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces parsing for two important certificate extensions: Signed Certificate Timestamps (SCT) for Certificate Transparency and CRL Distribution Points. The changes are well-structured, with new decoders in separate files, a lookup table for known CT logs, and a script to keep it updated. The UI is also updated to display this new information.

My review focuses on a few areas for improvement:

  • There's an opportunity to significantly simplify the CRLDistributionPointsDecoder by using the parsing capabilities already present in the swift-x509 dependency, which would make the code more robust and easier to maintain.
  • A minor performance optimization in SCTDecoder to avoid re-creating a date formatter in a loop.
  • A consistency fix in CertificatePoliciesDecoder to add an OID check, aligning it with the other new decoders.

Overall, this is a great addition that provides valuable information about certificates.

Comment thread Packages/InspectCore/Sources/Core/SCTDecoder.swift
Comment thread Packages/InspectCore/Sources/Core/CertificatePoliciesDecoder.swift Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6f9568fc4

ℹ️ 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".

Comment thread Packages/InspectCore/Sources/Core/CertificateModels.swift
Comment thread scripts/update_ct_logs.py
Comment on lines +21 to +24
for op in data.get("operators", []):
op_name = op["name"]
for log in op.get("logs", []):
log_id_b64 = log["log_id"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include historical CT logs in the generated lookup table

This generator now builds KnownCTLogs solely from the current entries in Google's log_list.json, and the committed table therefore starts at 2026-era logs. SCTDecoder uses that table for every live certificate, so certificates issued in late 2025 that are still valid on 2026-03-20 will render their SCTs as Unknown (...) even though those log IDs are well-known. To keep real-world chains readable, the generated map needs an archive/historical source instead of only today's active list.

Useful? React with 👍 / 👎.

- Add custom Decodable init to CertificateDetails so persisted data
  from older builds without sctList/crlDistributionPoints still decodes
  (defaults to empty arrays)
- Hoist ISO8601DateFormatter out of the SCT parsing loop
- Add OID guard to CertificatePoliciesDecoder for consistency
…s from raw list

- Use inspectDisplayString (e.g. "Nov 12, 2025, 4:13:59 AM") instead of
  ISO 8601 for SCT timestamps
- Filter SCT and CRL DP from the generic Extensions section since they
  already have dedicated display sections
- Move ByteReader to its own file as a public struct with readUInt24
  and skip methods for broader reuse across TLS parsing code
- Remove superficial comments from test builders
- Create Certificate.Extension mock factory methods (mockSCTList,
  mockCRLDistributionPoints, mockCertificatePolicies) in shared
  CertificateExtensionFixtures helper
- Move certificate tests into Certificate/ subdirectory
- Move TLS tests into TLS/ subdirectory
- Move shared helpers into Helpers/ subdirectory
- Remove duplicate URL normalizer tests from CertificateParserTests
@hewigovens
hewigovens merged commit 704aa42 into main Mar 20, 2026
1 check passed
@hewigovens
hewigovens deleted the feature/parse-sct-crl-extensions branch March 29, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse Certificate Transparency (SCT) extension data

1 participant