diff --git a/.github/workflows/deploy-with-opa.yml b/.github/workflows/deploy-with-opa.yml index 44a5d8a6..4bb24129 100644 --- a/.github/workflows/deploy-with-opa.yml +++ b/.github/workflows/deploy-with-opa.yml @@ -1353,15 +1353,13 @@ jobs: --md-output ongoing-certification-report.md jq '{next_ongoing_certification_report_date, next_quarterly_review_date}' ongoing-certification-report.json - - name: Build CDS certification-data artifacts (overview, availability, policy index) + - name: Build CDS certification-data artifacts (availability, policy index) working-directory: infrastructure run: | - echo "Building CDS certification-overview package, availability feed, policy index..." + echo "Building the availability feed and policy index..." # availability history: fetch the previously-published feed (best-effort) curl -sfL -o previous-availability.json "https://samaydlette.com/.well-known/availability.json" \ || echo '{"history":[]}' > previous-availability.json - python3 ../scripts/build-cds-overview.py \ - --offering ../data/cds/offering.json --profile ../data/system-profile.json --ksi-signal ksi-signal.json python3 ../scripts/build-availability.py \ --previous previous-availability.json --ksi-signal ksi-signal.json python3 ../scripts/build-policy-index.py --output policy-index.json --md-output policy-index.md @@ -1402,7 +1400,7 @@ jobs: echo "Building Certification Package Overview (CPO-CSO-OVR); with the SDR, the SSP replacement..." python3 ../scripts/build-cpo.py \ --offering ../data/cds/offering.json --profile ../data/system-profile.json \ - --overview certification-overview-package.json --ksi-signal ksi-signal.json + --ksi-signal ksi-signal.json # The authorization-boundary map the trust center draws: the inventory's # components placed by docs/boundary/boundary-classification.json, connected @@ -1488,7 +1486,6 @@ jobs: working-directory: infrastructure run: | echo "Signing CDS artifacts with cosign keyless..." - cosign sign-blob --yes --new-bundle-format --bundle certification-overview-package.bundle certification-overview-package.json cosign sign-blob --yes --new-bundle-format --bundle availability.bundle availability.json cosign sign-blob --yes --new-bundle-format --bundle policy-index.bundle policy-index.json cosign sign-blob --yes --new-bundle-format --bundle security-decision-record.bundle security-decision-record.json diff --git a/.gitignore b/.gitignore index 491120c6..58fada97 100644 --- a/.gitignore +++ b/.gitignore @@ -46,8 +46,6 @@ infrastructure/ksi-signal.json # and published to /.well-known/; never committed — same policy as the OSCAL artifacts above) infrastructure/ongoing-certification-report.json infrastructure/ongoing-certification-report.md -infrastructure/certification-overview-package.json -infrastructure/certification-overview-package.md infrastructure/certification-package-overview.json infrastructure/certification-package-overview.md infrastructure/security-decision-record.json diff --git a/data/cds/offering.json b/data/cds/offering.json index 5bf21b13..b14775a4 100644 --- a/data/cds/offering.json +++ b/data/cds/offering.json @@ -1,18 +1,18 @@ { - "_note": "Operator-declared editorial values for the CDS certification-overview package (CDS-CSO-PUB / CDS-CSO-SVC / CDS-CSO-FID). scripts/build-cds-overview.py reads this plus the system profile and the canonical inventory to emit /.well-known/certification-overview-package.json. Honest placeholders are used where a value requires sponsorship the PoC does not have (FedRAMP ID, UEI).", - "fedramp_id": "", - "service_model": "SaaS", + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CPO-CSO-MTD). scripts/build-cpo.py reads this plus the system profile and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. No FedRAMP ID has been or will be assigned: fedramp_id is FedRAMP's fallback (the provider name and acronym) with a suffix that says so. There is no SAM.gov UEI, so none is published. No value here is an email address.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "service_model": ["SaaS"], "deployment_model": "Public Cloud", - "business_category": "Personal demonstration / compliance-automation reference architecture", - "uei": "", - "sales_contact": { "name": "Sam Aydlette", "url": "https://samaydlette.com/pages/contact.html" }, - "security_contact": { "name": "Sam Aydlette", "url": "https://www.linkedin.com/in/sa2/", "source": "/.well-known/security.txt" }, + "business_category": ["Governance, Risk, and Compliance (GRC)", "Cybersecurity & Risk Management", "Health & Wellness"], + "sales_contact": { "name": "Sam Aydlette. Nothing here is for sale; say hello through https://samaydlette.com/pages/contact.html" }, + "security_contact": { "name": "Sam Aydlette, through the contact in https://samaydlette.com/.well-known/security.txt" }, "product_website": "https://samaydlette.com", "logo_url": "https://samaydlette.com/assets/images/brand/logo.png", "service_description": "A static personal website on AWS that doubles as a working continuous-compliance pipeline: every deploy derives signed, machine-readable compliance artifacts from one canonical inventory and publishes them under /.well-known/. Includes the Silk Reeling Mirror application, a Cognito-gated Tai Chi coaching API.", "secure_configuration_guidance_url": "https://github.com/sam-aydlette/samaydlette.com/blob/main/docs/policies/secure-configuration-guide.md", - "documentation_overview_url": "https://samaydlette.com/trust/index.html", - "current_independent_assessment_service": "None — self-attested; no FedRAMP-Recognized independent assessment service engaged (IVV is N/A for this unsponsored proof of concept).", "accountable_official": { "name": "Sam Aydlette", "title": "System Owner / Authorizing Operator", diff --git a/data/frr-records.json b/data/frr-records.json index a8a8b16c..d586fb94 100644 --- a/data/frr-records.json +++ b/data/frr-records.json @@ -606,8 +606,8 @@ }, { "frr_id": "CDS-CSO-SVC", - "status": "Not Demonstrated", - "not_demonstrated": "Not built in this repository yet. Missing: 2 test(s).", + "status": "Implemented", + "implementation": "Every deploy writes the Certification Package Overview in FedRAMP's schema with certifiedServices: each service in the offering (data/cds/offering.json), named as on the site, with its security category and whether it is in the Minimum Assessment Scope. The builder fails on an empty service list, on a service with no scope answer, and on a category that does not name the system's impact level. The overview is validated against the vendored schema before it is written, then signed and published.", "evidence": [ { "kind": "step", @@ -616,13 +616,24 @@ { "kind": "artifact", "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_every_service_is_listed_with_its_security_category_and_scope" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_a_service_whose_category_does_not_name_the_system_level_fails" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_a_service_without_a_scope_answer_fails" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_an_offering_with_no_services_fails" } - ], - "acceptance": { - "by": "Sam Aydlette", - "on": "2026-11-09", - "review_by": "2027-11-09" - } + ] }, { "frr_id": "CDS-CSO-UTC", @@ -802,8 +813,8 @@ }, { "frr_id": "CPO-CSO-MTD", - "status": "Not Demonstrated", - "not_demonstrated": "Not built in this repository yet. Missing: 2 test(s).", + "status": "Implemented", + "implementation": "Every deploy writes the Certification Package Overview with metadata: the accountable official's name, title and contact, the version (the commit it was built from), the date and time of the update, and its source (the builder, the commit and the deploy run). The builder fails when the official lacks any of the three fields or there is no commit. The JSON and Markdown are published together; the JSON is signed.", "evidence": [ { "kind": "step", @@ -812,13 +823,24 @@ { "kind": "artifact", "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_the_metadata_names_the_accountable_official_version_time_and_source" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_an_accountable_official_missing_a_field_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_a_package_without_a_commit_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_cpo.py::test_the_markdown_carries_the_metadata_and_every_service" } - ], - "acceptance": { - "by": "Sam Aydlette", - "on": "2026-11-09", - "review_by": "2027-11-09" - } + ] }, { "frr_id": "CPO-CSO-OSA", diff --git a/infrastructure/schemas/freshness-config.json b/infrastructure/schemas/freshness-config.json index 17bb2105..90f6123e 100644 --- a/infrastructure/schemas/freshness-config.json +++ b/infrastructure/schemas/freshness-config.json @@ -211,21 +211,6 @@ ], "markdown": true }, - { - "path": ".well-known/certification-overview-package.json", "generator": "scripts/build-cds-overview.py", - "cadence": "deploy", - "max_age_hours": 720, - "timestamp": { - "source": "json", - "field": "emitted_at" - }, - "signed": true, - "signature": ".well-known/certification-overview-package.bundle", - "published_by": [ - "deploy" - ], - "markdown": true - }, { "path": ".well-known/availability.json", "generator": "scripts/build-availability.py", "cadence": "deploy", diff --git a/scripts/build-cds-overview.py b/scripts/build-cds-overview.py deleted file mode 100644 index 3861ec6b..00000000 --- a/scripts/build-cds-overview.py +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env python3 -# ============================================================================= -# CERTIFICATION OVERVIEW PACKAGE BUILDER (CR26 CDS) -# ============================================================================= -# CR26 Certification Data Sharing (CDS) requires a publicly-shared, machine- and -# human-readable certification-overview package (CDS-CSO-PUB) carrying fifteen -# fields, a detailed service list with security categories (CDS-CSO-SVC), and a -# FedRAMP ID in all certification data (CDS-CSO-FID; a placeholder until assigned -# for an unsponsored system). This generator assembles the package from operator- -# declared editorial values (data/cds/offering.json), the authoritative system -# categorization (data/system-profile.json), and the canonical inventory's -# signal_id, and emits JSON + human-readable markdown (consistency between the -# two is the CDS-CSO-CBF automation requirement). -# -# build-cds-overview.py --offering ../data/cds/offering.json \ -# --profile ../data/system-profile.json --ksi-signal ksi-signal.json -# ============================================================================= - -import argparse -import json -import sys -from datetime import datetime, timedelta, timezone -from pathlib import Path - -QUARTER_DAYS = 91 - - -def main(): - ap = argparse.ArgumentParser() - ap.add_argument("--offering", default="../data/cds/offering.json") - ap.add_argument("--profile", default="../data/system-profile.json") - ap.add_argument("--ksi-signal", default="ksi-signal.json") - ap.add_argument("--output", default="certification-overview-package.json") - ap.add_argument("--md-output", default="certification-overview-package.md") - a = ap.parse_args() - - now = datetime.now(timezone.utc) - off = json.loads(Path(a.offering).read_text()) - prof = json.loads(Path(a.profile).read_text()) - signal_id = None - if Path(a.ksi_signal).exists(): - signal_id = json.loads(Path(a.ksi_signal).read_text()).get("signal_id") - else: - print(f"::warning::ksi-signal not found at {a.ksi_signal}", file=sys.stderr) - next_ocr = (now + timedelta(days=QUARTER_DAYS)).date().isoformat() - - pkg = { - "package_type": "certification-overview-package", - "schema": "fedramp-certification-overview-package-schema-2026-06-24.json", - "emitted_at": now.isoformat(), - "ksi_signal_id": signal_id, - # The 15 CDS-CSO-PUB fields: - "fedramp_id": off["fedramp_id"], # 1 (CDS-CSO-FID) - "service_model": off["service_model"], # 2 - "deployment_model": off["deployment_model"], # 3 - "business_category": off["business_category"], # 4 - "uei": off["uei"], # 5 - "sales_contact": off["sales_contact"], # 6 - "security_contact": off["security_contact"], # 7 - "product_website": off["product_website"], # 8 - "logo_url": off["logo_url"], # 9 - "service_description": off["service_description"], # 10 - "services": off["services"], # 11 (CDS-CSO-SVC) - "secure_configuration_guidance_url": off["secure_configuration_guidance_url"], # 12 - "documentation_overview_url": off["documentation_overview_url"], # 13 - "next_ongoing_certification_report_date": next_ocr, # 14 (CCM-OCR-NRD) - "current_independent_assessment_service": off["current_independent_assessment_service"], # 15 - # Authoritative categorization (single source of truth). - "class": prof.get("fedramp_class"), - "impact_level": prof.get("impact_level"), - "impact_level_canonical": prof.get("impact_level_canonical"), - # Honest residuals for the trust-center subset (no sponsor). - "trust_center_status": ( - "N/A absent a consuming agency. CDS-TRC-* (FedRAMP-compatible trust center, " - "programmatic access, access logging, agency-access inventory) and CDS-UTC-* " - "presuppose authorized agency consumers; with none, those are not exercised. " - "All certification data here is instead shared fully publicly under CDS-CSO-PUB."), - } - Path(a.output).write_text(json.dumps(pkg, indent=2) + "\n") - if a.md_output: - Path(a.md_output).write_text(render_markdown(pkg) + "\n") - print(f"certification-overview-package: {len(pkg['services'])} services; " - f"FedRAMP ID {pkg['fedramp_id'][:24]}...; next OCR {next_ocr}") - return 0 - - -def render_markdown(p): - out = ["# Certification Overview Package", ""] - out.append(f"- **Class:** {p['class']} | **Impact:** {p['impact_level_canonical']}") - out.append(f"- **FedRAMP ID:** {p['fedramp_id']}") - out.append(f"- **UEI:** {p['uei']}") - out.append(f"- **Service / Deployment model:** {p['service_model']} / {p['deployment_model']}") - out.append(f"- **Business category:** {p['business_category']}") - out.append(f"- **Product website:** {p['product_website']}") - sc = p["security_contact"] - out.append(f"- **Security contact:** {sc.get('name')} ({sc.get('url')})") - out.append(f"- **Sales contact:** {p['sales_contact'].get('name')} ({p['sales_contact'].get('url')})") - out.append(f"- **Secure Configuration Guidance:** {p['secure_configuration_guidance_url']}") - out.append(f"- **Documentation overview:** {p['documentation_overview_url']}") - out.append(f"- **Independent assessment service:** {p['current_independent_assessment_service']}") - out.append(f"- **Next Ongoing Certification Report:** {p['next_ongoing_certification_report_date']}") - out.append(f"- **Bound to inventory signal:** `{p['ksi_signal_id']}`") - out += ["", "## Service description", "", p["service_description"]] - out += ["", "## Services (CDS-CSO-SVC)", "", - "| Service | Security category | In MAS scope | Description |", - "|---|---|---|---|"] - for s in p["services"]: - out.append("| {n} | {c} | {m} | {d} |".format( - n=s.get("name", ""), c=s.get("security_category", ""), - m="yes" if s.get("in_mas_scope") else "no", - d=(s.get("description", "") or "").replace("|", "\\|"))) - out += ["", "## Trust-center status", "", p["trust_center_status"]] - out += ["", "---", "_Source of truth: the signed `certification-overview-package.json` " - "(CDS-CSO-PUB / SVC / FID)._"] - return "\n".join(out) - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/scripts/build-cpo.py b/scripts/build-cpo.py index adee19eb..3d3fe2b7 100644 --- a/scripts/build-cpo.py +++ b/scripts/build-cpo.py @@ -1,146 +1,252 @@ #!/usr/bin/env python3 # ============================================================================= -# CERTIFICATION PACKAGE OVERVIEW BUILDER (CR26 CPO) +# CERTIFICATION PACKAGE OVERVIEW BUILDER (CR26 CPO, FedRAMP's 2026-06-24 schema) # ============================================================================= -# CR26 CPO-CSO-OVR (MUST) requires a Certification Package Overview, human- and -# machine-readable, that rolls up the CDS public information, the Minimum -# Assessment Scope, the cryptographic-module use (CMU-CSO-CMD), and the -# independent-assessment results (IVV-CSO-ICP). CPO-CSO-MTD requires the name, -# title, and contact of the accountable official plus version/timestamp/source. -# CPO-CSX-CPM (Class C) requires the package be maintained at least every two -# weeks — trivially met by the per-deploy pipeline. Together with the Security -# Decision Record, the CPO is CR26's replacement for the base System Security -# Plan; the OSCAL SSP that used to be published alongside is retired. +# CPO-CSO-OVR: the overview of the one offering, in JSON and Markdown. It is +# written in FedRAMP's Certification Package Overview schema and validated +# against the vendored copy first; a CPO that fails is never written, so it is +# never signed or published. # -# This is an overview/manifest: it points at the constituent artifacts the -# pipeline already publishes and summarizes scope, crypto, and assessment status. +# It also carries the public information (CDS-CSO-PUB) and the service list +# (CDS-CSO-SVC) that scripts/build-cds-overview.py used to publish in a separate +# file, so that information has one source and one file. +# +# serviceIdentification provider, service, FedRAMP ID, website, logo. The +# FedRAMP ID is FedRAMP's fallback (the provider name +# and acronym), suffixed so nobody mistakes it for an +# assigned ID. No UEI: the schema says to leave it +# out when there is none. +# serviceProperties service and deployment model, business category, +# trust center, secure configuration guidance, and the +# package's files as repositories +# contactInformation security and sales; never an email address +# certifiedServices each service, with its security category and +# whether it is in the Minimum Assessment Scope +# metadata accountable official, version, last update and its +# source (CPO-CSO-MTD) +# +# The fields this repo's other tools read stay at the top level, beside the +# schema's sections (the schema allows extra fields): ksi_signal_id (the +# inventory binding: reconciliation (e) and verify-published), impact_level +# (reconciliation (d)) and metadata.last_updated (the freshness window). # # build-cpo.py --offering ../data/cds/offering.json --profile ../data/system-profile.json \ -# --overview certification-overview-package.json --ksi-signal ksi-signal.json +# --ksi-signal ksi-signal.json # ============================================================================= import argparse import json +import os +import subprocess import sys from datetime import datetime, timezone from pathlib import Path -# The certification-package artifacts the pipeline publishes under /.well-known/. -# (artifact filename, type, signed) -PACKAGE_CONTENTS = [ - ("security-decision-record.json", - "Security Decision Record (SDR: per-KSI and per-Rev5-control records; replaces the SSP)", True), - ("ksi-signal.json", "FedRAMP 20x KSI signal (canonical inventory)", True), - ("vdr-report.json", "Vulnerability Detection and Response report", True), - ("ongoing-certification-report.json", "Ongoing Certification Report (CCM)", True), - ("certification-overview-package.json", "CDS certification-overview package", True), - ("availability.json", "Availability feed (CDS-CSO-AVR)", True), - ("policy-index.json", "Policy and procedure index (CDS-CSO-IRP)", True), - ("iiw.csv", "FedRAMP Integrated Inventory Workbook (Appendix M)", True), -] +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _fedramp_schema as fs # noqa: E402 + BASE = "https://samaydlette.com/.well-known/" +TRUST_CENTER = "https://samaydlette.com/trust/index.html" +BOUNDARY_PAGE = "https://samaydlette.com/research/authorization-boundary.html" +# The certification package's files under /.well-known/: (file, repository types, description). +PACKAGE = [ + ("security-decision-record.json", ["Security Decision Record"], + "Every applicable FedRAMP rule and KSI with its status, and the Rev5 control projection " + "(with this overview, the CR26 replacement for the System Security Plan). Signed."), + ("ksi-signal.json", ["Key Security Indicators"], + "The canonical inventory and per-KSI results that every other file is bound to. Signed."), + ("vdr-report.json", ["Vulnerability Detection and Response"], + "Vulnerability detection and response report. Signed."), + ("ongoing-certification-report.json", ["Ongoing Certification Report"], + "Ongoing Certification Report (CCM). Signed."), + ("availability.json", ["Availability"], "Availability feed. Signed."), + ("policy-index.json", ["Policies and Procedures"], "Policy and procedure index (CDS-CSO-IRP). Signed."), + ("iiw.csv", ["Integrated Inventory Workbook"], "FedRAMP Integrated Inventory Workbook (Appendix M). Signed."), +] NO_INDEPENDENT_ASSESSMENT = ("None performed. Independent assessment is Impractical here: one-person, no-budget. " "Provider-side verification and validation are in the Security Decision Record.") -def main(): +def _fail(msg): + raise SystemExit(f"::error::CPO: {msg} (fail-closed)") + + +def _repo(types, url, desc): + return {"repositoryType": types, "url": url, "repositoryDescription": desc, "authenticationRequired": False} + + +# --- the schema's sections ------------------------------------------------------------- + +def service_identification(off): + return {"providerName": off["provider_name"], "serviceName": off["service_name"], + "serviceAcronym": off["service_acronym"], "serviceDescription": off["service_description"], + "certificationType": "20x", + "fedRampPackageId": off["fedramp_id"], + "website": off["product_website"], "logo": off["logo_url"]} + + +def service_properties(off): + return {"serviceType": off["service_model"], "deploymentModel": off["deployment_model"], + "businessCategory": off["business_category"], + "trustCenter": _repo(["Trust Center"], TRUST_CENTER, + "The trust center: the security state this package reports, drawn from the " + "signed files under /.well-known/. Public; no access request is needed."), + "secureConfigurationGuidance": _repo(["Secure Configuration Guidance"], + off["secure_configuration_guidance_url"], + "The Secure Configuration Guide."), + "additionalRepositories": [_repo(t, BASE + f, d) for f, t, d in PACKAGE]} + + +def contacts(off): + """Security and Sales, which the schema requires. Neither is an email + address, so neither goes in the email field.""" + return [{"contactType": "Security", "contactName": off["security_contact"]["name"]}, + {"contactType": "Sales", "contactName": off["sales_contact"]["name"]}] + + +def certified_services(off, prof): + """CDS-CSO-SVC: every service in the offering, with its security category and + whether it is in the Minimum Assessment Scope. A service's category must name + the system's own impact level.""" + services = off.get("services") or [] + if not services: + _fail("the offering lists no services (CDS-CSO-SVC)") + out = [] + for s in services: + cat = s.get("security_category") + if not isinstance(cat, str) or prof["impact_level"] not in cat: + _fail(f"service {s.get('name')!r}: security category {cat!r} does not name the system's " + f"impact level {prof['impact_level']!r}") + if not isinstance(s.get("in_mas_scope"), bool): + _fail(f"service {s.get('name')!r}: in_mas_scope must be true or false") + out.append({"serviceName": s["name"], "serviceDescription": s["description"], + "securityCategory": cat, "inMinimumAssessmentScope": s["in_mas_scope"]}) + return out + + +# --- this repo's fields ------------------------------------------------------------------ + +def metadata(off, now, commit, run_url): + """CPO-CSO-MTD: the accountable official, version, date and time of the last + update, and its source.""" + ao = off.get("accountable_official") or {} + if not all(isinstance(ao.get(k), str) and ao[k] for k in ("name", "title", "contact")): + _fail("the accountable official needs a name, title and contact (CPO-CSO-MTD)") + if not commit: + _fail("no commit to version the package with (CPO-CSO-MTD)") + return {"accountable_official": {k: ao[k] for k in ("name", "title", "contact")}, + "version": commit, + "last_updated": now.isoformat(), + "source_of_update": f"scripts/build-cpo.py at commit {commit}, " + + (f"deploy run {run_url}" if run_url else "local build")} + + +def _commit(): + if os.environ.get("GITHUB_SHA"): + return os.environ["GITHUB_SHA"] + try: + return subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True, + check=True, cwd=Path(__file__).resolve().parent).stdout.strip() + except (OSError, subprocess.CalledProcessError): + return None + + +def _run_url(): + e = os.environ + if all(e.get(k) for k in ("GITHUB_SERVER_URL", "GITHUB_REPOSITORY", "GITHUB_RUN_ID")): + return f"{e['GITHUB_SERVER_URL']}/{e['GITHUB_REPOSITORY']}/actions/runs/{e['GITHUB_RUN_ID']}" + return None + + +def build(off, prof, signal, now, commit, run_url): + return { + "$schema": fs.stamp("cpo"), + "serviceIdentification": service_identification(off), + "serviceProperties": service_properties(off), + "contactInformation": contacts(off), + "certifiedServices": certified_services(off, prof), + "metadata": metadata(off, now, commit, run_url), + "ksi_signal_id": signal.get("signal_id"), + "class": prof.get("fedramp_class"), + "impact_level": prof.get("impact_level"), + "minimum_assessment_scope": { + "component_count": len(signal.get("components", [])), + "authorization_boundary": BOUNDARY_PAGE, + }, + "cryptographic_modules": off.get("cryptographic_modules", []), + "independent_assessment": NO_INDEPENDENT_ASSESSMENT, + } + + +def main(argv=None): ap = argparse.ArgumentParser() ap.add_argument("--offering", default="../data/cds/offering.json") ap.add_argument("--profile", default="../data/system-profile.json") - ap.add_argument("--overview", default="certification-overview-package.json") ap.add_argument("--ksi-signal", default="ksi-signal.json") ap.add_argument("--output", default="certification-package-overview.json") ap.add_argument("--md-output", default="certification-package-overview.md") - a = ap.parse_args() + a = ap.parse_args(argv) - now = datetime.now(timezone.utc) off = json.loads(Path(a.offering).read_text()) prof = json.loads(Path(a.profile).read_text()) - overview = json.loads(Path(a.overview).read_text()) if Path(a.overview).exists() else {} - signal = json.loads(Path(a.ksi_signal).read_text()) if Path(a.ksi_signal).exists() else {} - components = signal.get("components", []) if signal else [] - - cpo = { - "package_type": "certification-package-overview", - "schema": "fedramp-certification-package-overview-schema-2026-06-24.json", - "note": "With the Security Decision Record, the CR26 replacement for the base System " - "Security Plan.", - # CPO-CSO-MTD - "accountable_official": off.get("accountable_official"), - "metadata": { - "version": "live (regenerated each deploy)", - "last_updated": now.isoformat(), - "source_of_update": "scripts/build-cpo.py", - }, - "maintenance_cadence": "per-deploy — exceeds the CPO-CSX-CPM Class C 2-week minimum", - "class": prof.get("fedramp_class"), - "impact_level": prof.get("impact_level"), - "impact_level_canonical": prof.get("impact_level_canonical"), - "ksi_signal_id": signal.get("signal_id"), - # CPO-CSO-OVR rollup: - "certification_data": { # CDS public info - "fedramp_id": overview.get("fedramp_id") or off.get("fedramp_id"), - "service_description": off.get("service_description"), - "service_model": off.get("service_model"), - "deployment_model": off.get("deployment_model"), - "security_contact": off.get("security_contact"), - "overview_package": BASE + "certification-overview-package.json", - }, - "minimum_assessment_scope": { # MAS - "component_count": len(components), - "services": off.get("services"), - "authorization_boundary": "https://samaydlette.com/research/authorization-boundary.html", - "reference": "MAS-CSO-IIR / MAS-CSO-FLO / MAS-CSO-TPR; MAS-CSO-MDI N/A (no federal customer data)", - }, - "cryptographic_modules": { # CMU-CSO-CMD - "modules": off.get("cryptographic_modules", []), - "reference": "CMU-CSO-CMD; full narrative in the authorization-boundary FIPS section", - }, - "independent_assessment": { # IVV-CSO-ICP - "status": NO_INDEPENDENT_ASSESSMENT, - "current_service": off.get("current_independent_assessment_service"), - }, - "package_contents": [ - {"artifact": fn, "description": desc, "url": BASE + fn, "signed": signed} - for fn, desc, signed in PACKAGE_CONTENTS - ], - } - Path(a.output).write_text(json.dumps(cpo, indent=2) + "\n") + if not Path(a.ksi_signal).exists(): + _fail(f"{a.ksi_signal} not found: the package must be bound to the inventory") + signal = json.loads(Path(a.ksi_signal).read_text()) + + cpo = build(off, prof, signal, datetime.now(timezone.utc), _commit(), _run_url()) + fs.write_validated(cpo, "cpo", a.output) if a.md_output: Path(a.md_output).write_text(render_markdown(cpo) + "\n") - ao = cpo["accountable_official"] or {} - print(f"certification-package-overview: official {ao.get('name')}; " - f"{len(cpo['package_contents'])} package artifacts; " + print(f"certification-package-overview: {len(cpo['certifiedServices'])} services; " + f"{len(cpo['serviceProperties']['additionalRepositories'])} package files; " f"{cpo['minimum_assessment_scope']['component_count']} components in scope") return 0 def render_markdown(c): - ao = c["accountable_official"] or {} + si, sp, md = c["serviceIdentification"], c["serviceProperties"], c["metadata"] + ao = md["accountable_official"] + contact = {x["contactType"]: x["contactName"] for x in c["contactInformation"]} out = ["# Certification Package Overview", "", - f"_{c['note']}_", "", - f"- **Accountable official:** {ao.get('name')}, {ao.get('title')} ({ao.get('contact')})", - f"- **Class:** {c['class']} | **Impact:** {c['impact_level_canonical']}", - f"- **Version:** {c['metadata']['version']} | **Last updated:** {c['metadata']['last_updated']}", - f"- **Maintenance:** {c['maintenance_cadence']}", - f"- **Bound to inventory signal:** `{c['ksi_signal_id']}`", ""] + f"**{si['serviceName']}** ({si['serviceAcronym']}), provided by {si['providerName']}.", "", + si["serviceDescription"], "", + f"- **FedRAMP ID:** {si['fedRampPackageId']}", + f"- **Certification type:** {si['certificationType']} | **Class:** {c['class']} | " + f"**Impact level:** {c['impact_level']}", + f"- **Service model:** {', '.join(sp['serviceType'])} | **Deployment model:** {sp['deploymentModel']}", + f"- **Business category:** {', '.join(sp['businessCategory'])}", + f"- **Website:** {si['website']} | **Logo:** {si['logo']}", + f"- **Security contact:** {contact['Security']}", + f"- **Sales contact:** {contact['Sales']}", + f"- **Trust center:** {sp['trustCenter']['url']}", + f"- **Secure Configuration Guidance:** {sp['secureConfigurationGuidance']['url']}", + f"- **Independent assessment:** {c['independent_assessment']}", "", + "## Metadata", "", + f"- **Accountable official:** {ao['name']}, {ao['title']} ({ao['contact']})", + f"- **Version:** `{md['version']}`", + f"- **Last updated:** {md['last_updated']}", + f"- **Source of update:** {md['source_of_update']}", + f"- **Bound to inventory signal:** `{c['ksi_signal_id']}`", "", + "## Services", "", + "| Service | Security category | In the Minimum Assessment Scope | Description |", + "|---|---|---|---|"] + for s in c["certifiedServices"]: + out.append("| {n} | {cat} | {m} | {d} |".format( + n=s["serviceName"], cat=s["securityCategory"], m="yes" if s["inMinimumAssessmentScope"] else "no", + d=s["serviceDescription"].replace("|", "\\|"))) mas = c["minimum_assessment_scope"] - out += ["## Minimum Assessment Scope", "", + out += ["", "## Minimum Assessment Scope", "", f"- Components in scope: **{mas['component_count']}**", - f"- Authorization boundary: {mas['authorization_boundary']}", - f"- {mas['reference']}", ""] - out += ["## Cryptographic modules (CMU-CSO-CMD)", "", + f"- Authorization boundary: {mas['authorization_boundary']}", "", + "## Cryptographic modules (CMU-CSO-CMD)", "", "| Module | Validation | Role |", "|---|---|---|"] - for m in c["cryptographic_modules"]["modules"]: - out.append("| {mod} | {val} | {role} |".format( - mod=m.get("module", ""), val=m.get("validation", ""), role=m.get("role", ""))) - out += ["", "## Independent assessment (IVV-CSO-ICP)", "", c["independent_assessment"]["status"], ""] - out += ["## Package contents", "", "| Artifact | Description | Signed |", "|---|---|---|"] - for p in c["package_contents"]: - out.append("| [`{a}`]({u}) | {d} | {s} |".format( - a=p["artifact"], u=p["url"], d=p["description"], s="yes" if p["signed"] else "no")) + for m in c["cryptographic_modules"]: + out.append(f"| {m.get('module', '')} | {m.get('validation', '')} | {m.get('role', '')} |") + out += ["", "## Package files", "", "| File | Description |", "|---|---|"] + for r in sp["additionalRepositories"]: + out.append(f"| [`{r['url'].rsplit('/', 1)[-1]}`]({r['url']}) | {r['repositoryDescription']} |") out += ["", "---", "_Source of truth: the signed `certification-package-overview.json` (CPO-CSO-OVR)._"] return "\n".join(out) diff --git a/tests/test_cpo.py b/tests/test_cpo.py new file mode 100644 index 00000000..7c86e39f --- /dev/null +++ b/tests/test_cpo.py @@ -0,0 +1,114 @@ +"""The Certification Package Overview in FedRAMP's schema (scripts/build-cpo.py). + +CPO-CSO-MTD (metadata) and CDS-CSO-SVC (the service list) cite these tests. +""" +import copy +import importlib.util +import json +from datetime import datetime, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +spec = importlib.util.spec_from_file_location("build_cpo", REPO / "scripts" / "build-cpo.py") +cpo = importlib.util.module_from_spec(spec) +spec.loader.exec_module(cpo) +fs = cpo.fs + +OFFERING = json.loads((REPO / "data" / "cds" / "offering.json").read_text()) +PROFILE = json.loads((REPO / "data" / "system-profile.json").read_text()) +SIGNAL = {"signal_id": "sig-1", "components": [{"id": "a"}, {"id": "b"}]} +NOW = datetime(2026, 11, 17, 12, 0, tzinfo=timezone.utc) +RUN = "https://github.com/o/r/actions/runs/1" + + +def build(off=OFFERING, prof=PROFILE, commit="abc123", run_url=RUN): + return cpo.build(off, prof, SIGNAL, NOW, commit, run_url) + + +def test_the_cpo_built_from_the_offering_validates_against_fedramps_schema(): + assert fs.validate(build(), "cpo") == [] + + +def test_a_cpo_that_fails_the_schema_is_never_written(tmp_path): + doc = build() + del doc["contactInformation"][1] # no Sales contact + out = tmp_path / "cpo.json" + with pytest.raises(SystemExit): + fs.write_validated(doc, "cpo", out) + assert not out.exists() + + +def test_the_metadata_names_the_accountable_official_version_time_and_source(): + md = build()["metadata"] + assert md["accountable_official"] == {k: OFFERING["accountable_official"][k] for k in ("name", "title", "contact")} + assert md["version"] == "abc123" + assert md["last_updated"] == NOW.isoformat() + assert "abc123" in md["source_of_update"] and RUN in md["source_of_update"] + assert "local build" in build(run_url=None)["metadata"]["source_of_update"] + + +@pytest.mark.parametrize("field", ["name", "title", "contact"]) +def test_an_accountable_official_missing_a_field_fails_the_build(field): + off = copy.deepcopy(OFFERING) + off["accountable_official"][field] = "" + with pytest.raises(SystemExit, match="CPO-CSO-MTD"): + build(off) + + +def test_a_package_without_a_commit_fails_the_build(): + with pytest.raises(SystemExit, match="CPO-CSO-MTD"): + build(commit=None) + + +def test_every_service_is_listed_with_its_security_category_and_scope(): + got = build()["certifiedServices"] + assert [s["serviceName"] for s in got] == [s["name"] for s in OFFERING["services"]] + for s, src in zip(got, OFFERING["services"], strict=True): + assert s["securityCategory"] == src["security_category"] + assert s["inMinimumAssessmentScope"] is src["in_mas_scope"] + + +def test_a_service_whose_category_does_not_name_the_system_level_fails(): + off = copy.deepcopy(OFFERING) + off["services"][0]["security_category"] = "FIPS-199 Low" + with pytest.raises(SystemExit, match="impact level"): + build(off) + + +def test_a_service_without_a_scope_answer_fails(): + off = copy.deepcopy(OFFERING) + del off["services"][0]["in_mas_scope"] + with pytest.raises(SystemExit, match="in_mas_scope"): + build(off) + + +def test_an_offering_with_no_services_fails(): + off = copy.deepcopy(OFFERING) + off["services"] = [] + with pytest.raises(SystemExit, match="CDS-CSO-SVC"): + build(off) + + +def test_the_fields_the_gates_read_stay_at_the_top_level(): + doc = build() + assert doc["ksi_signal_id"] == "sig-1" + assert doc["impact_level"] == PROFILE["impact_level"] + assert doc["metadata"]["last_updated"] + + +def test_the_fedramp_id_says_it_is_not_one_and_no_uei_is_invented(): + si = build()["serviceIdentification"] + assert si["fedRampPackageId"].endswith("PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID") + assert "ueiNumber" not in si + + +def test_no_contact_puts_anything_in_the_email_field(): + assert all("contactEmail" not in c for c in build()["contactInformation"]) + + +def test_the_markdown_carries_the_metadata_and_every_service(): + md = cpo.render_markdown(build()) + assert "abc123" in md and OFFERING["accountable_official"]["title"] in md + assert all(s["name"] in md for s in OFFERING["services"]) diff --git a/tests/test_published_set.py b/tests/test_published_set.py index 687c5fe8..3b3f9199 100644 --- a/tests/test_published_set.py +++ b/tests/test_published_set.py @@ -105,7 +105,7 @@ def test_the_deploy_uploads_every_listed_object_with_its_type(tmp_path): assert out.returncode == 0, out.stderr uploaded = _rows((tmp_path / "uploads").read_text()) keys = {r[1] for r in uploaded} - assert len(uploaded) == len(keys) == 48 + assert len(uploaded) == len(keys) == 45 assert {".well-known/ksi-signal.json", ".well-known/ksi-signal.schema.json", ".well-known/vdr-history.json", ".well-known/trust-center.bundle", ".well-known/certification-package-overview.md"} <= keys by_key = {r[1]: r for r in uploaded} @@ -127,7 +127,7 @@ def test_the_gate_scans_exactly_the_text_the_deploy_uploads(tmp_path): if not r[0].endswith((".bundle", ".tar.gz"))} gate = _gate(infra, env) assert gate.returncode == 0, gate.stderr - assert set(gate.stdout.split()) == text and len(text) == 28 + assert set(gate.stdout.split()) == text and len(text) == 26 # Never a directory scan: the deploy downloads live files it does not publish. script = (REPO / "scripts" / "run-gates.sh").read_text() assert "--root" not in script[script.index(" redaction)"):] @@ -138,7 +138,7 @@ def test_an_absent_corroboration_is_neither_scanned_nor_uploaded(tmp_path): env = _bin(tmp_path) assert _step(UPLOAD, infra, env).returncode == 0 keys = {r[1] for r in _rows((tmp_path / "uploads").read_text())} - assert len(keys) == 46 and not any("corroboration" in k for k in keys) + assert len(keys) == 43 and not any("corroboration" in k for k in keys) gate = _gate(infra, env) assert "boundary-corroboration.json" not in gate.stdout.split() @@ -165,12 +165,12 @@ def test_the_round_trip_compares_every_uploaded_object_and_attestation(tmp_path) served.mkdir(parents=True) rows = _rows(subprocess.run([sys.executable, str(REPO / "scripts" / "published-set.py"), "served", "--by", "deploy"], cwd=infra, capture_output=True, text=True, check=True).stdout) - assert len(rows) == 52 + assert len(rows) == 49 for f, key in rows: (tmp_path / "served" / key).write_bytes((infra / f).read_bytes()) ok = _step(ROUND_TRIP, infra, env) assert ok.returncode == 0, ok.stdout + ok.stderr - assert sum(line.startswith("ok: ") for line in ok.stdout.splitlines()) == 52 + assert sum(line.startswith("ok: ") for line in ok.stdout.splitlines()) == 49 # A served Markdown rendering that differs from the build is caught. (served / "vdr-report.md").write_text("stale") bad = _step(ROUND_TRIP, infra, env) diff --git a/tests/test_verify_published.py b/tests/test_verify_published.py index 13649c1c..10a0bfb3 100644 --- a/tests/test_verify_published.py +++ b/tests/test_verify_published.py @@ -60,10 +60,10 @@ def _run(tmp_path, site): def test_every_listed_signature_is_checked_against_its_publisher(tmp_path): rows = _signed() - assert len(rows) == 24 + assert len(rows) == 23 _, lines = _run(tmp_path, _site(tmp_path)) sig_lines = [line for line in lines if "bound to the published inventory" not in line] - assert len(sig_lines) == 24 and all(line.startswith("PASS") for line in sig_lines), sig_lines + assert len(sig_lines) == 23 and all(line.startswith("PASS") for line in sig_lines), sig_lines assert "PASS vdr-status.json signed by the pinned nightly workflow on main" in sig_lines