Skip to main content

PKI Compliance Gate (CertGuard Engine)

Python Tests License Release

PKI Compliance Gate (CertGuard Engine) is a Policy-as-Code engine for X.509 certificates, CA/Browser Forum Baseline Requirements, and API TLS posture checks.

One YAML policy profile is the source of truth for evaluation, CI gating, and generated CP/CPS Section 7 documentation.


Quick Start

Option 1: GitHub Action in CI/CD

Use the immutable v0.1.3 release tag (there is no moving v1 tag yet). The GitHub Marketplace listing tracks this Action.

steps:
  - uses: actions/checkout@v4
  - name: Run PKI Compliance Gate
    uses: thulisa-n/pki-compliance-gate@v0.1.3
    with:
      cert: 'tests/certificates/valid_cert.pem'

Option 2: Install from PyPI

python3 -m pip install "pki-compliance-gate==0.1.3"
pki-gate --cert path/to/server.crt

Option 3: Run from a clone

python3 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

# Evaluate a certificate
pki-gate --cert tests/certificates/valid_cert.pem

# Export CP/CPS Section 7 documentation from the policy YAML
pki-gate --mode export-cps-doc --policy policies/cabf_policy.yaml --summary-output CPS_SECTION_7.md

What this repo actually enforces

  • Baseline policy (policies/cabf_policy.yaml): max validity 200 days, RSA >= 2048, no SHA-1/MD5, SAN required, blocked internal suffixes (.local, .internal, .intranet).
  • Optional crypto-transition overlay (crypto_transition.*, disabled by default): target max validity 47 days and RSA >= 3072 when you opt in.
  • API TLS posture (--mode apisec --endpoint example.com): live TLS version, weak-cipher, expiry, and certificate checks.
  • Keyless provenance in this repository's CI: on push to main, reports/release_provenance.json is signed with cosign. GitHub native attestations are published only on public repositories.
  • Exit codes from evaluation:
    • 0: no failing checks (and lint not failed)
    • 1: only low-severity check failures
    • 2: medium/high failures, lint failure, or CLI usage/input errors
    • 3: at least one critical check failure

How it flows

flowchart LR
    A[PEM Certificate / Domain] --> B[X509 and TLS Parser]
    B --> C[Policy Validator Engine]
    C --> D[Compliance Report]
    C --> E[CP/CPS Docs Exporter]
    C --> F[Audit Evidence]
    D --> G[CI Exit Code 0..3]

Execution modes

Mode Example What the code does
evaluate pki-gate --cert server.crt Full policy evaluation of a certificate file.
export-cps-doc pki-gate --mode export-cps-doc Renders the YAML policy as CP/CPS Section 7 Markdown.
apisec pki-gate --mode apisec --endpoint example.com Scans a live endpoint for TLS posture.
triage pki-gate --mode triage --report-input report.json Turns report findings into severity-ranked next actions.
assure pki-gate --mode assure --report-input report.json Independently recomputes whether the report's compliant flag matches checks and lint.
watch pki-gate --mode watch Diffs the loaded policy against policies/standards_baseline.yaml.
heal pki-gate --mode heal --healed-cert new_cert.pem Writes a remediation plan; re-evaluates only if --healed-cert is provided.
summary pki-gate --mode summary --report-input report.json Writes a reviewer Markdown summary.
trend pki-gate --mode trend --report-input report.json Writes a trend snapshot JSON.
signals pki-gate --mode signals Reads curated external signals JSON and writes recommendations.

Repository structure

src/certguard/          Core agents, CLI, bundled policy, and engine
src/certguard/policy_exporter.py  CP/CPS exporter
src/main.py             Backward-compatible repository entrypoint
policies/               Policy YAML profiles and Rego rules
tests/                  Automated test suite
action.yml              Composite GitHub Action
.github/workflows/      CI workflows

Distribution status

The GitHub Action, wheel, and sdist are published from the v0.1.3 tag. Install the CLI with pip install pki-compliance-gate==0.1.3. Later GitHub releases reuse .github/workflows/publish.yml with PyPI trusted publishing (OIDC, no API token in the repository).


License

Licensed under the MIT License.

Release files for pki-compliance-gate 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pki-compliance-gate 0.1.3
File Size Uploaded
pki_compliance_gate-0.1.3.tar.gz 35.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pki-compliance-gate 0.1.3
File Interpreter ABI Platform
pki_compliance_gate-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 78.6 kB

Release files / pki_compliance_gate-0.1.3.tar.gz

Download URL pki_compliance_gate-0.1.3.tar.gz
Size 35.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cdba65776f77631813ab14f6f2f51c00e806199d25ce23c7985962fd55702fd2
BLAKE2b-256 checksum
How to use checksums
d45ab06ee1f5f11f5ba50971f95bc3de3765fa6c6160f140f6bc8c71dba8dbc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release files / pki_compliance_gate-0.1.3-py3-none-any.whl

Download URL pki_compliance_gate-0.1.3-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7884b3e7a2f3d3107e7821cde4fa14c9b1b37e83b66c130306914362e2daac16
BLAKE2b-256 checksum
How to use checksums
c1f9cab3aa7525d826c26357c245329e712ab8cc500e39aef2a4466db1b41701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page