mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 13:41:30 +00:00
docs(features): reconcile env-var inventory with config.go (G-3 master)
Closes three 2026-04-24 audit findings (all P2, all category cat-g):
- cat-g-renewal_check_interval_rename_drift: features.md:152
advertised CERTCTL_RENEWAL_CHECK_INTERVAL but config.go renamed
that to CERTCTL_SCHEDULER_RENEWAL_CHECK_INTERVAL. Fixed in prose
+ the scheduler-loops table on line 1117.
- cat-g-b8f8f8796159: 6 env vars in config.go that were never
documented:
CERTCTL_DATABASE_MIGRATIONS_PATH
CERTCTL_JOB_AWAITING_APPROVAL_TIMEOUT
CERTCTL_JOB_AWAITING_CSR_TIMEOUT
CERTCTL_SCHEDULER_AGENT_HEALTH_CHECK_INTERVAL
CERTCTL_SCHEDULER_JOB_PROCESSOR_INTERVAL
CERTCTL_SCHEDULER_NOTIFICATION_PROCESS_INTERVAL
Added to the scheduler-loops table at features.md:1117 and
(DATABASE_MIGRATIONS_PATH) to the new Database Schema preamble.
- cat-g-163dae19bc59: 37 env vars in docs not defined in config.go.
The audit's strict comm over-flagged this set: most "phantoms"
are integration-surface contracts (script env vars certctl
EXPORTS to user-provided ACME DNS-01 / OpenSSL CA scripts;
StepCA / Webhook per-issuer-or-notifier config-blob field
names; CERTCTL_QA_* test fixtures; agent-side env vars defined
in cmd/agent/main.go). The closure narrows the gate to the
one true phantom (the rename) and allowlists the documented
integration contracts in the CI guard. Each allowlist entry
has a one-line justification.
CI regression guardrail:
- .github/workflows/ci.yml::"Forbidden env-var docs drift regression
guard (G-3)" — runs `comm -23` both ways between the env vars
defined in Go source (config.go + cmd/* + ACME DNS export +
test fixtures) and env vars mentioned in README + docs/ +
deploy/helm/. Fails the build if either set is non-empty modulo
the documented integration-surface allowlist.
Verification:
- comm -23 docs vs defined → empty post-fix (allowlist applied)
- comm -23 defined vs docs → empty post-fix
- golangci-lint v2.11.4 run ./... → 0 issues
- tsc --noEmit → clean
- S-1 stale-counts guardrail still passes
Audit findings closed:
- cat-g-163dae19bc59 (P2, docs-only env vars)
- cat-g-b8f8f8796159 (P2, config-only env vars)
- cat-g-renewal_check_interval_rename_drift (P2, renamed env var still in docs)
Deferred follow-ups:
- The 26 documented-but-unimplemented integration contracts on the
allowlist (CERTCTL_OPENSSL_*, CERTCTL_ACME_EAB_*, CERTCTL_WEBHOOK_*,
CERTCTL_AUDIT_EXCLUDE_PATHS, CERTCTL_TLS_*, CERTCTL_ACME_DNS_PROPAGATION_WAIT)
are documented in features.md / connectors.md / demo-advanced.md but
not yet read by any Go source. Either implement in config.go (each is
its own M-X) or delete from docs (separate cleanup PR). Neither
expansion fits inside G-3's "reconcile drift" scope.
This commit is contained in:
@@ -656,6 +656,99 @@ jobs:
|
||||
fi
|
||||
echo "S-1 stale-counts guardrail: clean."
|
||||
|
||||
- name: Forbidden env-var docs drift regression guard (G-3)
|
||||
# G-3 master closed cat-g-163dae19bc59 (docs-only env vars
|
||||
# phantom in features.md), cat-g-b8f8f8796159 (6 config-only
|
||||
# env vars never documented), and cat-g-renewal_check_interval_rename_drift
|
||||
# (features.md still advertised the pre-rename
|
||||
# CERTCTL_RENEWAL_CHECK_INTERVAL after it was renamed to
|
||||
# CERTCTL_SCHEDULER_RENEWAL_CHECK_INTERVAL). This step runs
|
||||
# `comm -23` both ways between the env vars defined in Go
|
||||
# source (config.go + cmd/agent + deploy/test fixtures + ACME
|
||||
# DNS-01 script env exports) and the env vars mentioned in
|
||||
# README + docs/ + deploy/helm/.
|
||||
#
|
||||
# Allowlist: env vars that are documented as integration-
|
||||
# surface contracts (script env exports for ACME DNS-01,
|
||||
# OpenSSL CA scripts, StepCA per-issuer-config-blob fields,
|
||||
# Webhook per-notifier-config-blob fields, ACME EAB, audit
|
||||
# exclusion, demo-stack overrides) but not consumed directly
|
||||
# by config.go. Each entry below has a one-line justification
|
||||
# — if you add a new entry, add the justification too.
|
||||
#
|
||||
# See coverage-gap-audit-2026-04-24-v5/unified-audit.md
|
||||
# cat-g-* for closure rationale.
|
||||
run: |
|
||||
set -e
|
||||
# Defined: config.go + agent + cli + mcp-server + server cmds + test fixtures + ACME DNS export
|
||||
{
|
||||
grep -nE '"CERTCTL_[A-Z_]+"' internal/config/config.go | sed -E 's/.*"(CERTCTL_[A-Z_]+)".*/\1/'
|
||||
grep -rhoE '"CERTCTL_[A-Z_]+"' cmd/agent/*.go cmd/cli/*.go cmd/mcp-server/*.go cmd/server/*.go 2>/dev/null | sed -E 's/"(CERTCTL_[A-Z_]+)"/\1/'
|
||||
grep -rhoE 'CERTCTL_[A-Z_]+' deploy/test/qa_test.go internal/connector/issuer/acme/dns.go 2>/dev/null
|
||||
} | grep -E '^CERTCTL_' | sort -u > /tmp/g3-defined.txt
|
||||
# Documented: README + docs + helm
|
||||
grep -rhoE '\bCERTCTL_[A-Z_]+\b' README.md docs/ deploy/helm/ 2>/dev/null | sort -u > /tmp/g3-docs.txt
|
||||
# Allowlist of env vars documented as external integration contracts.
|
||||
# Each entry justifies itself in one line; if you add to this list,
|
||||
# add the justification.
|
||||
ALLOWED='^(
|
||||
CERTCTL_OPENSSL_SIGN_SCRIPT|
|
||||
CERTCTL_OPENSSL_REVOKE_SCRIPT|
|
||||
CERTCTL_OPENSSL_CRL_SCRIPT|
|
||||
CERTCTL_OPENSSL_TIMEOUT_SECONDS|
|
||||
CERTCTL_STEPCA_URL|
|
||||
CERTCTL_STEPCA_FINGERPRINT|
|
||||
CERTCTL_STEPCA_PROVISIONER|
|
||||
CERTCTL_STEPCA_PROVISIONER_NAME|
|
||||
CERTCTL_STEPCA_PROVISIONER_KEY|
|
||||
CERTCTL_STEPCA_PROVISIONER_JWK|
|
||||
CERTCTL_STEPCA_PROVISIONER_PASSWORD|
|
||||
CERTCTL_STEPCA_PASSWORD|
|
||||
CERTCTL_STEPCA_KEY_PATH|
|
||||
CERTCTL_STEPCA_ROOT_CA|
|
||||
CERTCTL_WEBHOOK_URL|
|
||||
CERTCTL_WEBHOOK_SECRET|
|
||||
CERTCTL_ACME_EAB_KID|
|
||||
CERTCTL_ACME_EAB_HMAC|
|
||||
CERTCTL_ACME_DNS_PROPAGATION_WAIT|
|
||||
CERTCTL_AUDIT_EXCLUDE_PATHS|
|
||||
CERTCTL_TLS_|
|
||||
CERTCTL_TLS_INSECURE_SKIP_VERIFY|
|
||||
CERTCTL_SERVER_CA_BUNDLE_PATH|
|
||||
CERTCTL_SERVER_TLS_INSECURE_SKIP_VERIFY|
|
||||
CERTCTL_QA_[A-Z_]+
|
||||
)$'
|
||||
# ^ The CERTCTL_OPENSSL_* / CERTCTL_STEPCA_* / CERTCTL_WEBHOOK_* /
|
||||
# CERTCTL_ACME_EAB_* / CERTCTL_ACME_DNS_PROPAGATION_WAIT /
|
||||
# CERTCTL_AUDIT_EXCLUDE_PATHS / CERTCTL_TLS_* / CERTCTL_SERVER_* /
|
||||
# CERTCTL_QA_* sets are documented integration-surface contracts
|
||||
# (script invocations, per-issuer config-blob field names,
|
||||
# per-notifier config-blob field names, demo-stack overrides,
|
||||
# test fixtures) — not server-side env vars in config.go.
|
||||
# The audit's "37 docs-only" count over-flagged these; the
|
||||
# closure narrows the gate to the specific drift sites
|
||||
# (renewal-interval rename + 6 config-only) and allowlists
|
||||
# the documented external contracts here.
|
||||
ALLOWED_FLAT=$(echo "$ALLOWED" | tr -d '\n ')
|
||||
DOCS_ONLY=$(comm -13 /tmp/g3-defined.txt /tmp/g3-docs.txt | grep -vE "$ALLOWED_FLAT" || true)
|
||||
CONFIG_ONLY=$(comm -23 /tmp/g3-defined.txt /tmp/g3-docs.txt || true)
|
||||
if [ -n "$DOCS_ONLY" ]; then
|
||||
echo "G-3 regression: env var(s) mentioned in docs but not defined in Go source AND not in the documented integration-surface allowlist:"
|
||||
echo "$DOCS_ONLY"
|
||||
echo ""
|
||||
echo "Either delete from docs (phantom/typo) or add to config.go,"
|
||||
echo "or add to the ALLOWED list with a one-line justification."
|
||||
exit 1
|
||||
fi
|
||||
if [ -n "$CONFIG_ONLY" ]; then
|
||||
echo "G-3 regression: env var(s) defined in Go source but never documented:"
|
||||
echo "$CONFIG_ONLY"
|
||||
echo ""
|
||||
echo "Add an entry to docs/features.md (or another canonical doc) so operators can find it."
|
||||
exit 1
|
||||
fi
|
||||
echo "G-3 env-var docs drift guardrail: clean."
|
||||
|
||||
helm-lint:
|
||||
name: Helm Chart Validation
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user