diff --git a/.github/ISSUE_TEMPLATE/agency-access.yml b/.github/ISSUE_TEMPLATE/agency-access.yml new file mode 100644 index 00000000..7f84524d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/agency-access.yml @@ -0,0 +1,36 @@ +name: Agency access to the certification package +description: For a federal agency (or FedRAMP) to be put on record, to withdraw, or to ask for the access inventory. The package itself is public and needs no request. +title: "Agency access: " +labels: ["agency-access"] +body: + - type: markdown + attributes: + value: | + **Everything in the certification package is already public** at https://samaydlette.com/trust/ and https://samaydlette.com/.well-known/trust-manifest.json; you do not need to ask to read it. + File this form to put your agency or system **on record** (so you are counted in the access inventory and can be told about changes), to **withdraw** an earlier record, or, for FedRAMP, to **request the inventory**. + This repository is public, so this issue is public. **Name agencies and systems, never people**; do not include names, email addresses or phone numbers. For a private request, use the security contact in `/.well-known/security.txt` instead. + This is a proof of concept with no federal data and no agency sponsor. Procedure: docs/procedures/agency-access.md. + - type: dropdown + id: kind + attributes: + label: Request + options: + - Put my agency or system on record (access) + - Withdraw an earlier record (withdrawal) + - FedRAMP request for the access inventory (inventory-request) + validations: + required: true + - type: input + id: agency + attributes: + label: Agency (or FedRAMP) + validations: + required: true + - type: input + id: system + attributes: + label: System or service (optional) + - type: input + id: withdraws + attributes: + label: For a withdrawal, the earlier request (AAR-...) diff --git a/.github/ISSUE_TEMPLATE/ocr-feedback.yml b/.github/ISSUE_TEMPLATE/ocr-feedback.yml new file mode 100644 index 00000000..a5cb42ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/ocr-feedback.yml @@ -0,0 +1,25 @@ +name: Ongoing Certification Report feedback +description: Ask a question or give feedback about one Ongoing Certification Report (CCM-OCR-FBM). This is public; for anything sensitive, use the security contact in /.well-known/security.txt instead. +title: "OCR feedback: " +labels: ["ocr-feedback"] +body: + - type: markdown + attributes: + value: | + Questions and feedback about an Ongoing Certification Report. Reports are listed at https://samaydlette.com/.well-known/ocr-issues.json. + This channel is public. Each quarter the operator publishes an anonymized summary of the questions and answers in the next report (CCM-OCR-AFS): names, agencies and anything identifying are removed. + Do not include sensitive information here. For anything sensitive, use the security contact in https://samaydlette.com/.well-known/security.txt. + - type: input + id: ocr + attributes: + label: Report issue date + description: The issue date of the report you are asking about (YYYY-MM-DD). Links from a report fill this in. + placeholder: "2026-11-24" + validations: + required: true + - type: textarea + id: question + attributes: + label: Question or feedback + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/quarterly-review-registration.yml b/.github/ISSUE_TEMPLATE/quarterly-review-registration.yml new file mode 100644 index 00000000..d0750d33 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/quarterly-review-registration.yml @@ -0,0 +1,24 @@ +name: Quarterly Review registration +description: Register for a Quarterly Review (CCM-QTR-REG). The operator sends the video-call link to registered parties. This is public; to register privately, use the security contact in /.well-known/security.txt. +title: "Quarterly Review registration: " +labels: ["quarterly-review-registration"] +body: + - type: markdown + attributes: + value: | + Quarterly Reviews follow each Ongoing Certification Report by 5 business days. Dates are in https://samaydlette.com/.well-known/quarterly-review.ics and in the Certification Package Overview. + Reviews are for agencies and FedRAMP; other parties attend only with specific relevance (CCM-QTR-RTP). Registration here is public. To register privately, use the security contact in https://samaydlette.com/.well-known/security.txt. + - type: input + id: review + attributes: + label: Review date + placeholder: "2026-12-02" + validations: + required: true + - type: input + id: organization + attributes: + label: Organization and role in relation to this offering + description: For example, an agency considering the offering, or FedRAMP. + validations: + required: true diff --git a/.github/workflows/availability-probe.yml b/.github/workflows/availability-probe.yml new file mode 100644 index 00000000..602a17b6 --- /dev/null +++ b/.github/workflows/availability-probe.yml @@ -0,0 +1,88 @@ +# ============================================================================= +# Availability probe (CDS-CSO-AVR, CDS-TRC-USH) +# ============================================================================= +# An availability monitor on infrastructure independent of the offering: it +# runs on GitHub Actions, not AWS, probes the core services over HTTPS every 15 +# minutes (scripts/availability-probe.py), keeps 35 days of history, derives +# availability incidents, and publishes JSON + Markdown to the repository's +# `availability-status` branch. GitHub serves that branch, so the status stays +# readable when the offering's CloudFront or S3 is down: +# https://raw.githubusercontent.com/sam-aydlette/samaydlette.com/availability-status/availability-status.json +# https://github.com/sam-aydlette/samaydlette.com/blob/availability-status/availability-status.md +# +# The branch holds one commit, replaced on every run (history lives in the +# JSON), so the repository does not grow by a commit every 15 minutes. The +# workflow's token can write contents (no narrower scope exists); the job only +# ever pushes refs/heads/availability-status, and main is protected by its own +# branch rules. The deploy reads this feed and fails when it is missing or more +# than 2 hours old, so the published package never cites a monitor that has +# stopped (scripts/availability-probe.py --check-fresh). +# +# Caveats stated in the feed: history begins at the first run; GitHub may delay +# a scheduled run under load, and disables schedules on a repository with no +# activity for 60 days (the deploy's freshness check then fails). +# ============================================================================= +name: Availability probe + +on: + schedule: + - cron: '*/15 * * * *' + push: + branches: [main] + workflow_dispatch: + +permissions: {} + +concurrency: + group: availability-probe + cancel-in-progress: false + +jobs: + probe: + name: Probe the core services from outside AWS + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write # push the status branch; nothing else + steps: + - name: Checkout the probe + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: main + persist-credentials: false + + - name: Read the previous status feed + run: | + set -euo pipefail + # Public repository: an anonymous fetch. No branch yet means a first run. + if git fetch --depth 1 --quiet origin availability-status 2>/dev/null; then + git show FETCH_HEAD:availability-status.json > previous-status.json || echo '{}' > previous-status.json + else + echo '{}' > previous-status.json + fi + + - name: Probe the core services + run: python3 scripts/availability-probe.py --previous previous-status.json --out-dir status-out + + - name: Publish the status feed to the availability-status branch + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + run: | + set -euo pipefail + cd status-out + git init --quiet + git checkout --quiet --orphan availability-status + git add availability-status.json availability-status.md + git -c user.name="availability-probe" -c user.email="availability-probe@users.noreply.github.com" \ + commit --quiet -m "Availability status $(jq -r .generated_at availability-status.json)" + auth=$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 -w0) + echo "::add-mask::$auth" + git -c http.extraheader="AUTHORIZATION: basic $auth" \ + push --quiet --force "https://github.com/${REPO}.git" HEAD:refs/heads/availability-status + + # After publishing: an ongoing incident fails the run, and GitHub notifies + # the operator of the failed scheduled run (email). The status is already + # published either way. + - name: Alert on an ongoing availability incident + run: python3 scripts/availability-probe.py --fail-on-incident status-out/availability-status.json diff --git a/.github/workflows/deploy-with-opa.yml b/.github/workflows/deploy-with-opa.yml index a327c2de..754b6fa0 100644 --- a/.github/workflows/deploy-with-opa.yml +++ b/.github/workflows/deploy-with-opa.yml @@ -195,7 +195,13 @@ jobs: run: python3 scripts/_frr.py --complete - name: Python unit tests - run: python3 -m pytest tests/ -q + run: python3 -m pytest tests/ -q --junitxml=pytest-results.xml + + # FRC-CSX-VVR: every test a FedRAMP rule record cites as evidence ran and + # passed in the run above (a skipped or missing one fails too). The result + # per record is signed and published by the deploy as frr-evidence.json. + - name: FedRAMP rule evidence passed (cited tests) + run: python3 scripts/check-frr-evidence.py --junit pytest-results.xml --output frr-evidence.json --commit "${{ github.sha }}" # REQ-GOV-2: run the method's conformance tests (data/method-profile.json # maps Appendix B T1-T74 to the tests that implement them) and record the @@ -211,7 +217,9 @@ jobs: uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: conformance-results - path: conformance-results.json + path: | + conformance-results.json + frr-evidence.json if-no-files-found: error # The policy suite is an exhibit: format is enforced, strict compilation @@ -596,7 +604,7 @@ jobs: # appended here by scripts/_gates.py and published with this run's evidence. env: GATE_EVENTS_FILE: /tmp/gate-events.jsonl - needs: [test, compliance-check, security-scan] + needs: [test, compliance-check, security-scan, simulated-assessor] # IMPORTANT: Only deploy if on main branch AND security check passed if: github.ref == 'refs/heads/main' && needs.compliance-check.outputs.compliant == 'true' environment: ${{ github.event.inputs.environment || 'prod' }} @@ -612,6 +620,17 @@ jobs: with: fetch-depth: 0 + # The package maintenance and quarterly cycle records (CPO-CSX-CPM, + # CCM-OCR-AVL, CDS-CSO-HAD, SDR-CSX-KMT) describe the system after this + # deploy, so it fails here, before anything is applied or built, unless the + # unattended maintainer's role variable and environment are in place. The + # package-maintainer job below then proves the role publishes. + - name: Package maintainer preflight + env: + PACKAGE_MAINTENANCE_ROLE_ARN: ${{ vars.AWS_PACKAGE_MAINTENANCE_ROLE_ARN }} + GITHUB_TOKEN: ${{ github.token }} + run: python3 scripts/check-package-maintainer.py + - name: Setup Terraform uses: hashicorp/setup-terraform@dfe3c3f87815947d99a8997f908cb6525fc44e9e # v4.0.1 with: @@ -695,6 +714,14 @@ jobs: name: conformance-results path: infrastructure/ + # The simulated assessor's signed set (simulated-assessment.json + .bundle), + # verified against the pinned assessor identity when the SDR is built. + - name: Download the simulated assessment + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: simulated-assessment + path: infrastructure/ + # ------------------------------------------------------------------------- # REBUILD MONITORING FUNCTION # ------------------------------------------------------------------------- @@ -1564,49 +1591,193 @@ jobs: - name: Build Ongoing Certification Report (CCM) working-directory: infrastructure run: | - echo "Building Ongoing Certification Report (CCM-OCR-AVL: quarterly human-readable summary)..." + echo "Building Ongoing Certification Report (CCM-OCR-AVL, FedRAMP's OCR schema, fixed CCM calendar)..." + curl -sfL -o previous-ocr.json "https://samaydlette.com/.well-known/ongoing-certification-report.json" \ + || echo '{}' > previous-ocr.json python3 ../scripts/build-ocr.py \ --vdr vdr-report.json \ --decisions ../data/decisions.json \ --ksi-signal ksi-signal.json \ --scn-register ../docs/scn/scn-register.csv \ + --previous previous-ocr.json \ --output ongoing-certification-report.json \ --md-output ongoing-certification-report.md - jq '{next_ongoing_certification_report_date, next_quarterly_review_date}' ongoing-certification-report.json + jq '.providerExtensions.continuousMonitoring | {nextOngoingCertificationReportDate, nextQuarterlyReviewDate}' ongoing-certification-report.json - - name: Build CDS certification-data artifacts (overview, availability, policy index) + # W8 edge checks (FRC-CSO-JSN, CDS-CSO-AVR, CDS-TRC-USH, CDS-TRC-ACL). Each + # depends on something outside this deploy (the operator-applied bootstrap + # stack, or the independent monitor on GitHub Actions) and fails the deploy + # when it is missing, before the SDR says the rule is met. + - name: Check /.well-known/ JSON response headers (CORS, Content-Type, nosniff) + env: + DOMAIN: ${{ vars.DOMAIN_NAME || 'samaydlette.com' }} + run: python3 scripts/check-wellknown-headers.py --site "https://$DOMAIN" + + - name: Read the independent availability feed (fails when missing or stale) working-directory: infrastructure + env: + REPO: ${{ github.repository }} run: | - echo "Building CDS certification-overview package, availability feed, 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 + set -euo pipefail + curl -fsS --max-time 30 -o availability-probe.json \ + "https://raw.githubusercontent.com/$REPO/availability-status/availability-status.json" + python3 ../scripts/availability-probe.py --check-fresh availability-probe.json --max-age-hours 2 + + # The CloudFront access records carry no IP, cookie, query string or user + # agent (the delivery's field allowlist, checked here); only /.well-known/ + # and /trust/ requests are counted, and only monthly aggregates published. + - name: Check edge access logging and build the access summary + working-directory: infrastructure + env: + DOMAIN: ${{ vars.DOMAIN_NAME || 'samaydlette.com' }} + run: | + set -euo pipefail + umask 077 + trap 'rm -rf edge-access-records edge-deliveries.json edge-delivery-source.json' EXIT + name="${DOMAIN//./-}-edge-access" + aws logs describe-deliveries --region us-east-1 --output json > edge-deliveries.json + aws logs get-delivery-source --name "$name" --region us-east-1 --output json > edge-delivery-source.json || true + python3 ../scripts/check-edge-access-logging.py \ + --deliveries edge-deliveries.json --source edge-delivery-source.json --name "$name" + bucket="${DOMAIN//./-}-logs" + account=$(aws sts get-caller-identity --query Account --output text) + aws s3 sync "s3://$bucket/cloudfront/" edge-access-records/cloudfront/ --only-show-errors + aws s3 sync "s3://$bucket/AWSLogs/$account/CloudFront/" edge-access-records/default/ --only-show-errors + curl -fsS --max-time 20 -o previous-access-summary.json "https://$DOMAIN/.well-known/access-summary.json" \ + || echo '{}' > previous-access-summary.json + python3 ../scripts/build-access-summary.py \ + --records edge-access-records --previous previous-access-summary.json + + - name: Build CDS certification-data artifacts (availability, policy index, review calendar) + working-directory: infrastructure + run: | + echo "Building availability feed, policy index, Quarterly Review calendar..." + # CCM-QTR-REG: the review calendar file, from the fixed CCM calendar. + python3 ../scripts/_ccm.py --ics quarterly-review.ics + # Availability as measured by the independent monitor (read and checked above). 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 + --probe-feed availability-probe.json --ksi-signal ksi-signal.json + python3 ../scripts/build-policy-index.py --output policy-index.json --md-output policy-index.md --publish-dir policies + + # The Minimum Assessment Scope (MAS-CSO-IIR/FLO/MDI/TPR, FRC-CSX-MAS), generated + # from this build's inventory, the boundary classification's flows, the CSPs + # the edge serves and the third-party records. Fails the deploy, before the + # SDR, on an unplaced off-origin host, an external service or data store in + # no flow, a data store without a metadata entry, an undecided third-party + # record, or a component type no KSI covers. Signed and published with the + # rest after the gates. + # IVV-CSO-STE / IVV-CSO-DUS: the assessor guide, generated from the rule + # records (the simulated assessor received and ran the same guide before this + # job started). Signed and published with the rest. + - name: Build the assessor guide + working-directory: infrastructure + env: + GITHUB_SHA: ${{ github.sha }} + run: python3 ../scripts/build-assessor-guide.py --commit "$GITHUB_SHA" --output assessor-guide.json --md-output assessor-guide.md + + # CDS-TRC-AAI / CDS-TRC-SSM / CDS-UTC-AAD / CDS-UTC-AGA: the real register + # fails the deploy on a denial not notified to FedRAMP within 5 business + # days; the exercise runs the same code over fictional agencies dated from + # today and fails unless every expected outcome (late and overdue notices + # included) is observed. Nothing is sent to anyone. + - name: Agency access register check and simulated-agency exercise + working-directory: infrastructure + run: | + set -euo pipefail + python3 ../scripts/agency-access.py validate + python3 ../scripts/agency-access.py exercise --output agency-access-exercise.json --md-output agency-access-exercise.md + + - name: Build the Minimum Assessment Scope + working-directory: infrastructure + env: + GITHUB_SHA: ${{ github.sha }} + run: | + python3 ../scripts/build-mas.py --ksi-signal ksi-signal.json --commit "$GITHUB_SHA" \ + --output minimum-assessment-scope.json --md-output minimum-assessment-scope.md + cosign sign-blob --yes --new-bundle-format --bundle minimum-assessment-scope.bundle minimum-assessment-scope.json + + # The Secure Configuration Guide and the per-service cryptographic module + # list (SCG-CSO-RSC/PUB/AUP, SCG-ENH-MRG/API/VRH; CMU-CSO-CMD/UVM/CAT), from + # data/secure-configuration.json and data/crypto-modules.json joined with this + # deploy's inventory. Fails on an unreleased change to a default, a decision + # that is not in force, an inventoried component type with no module mapping, + # or a retired mechanism in the guide. + - name: Build the secure configuration guide (SCG, cryptographic modules) + working-directory: infrastructure + run: | + set -euo pipefail + python3 ../scripts/build-scg.py --ksi-signal ksi-signal.json \ + --output secure-configuration-guide.json --md-output secure-configuration-guide.md + cosign sign-blob --yes --new-bundle-format --bundle secure-configuration-guide.bundle secure-configuration-guide.json + + # SCG-ENH-CMP / SCG-ENH-EXP: read the live settings of the top-level and + # privileged accounts (read-only; the deploy role's secure-configuration-reads + # policy in infrastructure/bootstrap) and compare each with the guide. A + # deviation no in-force decision covers, or a setting that cannot be read, + # fails the deploy here, before the SDR is built and before anything is + # published. The export carries values only: no account ID, ARN or IAM name. + - name: Compare live security settings with the secure configuration guide + working-directory: infrastructure + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + pool=$(terraform output -raw cognito_user_pool_id) + python3 ../scripts/check-secure-config.py --cognito-pool-id "$pool" \ + --output security-settings.json --md-output security-settings.md + cosign sign-blob --yes --new-bundle-format --bundle security-settings.bundle security-settings.json - name: Build Security Decision Record (SDR — 20x SSP replacement) working-directory: infrastructure run: | - echo "Building Security Decision Record (SDR-CSO-FRR per KSI, SDR-CSF-CTF per Rev5 control) from the control projection..." + echo "Building the Security Decision Record (FedRAMP schema): every applicable rule, KSI and Moderate control..." curl -sfL -o previous-sdr.json "https://samaydlette.com/.well-known/security-decision-record.json" \ || echo '{}' > previous-sdr.json python3 ../scripts/build-sdr.py \ --catalog schemas/ksi-catalog.json --ksi-signal ksi-signal.json \ - --vdr vdr-report.json --profile ../data/system-profile.json --previous-sdr previous-sdr.json + --runtime-signal ksi-signal-runtime.json \ + --vdr vdr-report.json --profile ../data/system-profile.json --previous-sdr previous-sdr.json \ + --assessment simulated-assessment.json --assessment-bundle simulated-assessment.bundle # REQ-ASR-1 / T74: re-read the written SDR and fail if any assessor text # differs from the assessor's signed record, or a signed record is missing. - python3 ../scripts/_assessor.py --sdr security-decision-record.json + python3 ../scripts/_assessor.py --sdr security-decision-record.json \ + --assessment simulated-assessment.json --assessment-bundle simulated-assessment.bundle - name: Build Certification Package Overview (CPO) working-directory: infrastructure run: | - echo "Building Certification Package Overview (CPO-CSO-OVR); with the SDR, the SSP replacement..." + echo "Building Certification Package Overview (CPO-CSO-OVR, FedRAMP's CPO schema); with the SDR, the SSP replacement..." + curl -sfL -o previous-cpo.json "https://samaydlette.com/.well-known/certification-package-overview.json" \ + || echo '{}' > previous-cpo.json 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 --previous-cpo previous-cpo.json \ + --assessment simulated-assessment.json --assessment-bundle simulated-assessment.bundle + + # CDS-CSO-FRC: every FedRAMP Certification Report received is published + # unmodified (its sha256 is checked against the register) with the days + # from receipt to publication. FedRAMP is SIMULATED: the one report is a + # plainly fake stand-in. Nothing is received from or sent to FedRAMP. + - name: FedRAMP Certification Reports published unmodified (simulated FedRAMP) + working-directory: infrastructure + run: | + curl -sfL -o previous-fedramp-certification-reports.json \ + "https://samaydlette.com/.well-known/fedramp-certification-reports.json" \ + || echo '{}' > previous-fedramp-certification-reports.json + python3 ../scripts/publish-certification-reports.py --previous previous-fedramp-certification-reports.json --out . + + # FRC-CSO-PKG: the package (CPO, SDR, OCR) is checked against its schemas + # and the applicable rules, and "submitted" to a simulated FedRAMP intake: a + # function in scripts/submit-package.py. NOTHING IS SENT; the submission is + # an entry in the signed, published log. Any unexpected outcome fails here. + - name: Simulated package submission to FedRAMP (nothing is sent) + working-directory: infrastructure + run: | + curl -sfL -o previous-package-submission-log.json \ + "https://samaydlette.com/.well-known/package-submission-log.json" \ + || rm -f previous-package-submission-log.json + python3 ../scripts/submit-package.py --previous previous-package-submission-log.json \ + --output package-submission-log.json --commit "$GITHUB_SHA" # The authorization-boundary map the trust center draws: the inventory's # components placed by docs/boundary/boundary-classification.json, connected @@ -1695,11 +1866,40 @@ 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 cosign sign-blob --yes --new-bundle-format --bundle certification-package-overview.bundle certification-package-overview.json + cosign sign-blob --yes --new-bundle-format --bundle fedramp-certification-reports.bundle fedramp-certification-reports.json + cosign sign-blob --yes --new-bundle-format --bundle package-submission-log.bundle package-submission-log.json + cosign sign-blob --yes --new-bundle-format --bundle access-summary.bundle access-summary.json + + # CDS-TRC-HMR / CDS-CSO-CBF / CDS-TRC-PAC: a complete human-readable view + # of every JSON and CSV artifact this deploy publishes, each parsed back and + # required to reproduce its original exactly (the build fails otherwise), + # then the signed manifest of all certification data. published-docs.txt + # lists the views and the policy documents; the redaction gate scans and + # the publish step uploads exactly that list. + - name: Build the human-readable views and the trust manifest (format parity) + working-directory: infrastructure + env: + GITHUB_SHA: ${{ github.sha }} + run: | + set -euo pipefail + : > published-docs.txt + ls policies/*.md >> published-docs.txt + python3 ../scripts/build-human-views.py --freshness schemas/freshness-config.json --dir . --list published-docs.txt + python3 ../scripts/build-trust-manifest.py --dir . --policy-index policy-index.json --commit "$GITHUB_SHA" \ + --output trust-manifest.json --md-output trust-manifest.md + python3 ../scripts/build-human-views.py trust-manifest.json --list published-docs.txt + + # CDS-CSO-FID: every FedRAMP report this deploy publishes carries the + # offering's FedRAMP ID (scripts/check-fedramp-id.py REPORTS lists them). + # Runs once every listed file is built (the trust center and manifest are + # the last), and before anything is published. + - name: FedRAMP ID in every FedRAMP report (CDS-CSO-FID) + working-directory: infrastructure + run: python3 ../scripts/check-fedramp-id.py - name: Sign trust-center artifacts (boundary map, gate report, trust center) working-directory: infrastructure @@ -1711,6 +1911,11 @@ jobs: if [ -f boundary-corroboration.json ]; then cosign sign-blob --yes --new-bundle-format --bundle boundary-corroboration.bundle boundary-corroboration.json fi + # The simulated assessment arrives signed by the assessor's own identity + # and is published with that bundle, never re-signed here. + for a in assessor-guide agency-access-exercise frr-evidence trust-manifest; do + cosign sign-blob --yes --new-bundle-format --bundle "$a.bundle" "$a.json" + done # Publication redaction gate: no artifact this run is about to publish # carries an AWS account ID. The inventory builder redacts it @@ -1727,11 +1932,18 @@ jobs: for a in vdr-detail-report vdr-accepted-vulnerabilities vdr-history; do files="$files $a.json"; done for a in vdr-detail-report vdr-accepted-vulnerabilities; do files="$files $a.md"; done files="$files ongoing-certification-report.json ongoing-certification-report.md" - for a in certification-overview-package availability policy-index security-decision-record certification-package-overview; do files="$files $a.json $a.md"; done + for a in availability policy-index security-decision-record certification-package-overview secure-configuration-guide security-settings; do files="$files $a.json $a.md"; done + for a in access-summary; do files="$files $a.json $a.md"; done + for a in assessor-guide agency-access-exercise trust-manifest; do files="$files $a.json $a.md"; done + files="$files frr-evidence.json simulated-assessment.json" + # The human-readable views and the policy documents (the list the publish step uploads). + if [ -f published-docs.txt ]; then files="$files $(cat published-docs.txt)"; fi + files="$files fedramp-certification-reports.json package-submission-log.json quarterly-review.ics" for a in boundary-map reconcile-report trust-center conformance-results boundary-corroboration; do [ -f "$a.json" ] || continue files="$files $a.json" done + files="$files minimum-assessment-scope.json minimum-assessment-scope.md" # shellcheck disable=SC2086 # a word list by design python3 ../scripts/check-published-redaction.py $files @@ -1774,7 +1986,8 @@ jobs: # SDR (per-KSI and per-Rev5-control records) and CPO on 2026-11-05. Their # published copies are deleted rather than left to go stale unwatched; # the round-trip step below asserts they are gone. - for retired in oscal-poam.json oscal-poam.bundle oscal-poam.json.intoto.jsonl oscal-ssp.json oscal-ssp.bundle oscal-ssp.json.intoto.jsonl; do + # The CDS certification-overview package folded into the CPO on 2026-11-05. + for retired in oscal-poam.json oscal-poam.bundle oscal-poam.json.intoto.jsonl oscal-ssp.json oscal-ssp.bundle oscal-ssp.json.intoto.jsonl certification-overview-package.json certification-overview-package.bundle certification-overview-package.md; do aws s3 rm "s3://$BUCKET_NAME/.well-known/$retired" done # Ongoing Certification Report (CCM-OCR-AVL) + human-readable rendering @@ -1782,11 +1995,24 @@ jobs: aws s3 cp ongoing-certification-report.bundle "s3://$BUCKET_NAME/.well-known/ongoing-certification-report.bundle" --content-type application/json --cache-control "public, max-age=300" aws s3 cp ongoing-certification-report.md "s3://$BUCKET_NAME/.well-known/ongoing-certification-report.md" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" # CDS certification-data artifacts (overview package, availability feed, policy index) + bundles + human-readable - for a in certification-overview-package availability policy-index security-decision-record certification-package-overview; do + for a in availability policy-index security-decision-record certification-package-overview secure-configuration-guide security-settings; do aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" aws s3 cp "$a.md" "s3://$BUCKET_NAME/.well-known/$a.md" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" done + # Trust-center access summary (CDS-TRC-ACL): aggregate counts only. + for a in access-summary; do + aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.md" "s3://$BUCKET_NAME/.well-known/$a.md" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" + done + # CDS-CSO-FRC index and the simulated FRC-CSO-PKG submission log (signed), and + # the Quarterly Review calendar file (CCM-QTR-REG). + for a in fedramp-certification-reports package-submission-log; do + aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" + done + aws s3 cp quarterly-review.ics "s3://$BUCKET_NAME/.well-known/quarterly-review.ics" --content-type "text/calendar; charset=utf-8" --cache-control "public, max-age=300" # Trust center: the generated boundary map, the gate's own report (it exists # only because the gate above passed) and the trust center's data. for a in boundary-map reconcile-report trust-center conformance-results boundary-corroboration; do @@ -1794,8 +2020,48 @@ jobs: aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" done + # Minimum Assessment Scope (MAS-CSO-IIR/FLO/MDI/TPR) + bundle + human-readable + aws s3 cp minimum-assessment-scope.json "s3://$BUCKET_NAME/.well-known/minimum-assessment-scope.json" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp minimum-assessment-scope.bundle "s3://$BUCKET_NAME/.well-known/minimum-assessment-scope.bundle" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp minimum-assessment-scope.md "s3://$BUCKET_NAME/.well-known/minimum-assessment-scope.md" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" + # Trust-center data: the assessor guide, the agency access exercise and + # the manifest (JSON, signature, Markdown); the per-rule evidence result; + # the simulated assessor's set with ITS bundle (signed by the assessor's + # identity, not this workflow's). + for a in assessor-guide agency-access-exercise trust-manifest; do + aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.md" "s3://$BUCKET_NAME/.well-known/$a.md" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" + done + for a in frr-evidence simulated-assessment; do + aws s3 cp "$a.json" "s3://$BUCKET_NAME/.well-known/$a.json" --content-type application/json --cache-control "public, max-age=300" + aws s3 cp "$a.bundle" "s3://$BUCKET_NAME/.well-known/$a.bundle" --content-type application/json --cache-control "public, max-age=300" + done + # The complete human-readable views and the policies and procedures. + while read -r f; do + aws s3 cp "$f" "s3://$BUCKET_NAME/.well-known/$f" --content-type "text/markdown; charset=utf-8" --cache-control "public, max-age=300" + done < published-docs.txt echo "✅ All signed artifacts published to /.well-known/ (post-gate)" + # CDS-CSO-FRC: each FedRAMP Certification Report exactly as received (data + # committed byte for byte; its sha256 checked against the register when the + # index was built), and read back from the origin to prove the served bytes + # are unmodified. Separate from the step above because the files are named + # by the register, not by this workflow. Simulated FedRAMP: see the index. + - name: Publish FedRAMP Certification Reports byte-identical + working-directory: infrastructure + run: | + set -euo pipefail + BUCKET_NAME=$(terraform output -raw s3_bucket_name) + python3 ../scripts/check-published-redaction.py fedramp-certification-reports/* + jq -r '.reports[] | "\(.file) \(.sha256)"' fedramp-certification-reports.json | while read -r f sha; do + aws s3 cp "fedramp-certification-reports/$f" "s3://$BUCKET_NAME/.well-known/fedramp-certification-reports/$f" \ + --content-type application/json --cache-control "public, max-age=300" + got=$(aws s3 cp "s3://$BUCKET_NAME/.well-known/fedramp-certification-reports/$f" - | sha256sum | awk '{print $1}') + [ "$got" = "$sha" ] || { echo "::error::$f served bytes differ from the report as received"; exit 1; } + echo "published unmodified: fedramp-certification-reports/$f" + done + # ------------------------------------------------------------------------- # ATTEST ARTIFACT PROVENANCE (SLSA v1 / in-toto, DSSE — Task 14 / S2) # ------------------------------------------------------------------------- @@ -1872,11 +2138,13 @@ jobs: check "$a.json" ".well-known/$a.json" done check ongoing-certification-report.json .well-known/ongoing-certification-report.json - check certification-overview-package.json .well-known/certification-overview-package.json check availability.json .well-known/availability.json check policy-index.json .well-known/policy-index.json check security-decision-record.json .well-known/security-decision-record.json check certification-package-overview.json .well-known/certification-package-overview.json + check fedramp-certification-reports.json .well-known/fedramp-certification-reports.json + check package-submission-log.json .well-known/package-submission-log.json + check quarterly-review.ics .well-known/quarterly-review.ics check iiw.csv .well-known/iiw.csv check boundary-map.json .well-known/boundary-map.json check reconcile-report.json .well-known/reconcile-report.json @@ -1889,7 +2157,7 @@ jobs: done # Retired artifacts must be gone from the origin. Only a 404 counts as # gone: any other error (e.g. AccessDenied) fails rather than passing. - for retired in oscal-poam.json oscal-poam.bundle oscal-poam.json.intoto.jsonl oscal-ssp.json oscal-ssp.bundle oscal-ssp.json.intoto.jsonl; do + for retired in oscal-poam.json oscal-poam.bundle oscal-poam.json.intoto.jsonl oscal-ssp.json oscal-ssp.bundle oscal-ssp.json.intoto.jsonl certification-overview-package.json certification-overview-package.bundle certification-overview-package.md; do if head_err=$(aws s3api head-object --bucket "$BUCKET_NAME" --key ".well-known/$retired" 2>&1 >/dev/null); then echo "::error::retired artifact still published: .well-known/$retired"; fail=1 elif printf '%s' "$head_err" | grep -q '(404)'; then @@ -2069,6 +2337,23 @@ jobs: if: always() run: rm -f infrastructure/tfstate-bootstrap.json + # =========================================================================== + # SIMULATED ASSESSOR (not a FedRAMP Recognized assessment) + # =========================================================================== + # "Totally Real Assessment Services, LLC (simulated)" verifies and validates + # every rule and KSI from the assessor guide and signs its record under its + # own workflow identity (a reusable workflow, so the certificate names + # simulated-assessor.yml). Runs where the deploy runs; the deploy needs it, and + # the SDR build fails without its signed set. + simulated-assessor: + name: Simulated assessor + needs: [test, compliance-check] + if: github.ref == 'refs/heads/main' && needs.compliance-check.outputs.compliant == 'true' + permissions: + contents: read + id-token: write + uses: ./.github/workflows/simulated-assessor.yml + # =========================================================================== # JOB 3: EXTRA SECURITY SCANS # =========================================================================== @@ -2180,11 +2465,27 @@ jobs: # which is functionally the same as no alert: nothing distinguishes the one # that matters. It now reuses a single issue, reopening and commenting, and # assigns it to the repository owner so it reaches a person. + # CPO-CSX-CPM: after every successful deploy, the unattended package + # maintainer runs once, so a green deploy proves it verifies the just-published + # package, rebuilds it at the deployed commit and publishes with its own role. + package-maintainer: + name: Prove the certification package maintainer + needs: [deploy] + if: needs.deploy.result == 'success' + permissions: + contents: read + id-token: write + issues: write + uses: ./.github/workflows/package-maintenance.yml + # Least privilege: the one secret the maintainer uses, not `inherit`. + secrets: + CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} + notify: name: Notify on Failure runs-on: ubuntu-latest - needs: [compliance-check, deploy] - if: always() && (needs.compliance-check.result == 'failure' || needs.deploy.result == 'failure') + needs: [compliance-check, deploy, package-maintainer] + if: always() && (needs.compliance-check.result == 'failure' || needs.deploy.result == 'failure' || needs.package-maintainer.result == 'failure') permissions: contents: read issues: write diff --git a/.github/workflows/evidence-nightly.yml b/.github/workflows/evidence-nightly.yml index 044323d1..b51f77e3 100644 --- a/.github/workflows/evidence-nightly.yml +++ b/.github/workflows/evidence-nightly.yml @@ -448,14 +448,17 @@ jobs: # ------------------------------------------------------------------------- # scripts/reconcile.py loads the signal, VDR, SDR and CPO and reads the # decision register from the checkout. The SDR and CPO are the ones the last - # reviewed deploy published with this inventory; they arrive over the public - # internet, so each is verified against the deploy workflow's pinned identity - # before use, exactly like the inventory above. Fail closed: an unverifiable + # reviewed deploy published with this inventory (or the daily package + # maintainer rebuilt from it); they arrive over the public internet, so each + # is verified against one of those two pinned identities before use, exactly like the inventory above. Fail closed: an unverifiable # artifact is not evidence. They are not re-signed or re-published here. - name: Fetch and verify the published SDR and CPO (reconciliation inputs) working-directory: infrastructure run: | set -euo pipefail + # Signed by the deploy, or by the daily package maintainer that rebuilds + # them at the deployed commit (package-maintenance.yml, CPO-CSX-CPM). + MAINTAINER_IDENTITY="https://github.com/${{ github.repository }}/.github/workflows/package-maintenance.yml@refs/heads/main" for art in security-decision-record certification-package-overview; do curl -sfL --retry 3 --retry-delay 5 -o "$art.json" "${SITE_ORIGIN}/.well-known/$art.json" curl -sfL --retry 3 --retry-delay 5 -o "$art.bundle" "${SITE_ORIGIN}/.well-known/$art.bundle" @@ -463,6 +466,11 @@ jobs: --bundle "$art.bundle" \ --certificate-identity "${DEPLOY_SIGNER_IDENTITY}" \ --certificate-oidc-issuer "${COSIGN_OIDC_ISSUER}" \ + "$art.json" \ + || cosign verify-blob \ + --bundle "$art.bundle" \ + --certificate-identity "${MAINTAINER_IDENTITY}" \ + --certificate-oidc-issuer "${COSIGN_OIDC_ISSUER}" \ "$art.json" done @@ -694,6 +702,15 @@ jobs: # SSE-S3 (AES256), so no KMS grant is involved. # Publication redaction gate over exactly the files the next step uploads # (scripts/_redact.py): fails closed on any AWS account ID. + # CDS-CSO-CBF: the complete human-readable view of each JSON republished + # below, parsed back and required to reproduce it, so the views the deploy + # published never drift from the JSON this run replaces. + - name: Rebuild the human-readable views (format parity) + working-directory: infrastructure + run: >- + python3 ../scripts/build-human-views.py + vdr-report.json vdr-trend.json vdr-detail-report.json vdr-accepted-vulnerabilities.json vdr-history.json + - name: Publication redaction gate (no AWS account ID) working-directory: infrastructure run: >- @@ -701,6 +718,8 @@ jobs: vdr-report.json vdr-report.md vdr-trend.json vdr-detail-report.json vdr-detail-report.md vdr-accepted-vulnerabilities.json vdr-accepted-vulnerabilities.md vdr-history.json + vdr-report.view.md vdr-trend.view.md vdr-detail-report.view.md + vdr-accepted-vulnerabilities.view.md vdr-history.view.md - name: Publish VDR + trend to /.well-known/ id: publish @@ -729,6 +748,10 @@ jobs: done put vdr-detail-report.md "text/markdown; charset=utf-8" put vdr-accepted-vulnerabilities.md "text/markdown; charset=utf-8" + # The complete human-readable views, rebuilt with the JSON above. + for a in vdr-report vdr-trend vdr-detail-report vdr-accepted-vulnerabilities vdr-history; do + put "$a.view.md" "text/markdown; charset=utf-8" + done # The refreshed provenance attestation. Its key matches the same # `.well-known/vdr-*` prefix, so it needs no extra IAM grant. put vdr-report.json.intoto.jsonl "application/json" diff --git a/.github/workflows/package-maintenance.yml b/.github/workflows/package-maintenance.yml new file mode 100644 index 00000000..ff28a148 --- /dev/null +++ b/.github/workflows/package-maintenance.yml @@ -0,0 +1,356 @@ +# ============================================================================= +# GitHub Actions Workflow: Certification Package Maintenance (CPO-CSX-CPM) +# ============================================================================= +# FedRAMP 20x Class C: keep the certification package up to date at least every +# two weeks (CPO-CSX-CPM), keep daily KSI metric data (SDR-CSX-KMT), and issue +# the Ongoing Certification Report on its calendar date with a snapshot of the +# package (CCM-OCR-AVL/SOR, CDS-CSO-HAD). The deploy is behind a human reviewer +# and keeps none of those dates, so this runs daily, unattended: +# +# daily cron, or by hand, or called by every deploy after it succeeds +# -> fetch the published inputs and verify every signature (fail closed): +# the KSI signal (deploy), the VDR (deploy or nightly), and the copies +# this run replaces (CPO, SDR, OCR: deploy or this workflow) +# -> check out the commit the published inventory was built from, so the +# rebuild describes the deployed system, not an undeployed main +# -> rebuild the SDR (one more daily metric point), the OCR and the CPO, +# each validated against FedRAMP's schema; write the review calendar; +# on or after an issue date not yet issued, freeze that report and +# snapshot the package (scripts/issue-ocr.py) +# -> FedRAMP ID, sensitivity and redaction gates; sign; attest the SDR +# -> refuse to overwrite an issued report; publish; invalidate; verify the +# edge serves what was built +# +# THE TRADE, as for the evidence nightly: an unattended production write. Its +# role (infrastructure/bootstrap/package-maintenance.tf, operator-applied) can +# put the package objects listed there and invalidate the CDN, and nothing else: +# no Terraform, no website sync, no delete, no read. +# ============================================================================= + +name: Certification Package Maintenance + +on: + workflow_dispatch: + # Called by every deploy (deploy-with-opa.yml, job package-maintainer) after + # the deploy job succeeds, so a green deploy proves this maintainer verifies, + # rebuilds and publishes with its own role. + workflow_call: + secrets: + CLOUDFRONT_DISTRIBUTION_ID: + required: true + schedule: + - cron: '37 9 * * *' + +concurrency: + group: package-maintenance + cancel-in-progress: false + +permissions: + contents: read + +env: + AWS_REGION: us-east-2 + OPA_VERSION: 1.18.2 + OPA_SHA256: 9903e5125ac281104f2c4b7371d10cc3b74a98933743fcbfc174f9bf0ab20de8 + SITE_BUCKET: samaydlette.com + SITE_ORIGIN: https://samaydlette.com + COSIGN_OIDC_ISSUER: https://token.actions.githubusercontent.com + ID_DEPLOY: https://github.com/sam-aydlette/samaydlette.com/.github/workflows/deploy-with-opa.yml@refs/heads/main + ID_NIGHTLY: https://github.com/sam-aydlette/samaydlette.com/.github/workflows/evidence-nightly.yml@refs/heads/main + ID_MAINTENANCE: https://github.com/sam-aydlette/samaydlette.com/.github/workflows/package-maintenance.yml@refs/heads/main + +jobs: + maintain: + name: Rebuild, sign and publish the certification package + runs-on: ubuntu-latest + timeout-minutes: 25 + # No required reviewer: the dates run while nobody is awake. The role this + # environment can assume writes only the package objects. + environment: package-maintenance + outputs: + publish: ${{ steps.publish.outcome }} + permissions: + contents: read + id-token: write + + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Install cosign + uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1 + + - name: Setup OPA + run: | + curl -fL --retry 5 --retry-delay 5 --connect-timeout 10 --max-time 120 \ + -o opa "https://openpolicyagent.org/downloads/v${{ env.OPA_VERSION }}/opa_linux_amd64_static" + echo "${{ env.OPA_SHA256 }} opa" | sha256sum -c - + chmod 755 ./opa + sudo mv opa /usr/local/bin + + # Everything arrives over the public internet, so nothing is used before its + # signature checks out against the workflows allowed to have signed it. The + # published CPO, SDR and OCR are the copies this run replaces: they must be + # signed by the deploy or by this workflow, or the run stops. + - name: Fetch and verify the published package and its inputs + run: | + set -euo pipefail + mkdir -p work + cd work + fetch() { curl -sfL --retry 3 --retry-delay 5 -o "$1" "${SITE_ORIGIN}/.well-known/$1"; } + verify() { # verify ... + f="$1"; b="$2"; shift 2 + for id in "$@"; do + if cosign verify-blob --bundle "$b" --certificate-identity "$id" \ + --certificate-oidc-issuer "${COSIGN_OIDC_ISSUER}" "$f" 2>/dev/null; then return 0; fi + done + echo "::error::$f does not verify against the identities allowed to sign it; refusing to use it" + return 1 + } + fetch ksi-signal.json; fetch ksi-signal.bundle + verify ksi-signal.json ksi-signal.bundle "$ID_DEPLOY" + for a in vdr-report vdr-detail-report vdr-accepted-vulnerabilities vdr-history; do + fetch "$a.json"; fetch "$a.bundle"; verify "$a.json" "$a.bundle" "$ID_DEPLOY" "$ID_NIGHTLY" + done + for a in security-decision-record certification-package-overview ongoing-certification-report; do + fetch "$a.json"; fetch "$a.bundle"; fetch "$a.md" + verify "$a.json" "$a.bundle" "$ID_DEPLOY" "$ID_MAINTENANCE" + done + for a in boundary-map policy-index availability trust-center fedramp-certification-reports package-submission-log; do + fetch "$a.json"; fetch "$a.bundle"; verify "$a.json" "$a.bundle" "$ID_DEPLOY" + done + fetch iiw.csv; fetch iiw.bundle; verify iiw.csv iiw.bundle "$ID_DEPLOY" + # The simulated assessor's signed set: verified by the builders below + # (scripts/_assessor.py) against the pinned assessor identity. + fetch simulated-assessment.json || rm -f simulated-assessment.json + fetch simulated-assessment.bundle || rm -f simulated-assessment.bundle + # The issue index exists once this workflow has run; before that, none. + # Only a definite "not there" starts a new one; any other failure stops + # the run rather than rebuild the index without its earlier issues. + code=$(curl -s -o /dev/null -w '%{http_code}' "${SITE_ORIGIN}/.well-known/ocr-issues.json") + if [ "$code" = "404" ] || [ "$code" = "403" ]; then + echo "No published issue index yet; starting one." + else + fetch ocr-issues.json; fetch ocr-issues.bundle + verify ocr-issues.json ocr-issues.bundle "$ID_MAINTENANCE" + fi + # Verified in-band by build-sdr.py against the committed runtime key. + fetch ksi-signal-runtime.json || rm -f ksi-signal-runtime.json + SIGNAL_COMMIT=$(jq -r '.provenance.source.commit' ksi-signal.json) + if ! printf '%s' "$SIGNAL_COMMIT" | grep -qE '^[0-9a-f]{40}$'; then + echo "::error::published inventory carries a malformed commit id"; exit 1 + fi + echo "SIGNAL_COMMIT=${SIGNAL_COMMIT}" >> "$GITHUB_ENV" + + # Rebuild at the deployed commit: the records, registers and builders that + # the published inventory was built with. A commit that is not on main is + # not this repository's deployed state. + - name: Check out the deployed commit + run: | + set -euo pipefail + git merge-base --is-ancestor "$SIGNAL_COMMIT" origin/main || { + echo "::error::the published inventory's commit is not on main"; exit 1; } + git checkout -q --detach "$SIGNAL_COMMIT" + for f in scripts/issue-ocr.py scripts/build-cpo.py scripts/build-ocr.py scripts/build-sdr.py; do + [ -f "$f" ] || { echo "::error::the deployed commit has no $f"; exit 1; } + done + + - name: Rebuild the SDR, OCR and CPO at the deployed commit + working-directory: infrastructure + run: | + set -euo pipefail + W=../work + mkdir -p out + # The simulated assessor's set, for the SDR, the T74 re-check and the + # CPO summary. A deployed commit from before the assessor existed has + # builders that take no such argument; it is rebuilt as it was deployed. + # shellcheck disable=SC2086 # $ASSESSMENT is a word list by design + ASSESSMENT="" + if grep -q -- '--assessment-bundle' ../scripts/build-cpo.py; then + ASSESSMENT="--assessment $W/simulated-assessment.json --assessment-bundle $W/simulated-assessment.bundle" + fi + cp "$W/ksi-signal.json" "$W/vdr-report.json" . + [ -f "$W/ksi-signal-runtime.json" ] && cp "$W/ksi-signal-runtime.json" . + python3 ../scripts/build-sdr.py \ + --catalog schemas/ksi-catalog.json --ksi-signal ksi-signal.json \ + --runtime-signal ksi-signal-runtime.json --vdr vdr-report.json --profile ../data/system-profile.json \ + --previous-sdr "$W/security-decision-record.json" \ + --output out/security-decision-record.json --md-output out/security-decision-record.md \ + $ASSESSMENT + python3 ../scripts/_assessor.py --sdr out/security-decision-record.json \ + $ASSESSMENT + python3 ../scripts/build-ocr.py --vdr vdr-report.json --decisions ../data/decisions.json \ + --ksi-signal ksi-signal.json --scn-register ../docs/scn/scn-register.csv \ + --previous "$W/ongoing-certification-report.json" \ + --output out/ongoing-certification-report.json --md-output out/ongoing-certification-report.md + python3 ../scripts/build-cpo.py --offering ../data/cds/offering.json --profile ../data/system-profile.json \ + --ksi-signal ksi-signal.json --previous-cpo "$W/certification-package-overview.json" \ + --output out/certification-package-overview.json --md-output out/certification-package-overview.md \ + $ASSESSMENT + python3 ../scripts/_ccm.py --ics out/quarterly-review.ics + + # The snapshot is the package as published at issue time: the verified + # copies fetched above, with this run's rebuilt CPO, SDR and OCR and their + # signatures (signed first, so the snapshot holds signed files). + - name: Sign the rebuilt reports + working-directory: infrastructure/out + run: | + set -euo pipefail + for a in security-decision-record certification-package-overview ongoing-certification-report; do + cosign sign-blob --yes --new-bundle-format --bundle "$a.bundle" "$a.json" + done + + - name: Issue the quarterly report when due (frozen, with a snapshot) + working-directory: infrastructure + run: | + set -euo pipefail + W=../work + cp out/*.json out/*.md out/*.bundle "$W/" + prev="" + [ -f "$W/ocr-issues.json" ] && prev="--previous-index $W/ocr-issues.json" + # shellcheck disable=SC2086 + python3 ../scripts/issue-ocr.py --work "$W" --out out $prev --new-files out/issued.txt \ + --vdr vdr-report.json --ksi-signal ksi-signal.json + cat out/issued.txt + + - name: Gates (FedRAMP ID, redaction) + working-directory: infrastructure/out + run: | + set -euo pipefail + python3 ../../scripts/check-fedramp-id.py security-decision-record.json \ + certification-package-overview.json ongoing-certification-report.json ocr-issues.json \ + $(grep -E '^(ocr-issue-.*\.json|snapshot-.*\.json)$' issued.txt || true) + # shellcheck disable=SC2046 + python3 ../../scripts/check-published-redaction.py security-decision-record.json security-decision-record.md \ + certification-package-overview.json certification-package-overview.md \ + ongoing-certification-report.json ongoing-certification-report.md ocr-issues.json quarterly-review.ics \ + $(grep -E '^(ocr-issue-|snapshot-)' issued.txt || true) + + - name: Sign the issue index and new issues; attest the SDR + working-directory: infrastructure/out + run: | + set -euo pipefail + cosign sign-blob --yes --new-bundle-format --bundle ocr-issues.bundle ocr-issues.json + for f in $(grep -E '^(ocr-issue-.*|snapshot-.*)\.json$' issued.txt || true); do + cosign sign-blob --yes --new-bundle-format --bundle "${f%.json}.bundle" "$f" + echo "${f%.json}.bundle" >> issued.txt + done + python3 ../../scripts/build-provenance.py --ksi-signal ../ksi-signal.json \ + --generator ../../scripts/build-sdr.py --output sdr.predicate.json + cosign attest-blob --yes --new-bundle-format --predicate sdr.predicate.json --type slsaprovenance1 \ + --bundle security-decision-record.json.intoto.jsonl security-decision-record.json + cosign verify-blob-attestation --new-bundle-format --bundle security-decision-record.json.intoto.jsonl \ + --type slsaprovenance1 --certificate-identity "$ID_MAINTENANCE" \ + --certificate-oidc-issuer "${COSIGN_OIDC_ISSUER}" security-decision-record.json + python3 ../../scripts/verify-attestation.py --bundle security-decision-record.json.intoto.jsonl \ + --artifact security-decision-record.json --ksi-signal ../ksi-signal.json + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0 + timeout-minutes: 6 + with: + # Defined in infrastructure/bootstrap/package-maintenance.tf; the deploy's + # preflight fails while it is unset. + role-to-assume: ${{ vars.AWS_PACKAGE_MAINTENANCE_ROLE_ARN }} + aws-region: ${{ env.AWS_REGION }} + retry-max-attempts: 5 + + - name: Publish the certification package to /.well-known/ + id: publish + working-directory: infrastructure/out + run: | + set -euo pipefail + put() { + aws s3api put-object --bucket "${SITE_BUCKET}" --key ".well-known/$1" --body "$1" \ + --content-type "$2" --cache-control "public, max-age=300" --query 'ETag' --output text > /dev/null + echo "published .well-known/$1" + } + ctype() { + case "$1" in + *.md) echo "text/markdown; charset=utf-8" ;; + *.ics) echo "text/calendar; charset=utf-8" ;; + *.csv) echo "text/csv" ;; + *) echo "application/json" ;; + esac + } + # An issued report and its snapshot are never rewritten. + while read -r f; do + [ -n "$f" ] || continue + code=$(curl -s -o /dev/null -w '%{http_code}' "${SITE_ORIGIN}/.well-known/$f") + if [ "$code" != "404" ] && [ "$code" != "403" ]; then + echo "::error::.well-known/$f is already served (HTTP $code): issued files are never overwritten"; exit 1 + fi + done < issued.txt + while read -r f; do [ -n "$f" ] && put "$f" "$(ctype "$f")"; done < issued.txt + for a in security-decision-record certification-package-overview ongoing-certification-report; do + put "$a.md" "text/markdown; charset=utf-8" + put "$a.bundle" application/json + put "$a.json" application/json + done + put security-decision-record.json.intoto.jsonl application/json + put quarterly-review.ics "text/calendar; charset=utf-8" + put ocr-issues.bundle application/json + put ocr-issues.json application/json + + - name: Invalidate CloudFront cache (package paths only) + env: + DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} + run: | + set -euo pipefail + aws cloudfront create-invalidation --distribution-id "${DISTRIBUTION_ID}" \ + --paths "/.well-known/security-decision-record*" "/.well-known/certification-package-overview*" \ + "/.well-known/ongoing-certification-report*" "/.well-known/ocr-issue*" \ + "/.well-known/quarterly-review.ics" --query 'Invalidation.Id' --output text + + - name: Assert the edge serves the rebuilt package + run: | + set -euo pipefail + for a in security-decision-record certification-package-overview ongoing-certification-report ocr-issues; do + python3 scripts/check-evidence-freshness.py --url "${SITE_ORIGIN}/.well-known/$a.json" \ + --expect-sha256 "$(sha256sum "infrastructure/out/$a.json" | awk '{print $1}')" \ + --retries 12 --retry-delay 20 + done + + alert: + name: Alert on package maintenance + runs-on: ubuntu-latest + needs: [maintain] + if: always() && needs.maintain.result == 'failure' + permissions: + contents: read + issues: write + steps: + - name: Raise or update the package-maintenance issue + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + env: + PUBLISH: ${{ needs.maintain.outputs.publish }} + with: + script: | + const TITLE = 'Certification package maintenance failed'; + const runUrl = `${context.payload.repository.html_url}/actions/runs/${context.runId}`; + const body = [ + `The certification package maintenance run failed ([run](${runUrl}), trigger \`${context.eventName}\`, publish \`${process.env.PUBLISH || 'not reached'}\`).`, + ``, + `Until it succeeds, the CPO, SDR and OCR are not refreshed, a due Ongoing Certification Report is not issued, and the evidence watchdog pages when they pass their 14-day window (CPO-CSX-CPM). If "Configure AWS credentials" failed, the role or the AWS_PACKAGE_MAINTENANCE_ROLE_ARN variable is missing (infrastructure/bootstrap/package-maintenance.tf). If a fetch or verify failed, a published input is not signed by the workflow allowed to sign it: investigate before re-running.`, + ``, + `This issue is reused; each failure adds a comment.`, + ].join('\n'); + const existing = await github.paginate(github.rest.issues.listForRepo, { + owner: context.repo.owner, repo: context.repo.repo, state: 'all', per_page: 100, + labels: 'package-maintenance', + }); + const match = existing.filter(i => i.title === TITLE && !i.pull_request) + .sort((a, b) => (a.state === b.state ? a.number - b.number : a.state === 'open' ? -1 : 1))[0]; + if (match) { + if (match.state === 'closed') { + await github.rest.issues.update({ owner: context.repo.owner, repo: context.repo.repo, + issue_number: match.number, state: 'open' }); + } + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, + issue_number: match.number, body }); + } else { + await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, + title: TITLE, body, labels: ['package-maintenance'] }); + } diff --git a/.github/workflows/simulated-assessor.yml b/.github/workflows/simulated-assessor.yml new file mode 100644 index 00000000..96f6a064 --- /dev/null +++ b/.github/workflows/simulated-assessor.yml @@ -0,0 +1,113 @@ +# ============================================================================= +# SIMULATED ASSESSOR — "Totally Real Assessment Services, LLC (simulated)" +# ============================================================================= +# SIMULATED. Not independent of the provider, not a FedRAMP Recognized +# independent assessment service, no FedRAMP assessor ID. It stands in for an +# assessor so the assessor port (IVV-CSO-FIA/ICP, IVV-CSX-AIA, CPO-CSO-OSA, +# SDR-CSO-FRR) is exercised end to end on every deploy. +# +# The deploy calls this as a reusable workflow before its deploy job. Because it +# is a reusable workflow, the Sigstore certificate that signs its record names +# THIS file (job_workflow_ref), not deploy-with-opa.yml: the assessor signs +# under its own identity, which infrastructure/keys/assessor-identity.json pins. +# It holds no AWS credentials and reads only public URLs and the repository. +# +# It follows the provider's assessor guide (scripts/build-assessor-guide.py): +# re-runs every test a rule record cites, finds every cited workflow step and +# decision, fetches every cited published artifact and verifies its signature +# and age, and checks every KSI against the live, verified KSI signal. Then it +# writes one signed set: a result per rule, per KSI, and an overall summary. +# Any failure fails this job, and the deploy job needs it. +# ============================================================================= +name: Simulated assessor (not a FedRAMP assessment) + +on: + workflow_call: + +permissions: {} + +env: + # Kept equal to deploy-with-opa.yml's pins by tests/test_simulated_assessor.py. + OPA_VERSION: 1.18.2 + OPA_SHA256: 9903e5125ac281104f2c4b7371d10cc3b74a98933743fcbfc174f9bf0ab20de8 + +jobs: + assess: + name: Totally Real Assessment Services, LLC (simulated) + runs-on: ubuntu-latest + timeout-minutes: 20 + # No id-token here: this job installs unpinned test tooling from PyPI and + # runs the provider's tests, so it must not be able to sign. The signing + # job below installs nothing but cosign. + permissions: + contents: read + steps: + - name: Checkout the commit under assessment + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Install the assessor's tools + run: | + python3 -m pip install --user pytest jsonschema pyyaml cryptography + curl -fL --retry 5 --retry-delay 5 --connect-timeout 10 --max-time 120 \ + -o opa "https://openpolicyagent.org/downloads/v${OPA_VERSION}/opa_linux_amd64_static" + echo "${OPA_SHA256} opa" | sha256sum -c - + chmod 755 ./opa + sudo mv opa /usr/local/bin + + # IVV-CSO-STE: the provider supplies the technical explanation (the guide); + # the assessor works from it. + - name: Receive the provider's assessor guide + run: python3 scripts/build-assessor-guide.py --commit "$GITHUB_SHA" --output assessor-guide.json --md-output assessor-guide.md + + - name: Assess every rule and KSI (verification and validation) + run: python3 tools/simulated-assessor/assess.py --guide assessor-guide.json --repo . --commit "$GITHUB_SHA" --output simulated-assessment.json + + - name: Pass the unsigned assessment to the signing job + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: simulated-assessment-unsigned + path: simulated-assessment.json + if-no-files-found: error + + sign: + name: Totally Real Assessment Services, LLC (simulated) signs + needs: [assess] + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + id-token: write # keyless signing under this workflow's own identity + steps: + - name: Checkout the pinned assessor identity + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Receive the unsigned assessment + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: simulated-assessment-unsigned + + - name: Install cosign + uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1 + + - name: Sign the assessment (keyless, the assessor's own identity) + run: cosign sign-blob --yes --new-bundle-format --bundle simulated-assessment.bundle simulated-assessment.json + + - name: Verify the assessment signature against the pinned assessor identity + run: | + id=$(python3 -c 'import json; print(json.load(open("infrastructure/keys/assessor-identity.json"))["certificate_identity"])') + cosign verify-blob --bundle simulated-assessment.bundle \ + --certificate-identity "$id" \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com simulated-assessment.json + + - name: Hand the signed assessment to the provider + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: simulated-assessment + path: | + simulated-assessment.json + simulated-assessment.bundle + if-no-files-found: error diff --git a/.gitignore b/.gitignore index f8e36e84..37ffba8b 100644 --- a/.gitignore +++ b/.gitignore @@ -47,10 +47,13 @@ infrastructure/cmmc-out.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/quarterly-review.ics +infrastructure/ocr-issues.json +infrastructure/fedramp-certification-reports.json +infrastructure/fedramp-certification-reports/ +infrastructure/package-submission-log.json infrastructure/security-decision-record.json infrastructure/security-decision-record.md infrastructure/availability.json diff --git a/data/agency-access-exercise.json b/data/agency-access-exercise.json new file mode 100644 index 00000000..81969a6a --- /dev/null +++ b/data/agency-access-exercise.json @@ -0,0 +1,23 @@ +{ + "_note": "The agency-access exercise the deploy runs (scripts/agency-access.py exercise). Every agency here is fictional and every date is a business-day offset from the day it runs, so the 5-business-day denial clock is exercised against today's calendar. The exercise fails the deploy unless every outcome in `expected` is observed, including the late and overdue notices the processor must catch.", + "disclaimer": "SIMULATED. These agencies do not exist, no federal agency has requested access, and nothing is sent to FedRAMP or anyone: a denial notice is this log entry. Any resemblance to a real agency is the result of a very tired naming committee.", + "requests": [ + {"id": "AAR-X01", "agency": "Department of Hypothetical Affairs (simulated)", "system": "Hypothetical Records Portal", "kind": "access", "channel": "issue form", "received_on_offset": -10, "decision": "granted", "decided_on_offset": -9, "decided_by": "Operator (exercise)"}, + {"id": "AAR-X02", "agency": "Bureau of Made-Up Statistics (simulated)", "system": "Totally Average Dashboard", "kind": "access", "channel": "security contact", "received_on_offset": -9, "decision": "denied", "decided_on_offset": -8, "decided_by": "Operator (exercise)", "reason": "Asked for write access to a read-only website.", "fedramp_notified_on_offset": -4}, + {"id": "AAR-X03", "agency": "Office of Strictly Imaginary Procurement (simulated)", "kind": "access", "channel": "issue form", "received_on_offset": -3, "decision": "denied", "decided_on_offset": -2, "decided_by": "Operator (exercise)", "reason": "Requested the package by fax."}, + {"id": "AAR-X04", "agency": "Agency of Unverifiable Claims (simulated)", "kind": "access", "channel": "security contact", "received_on_offset": -13, "decision": "denied", "decided_on_offset": -12, "decided_by": "Operator (exercise)", "reason": "Could not verify the agency exists (it does not).", "fedramp_notified_on_offset": -5}, + {"id": "AAR-X05", "agency": "Department of Hypothetical Affairs (simulated)", "system": "Second Opinion Service", "kind": "access", "channel": "issue form", "received_on_offset": -8, "decision": "granted", "decided_on_offset": -7, "decided_by": "Operator (exercise)"}, + {"id": "AAR-X06", "agency": "Department of Hypothetical Affairs (simulated)", "system": "Second Opinion Service", "kind": "withdrawal", "channel": "issue form", "received_on_offset": -1, "withdraws": "AAR-X05"}, + {"id": "AAR-X07", "agency": "Commission on Rhetorical Questions (simulated)", "kind": "access", "channel": "issue form", "received_on_offset": -8, "decision": "denied", "decided_on_offset": -7, "decided_by": "Operator (exercise)", "reason": "Asked whether access was really necessary, and we agreed."}, + {"id": "AAR-X08", "agency": "FedRAMP (simulated)", "kind": "inventory-request", "channel": "security contact", "received_on_offset": -1} + ], + "expected": { + "AAR-X01": "in inventory", + "AAR-X02": "denial notice on time", + "AAR-X03": "denial notice pending", + "AAR-X04": "denial notice late", + "AAR-X05": "withdrawn", + "AAR-X07": "denial notice overdue", + "AAR-X08": "inventory supplied" + } +} diff --git a/data/agency-access.json b/data/agency-access.json new file mode 100644 index 00000000..04c78dc0 --- /dev/null +++ b/data/agency-access.json @@ -0,0 +1,5 @@ +{ + "schema": "agency-access/1", + "_note": "The register of agency access requests, decisions and withdrawals for the certification package (CDS-TRC-AAI, CDS-UTC-AAD); procedure in docs/procedures/agency-access.md, read by scripts/agency-access.py, which the deploy runs and which fails on a denial not notified to FedRAMP within 5 business days. Records name agencies and systems, never people. No federal agency has filed a request: the list is empty, and the mechanism is exercised on every deploy with plainly fictional agencies (data/agency-access-exercise.json).", + "requests": [] +} diff --git a/data/cds/offering.json b/data/cds/offering.json index 27be34e5..088585a4 100644 --- a/data/cds/offering.json +++ b/data/cds/offering.json @@ -1,41 +1,129 @@ { - "_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, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "fedramp_id_simulated": "No FedRAMP ID exists or is coming: nothing has been submitted to FedRAMP. FedRAMP's schema says to use the provider's name and acronym until an ID is assigned; the suffix makes sure nobody mistakes it for one.", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "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", "email": "sam.aydlette@gmail.com", "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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).", + "current_independent_assessment_service": "None: no FedRAMP Recognized independent assessment service is engaged. Every deploy is assessed by Totally Real Assessment Services, LLC (simulated), a workflow in this repository that is not a FedRAMP Recognized assessment service; its overall summary is quoted below.", "accountable_official": { "name": "Sam Aydlette", "title": "System Owner / Authorizing Operator", - "contact": "sam.aydlette@gmail.com" + "contact": "https://samaydlette.com/.well-known/security.txt" }, "cryptographic_modules": [ - { "module": "AWS KMS", "validation": "FIPS 140-3 (CMVP, HSM-backed)", "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", "inherited": true }, - { "module": "ACM TLS termination on CloudFront", "validation": "FIPS-validated cipher suites; TLS 1.2+", "role": "TLS in transit", "inherited": true }, - { "module": "S3 SSE-S3", "validation": "AES-256 (AWS-managed keys)", "role": "at-rest on the public website + log buckets", "inherited": true }, - { "module": "Sigstore Fulcio + Rekor", "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", "role": "deploy-time keyless signing", "inherited": false, "compensating_control": "trust anchored in the public Rekor transparency log" } + { + "module": "AWS KMS", + "validation": "FIPS 140-3 Level 3, CMVP certificate #4884 (AWS Key Management Service HSM)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "TLS 1.2+ (TLSv1.2_2021); AWS publishes no CMVP module for CloudFront viewer TLS (accepted, DEC-152)", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys); AWS publishes no CMVP module for SSE-S3 (accepted, DEC-152)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } ], "services": [ { "name": "samaydlette.com static website", - "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/.", - "security_category": "FIPS-199 Moderate (FedRAMP 20x Class C)", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, "in_mas_scope": true }, { "name": "Silk Reeling Mirror application", "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", - "security_category": "FIPS-199 Moderate (FedRAMP 20x Class C)", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." } ] } diff --git a/data/crypto-modules.json b/data/crypto-modules.json new file mode 100644 index 00000000..27635f07 --- /dev/null +++ b/data/crypto-modules.json @@ -0,0 +1,215 @@ +{ + "schema": "crypto-modules/1", + "$comment": "Cryptographic modules per service (CMU-CSO-CMD, CMU-CSO-UVM, CMU-CSO-CAT). scripts/build-scg.py joins this with the deploy's inventory and publishes the per-service list inside /.well-known/secure-configuration-guide.json; it fails the build when the inventory holds a component type that is neither mapped here nor listed as using no cryptography. Every certificate number was read from NIST's CMVP pages on the date given; no number is typed from memory. AI-drafted 2026-11-05; for the operator's review.", + "checked_on": "2026-11-05", + "modules": { + "aws-kms-hsm": { + "name": "AWS Key Management Service HSM", + "vendor": "Amazon Web Services, Inc.", + "cmvp_certificate": "4884", + "standard": "FIPS 140-3", + "level": "3", + "status": "Active (sunset 2029-11-17)", + "source": "https://csrc.nist.gov/projects/cryptographic-module-validation-program/certificate/4884" + }, + "not-published": { + "name": "Not published by AWS for this service path", + "vendor": "Amazon Web Services, Inc.", + "cmvp_certificate": null, + "standard": null, + "level": null, + "status": "AWS's FIPS page lists FIPS endpoints and module families but names no CMVP module for this path; treated as not validated (DEC-152).", + "source": "https://aws.amazon.com/compliance/fips/" + }, + "sigstore": { + "name": "Sigstore Fulcio and Rekor (public-good instance), cosign client", + "vendor": "Sigstore (OpenSSF)", + "cmvp_certificate": null, + "standard": null, + "level": null, + "status": "Not a CMVP-validated module. ECDSA P-256 (a FIPS-approved algorithm). Signs published evidence; protects no customer data.", + "source": "https://docs.sigstore.dev/" + } + }, + "services": [ + { + "service": "CloudFront viewer TLS (site and app)", + "types": [ + "cdn_distribution", + "tls_certificate" + ], + "protects": "data in transit between users and the edge, including app sign-in tokens", + "module": "not-published", + "configuration": "Security policy TLSv1.2_2021 (TLS 1.2 or later, forward-secret AES-GCM suites); ACM certificate.", + "customer_data": true, + "tenant_default": "TLSv1.2_2021 on every request; no FIPS-validated viewer TLS option is offered for a distribution." + }, + { + "service": "API Gateway HTTP API TLS (Silk Reeling)", + "types": [ + "api_gateway" + ], + "protects": "the app's API calls in transit (CloudFront to API Gateway)", + "module": "not-published", + "configuration": "HTTPS only; CloudFront connects with TLS 1.2 (origin_ssl_protocols).", + "customer_data": true, + "tenant_default": "HTTPS only; AWS's API Gateway FIPS endpoint covers the management API, not an HTTP API's execute-api endpoint." + }, + { + "service": "Amazon Cognito user pool (Silk Reeling sign-in)", + "types": [ + "identity_provider" + ], + "protects": "app users' credentials and MFA secrets, tokens", + "module": "not-published", + "configuration": "Hosted UI over TLS; tokens signed by Cognito; user records encrypted at rest by Cognito.", + "customer_data": true, + "tenant_default": "The Hosted UI sign-in domain has no FIPS endpoint (AWS lists cognito-idp-fips for the API only)." + }, + { + "service": "AWS KMS customer-managed keys", + "types": [ + "kms_key" + ], + "protects": "the keys that encrypt the app's Lambda environment and log groups, the alert topic, the runtime signing key and the DNSSEC key-signing key", + "module": "aws-kms-hsm", + "configuration": "Four customer-managed keys, automatic rotation enabled on the symmetric keys.", + "customer_data": true, + "tenant_default": "Every app data store that supports a customer-managed key uses one (Lambda environment, log groups)." + }, + { + "service": "AWS Lambda (functions and their environments)", + "types": [ + "function" + ], + "protects": "function environment variables at rest; the app's outbound TLS to Cognito's key endpoint", + "module": "aws-kms-hsm", + "configuration": "Environments encrypted with a customer-managed KMS key (kms_key_arn). Outbound TLS uses the Python runtime's own TLS library, which is not run as a validated module (DEC-152).", + "customer_data": true, + "tenant_default": "kms_key_arn set on the app function." + }, + { + "service": "CloudWatch Logs", + "types": [ + "log_group" + ], + "protects": "application and gateway logs at rest", + "module": "aws-kms-hsm", + "configuration": "Every log group encrypted with a customer-managed KMS key.", + "customer_data": true, + "tenant_default": "kms_key_id set on every app log group." + }, + { + "service": "Amazon SNS (evidence alerts)", + "types": [ + "notification_topic" + ], + "protects": "alert messages at rest", + "module": "aws-kms-hsm", + "configuration": "Topic encrypted with a customer-managed KMS key.", + "customer_data": false, + "tenant_default": null + }, + { + "service": "AWS Secrets Manager", + "types": [ + "secrets_manager" + ], + "protects": "secret values at rest (none exist today: the app holds no secret since SCN-2026-006)", + "module": "aws-kms-hsm", + "configuration": "A secret, if added, is encrypted under a customer-managed KMS key; the app key's policy admits Secrets Manager use only through the service.", + "customer_data": false, + "tenant_default": null + }, + { + "service": "Amazon S3 (site, logs, CloudTrail, Terraform state)", + "types": [ + "object_store" + ], + "protects": "objects at rest; the site's public content, access logs, the audit trail, Terraform state", + "module": "not-published", + "configuration": "SSE-S3 (AES-256, AWS-managed keys); TLS-only bucket policies on the state bucket.", + "customer_data": false, + "tenant_default": null + }, + { + "service": "Amazon SQS (compliance dead-letter queue)", + "types": [ + "message_queue" + ], + "protects": "failed compliance events at rest", + "module": "not-published", + "configuration": "SSE-SQS (AWS-managed keys).", + "customer_data": false, + "tenant_default": null + }, + { + "service": "Amazon DynamoDB (Terraform state lock)", + "types": [ + "kv_table" + ], + "protects": "lock items at rest", + "module": "not-published", + "configuration": "AWS-owned key encryption.", + "customer_data": false, + "tenant_default": null + }, + { + "service": "AWS CloudTrail (management trail)", + "types": [ + "audit_log_trail" + ], + "protects": "the integrity of the audit trail (log file validation digests)", + "module": "not-published", + "configuration": "Management events; delivered to the CloudTrail bucket (SSE-S3).", + "customer_data": false, + "tenant_default": null + }, + { + "service": "Route 53 DNSSEC signing", + "types": [ + "dns_zone" + ], + "protects": "the integrity of the site's DNS answers", + "module": "aws-kms-hsm", + "configuration": "Key-signing key is an asymmetric customer-managed KMS key in us-east-1 (ECC_NIST_P256).", + "customer_data": false, + "tenant_default": null + }, + { + "service": "IAM OIDC provider (GitHub Actions)", + "types": [ + "oidc_provider" + ], + "protects": "CI's federation to AWS (token signature verification by AWS STS)", + "module": "not-published", + "configuration": "Trusts token.actions.githubusercontent.com for sts.amazonaws.com only.", + "customer_data": false, + "tenant_default": null + }, + { + "service": "External services (Sigstore signing and others)", + "types": [ + "external_service" + ], + "protects": "the authenticity of published evidence (keyless signatures); other external services carry no customer data", + "module": "sigstore", + "configuration": "cosign sign-blob with a Fulcio certificate and a Rekor entry; verification pins the workflow identity.", + "customer_data": false, + "tenant_default": null + } + ], + "no_cryptography": { + "types": [ + "npm_package", + "pypi_package", + "html_artifact", + "iam_policy", + "iam_role", + "iam_group", + "metric_alarm", + "event_schedule" + ], + "why": "Software packages, page content, IAM policy documents and alarm or schedule definitions: inventoried components that provide no cryptographic service of their own." + } +} diff --git a/data/decisions.json b/data/decisions.json index 06559604..f5934b69 100644 --- a/data/decisions.json +++ b/data/decisions.json @@ -1155,6 +1155,352 @@ "source": { "detector": "OWASP ZAP baseline scan" } + }, + { + "id": "DEC-100", + "title": "FedRAMP ID and UEI are simulated; the FedRAMP ID is FedRAMP's fallback, stamped on every FedRAMP report", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator has not submitted this offering to FedRAMP and is not registering on SAM.gov. The FedRAMP ID published everywhere is the fallback FedRAMP's CPO schema prescribes until an ID is assigned (the provider name and acronym), suffixed PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID so nobody mistakes it for a real one; the UEI is a placeholder no SAM.gov lookup will find. Both are flagged simulated in the CPO. The one value, in data/cds/offering.json, is carried by every report published in a FedRAMP schema (providerExtensions.fedRampId) and by the issue index, logs and snapshot manifests; scripts/check-fedramp-id.py fails the deploy otherwise.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CDS-CSO-FID", + "CDS-CSO-PUB" + ] + } + }, + { + "id": "DEC-101", + "title": "Ongoing Certification Reports and Quarterly Review content are published in full", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator determines that publishing each Ongoing Certification Report, and the content prepared for each Quarterly Review (its agenda, published in the report), will not likely have an adverse effect on the offering: the system holds no federal customer or agency data, the reports summarize what the public evidence already shows, and each report passes the automated sensitivity screen (scripts/_sensitivity.py: account IDs, outside email addresses, IP addresses, access keys, tokens, name handles) before it is written. The operator reviews anything the screen cannot judge before the report is issued. Each report cites this record.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-OCR-RPS", + "CCM-OCR-LSI", + "CCM-QTR-SCR" + ] + } + }, + { + "id": "DEC-102", + "title": "The operator answers Ongoing Certification Report feedback and publishes an anonymized summary in the next report", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "Questions and feedback on each issued report arrive through its GitHub issue form (linked from the report, prefilled with the report's date) or, for anything sensitive, the security contact in /.well-known/security.txt. The operator answers each, and before the next issue writes an anonymized, desensitized summary of the questions and answers in data/ocr-feedback.json (no names, agencies or identifying detail); the next report publishes it, and the build screens it and fails on an identifier.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-OCR-AFS", + "CCM-OCR-FBM" + ] + } + }, + { + "id": "DEC-103", + "title": "The operator hosts a synchronous Quarterly Review after every Ongoing Certification Report", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator hosts a Quarterly Review by video call on the date the CCM calendar sets (5 business days after each report's issue), open to all necessary parties who register, and holds it even if nobody registers. It reviews the parts of the latest report most relevant to agencies and covers the standing agenda items the report publishes: KSI results and trend, vulnerability trend, and the plan for the next quarter.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-QTR-MTG", + "CCM-QTR-ACT" + ] + } + }, + { + "id": "DEC-104", + "title": "The operator records or transcribes each Quarterly Review and shares it", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator records or transcribes each Quarterly Review and supplies the recording or transcript to the parties who registered. A transcript published beyond them has every agency comment, question and name removed first, and is published only after the same no-adverse-effect check as the report (DEC-101).", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-QTR-RTR", + "CCM-QTR-SRR" + ] + } + }, + { + "id": "DEC-105", + "title": "Quarterly Review attendees: agencies, FedRAMP and the assessor; other third parties only with specific relevance", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator invites agencies and FedRAMP to Quarterly Reviews, and the assessor by default. No other third party is invited unless it has specific relevance to the review, recorded with the invitation. The registration form states this policy.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-QTR-RTP" + ] + } + }, + { + "id": "DEC-106", + "title": "Quarterly Review content is screened for sensitive information before each review", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "Before each Quarterly Review the operator checks the content to be shown against the same screen as the report (no account IDs, internal addresses, credentials, unpublished vulnerability detail beyond the public reports, or identifying information about agencies or people) and removes anything that would likely have an adverse effect on the offering if disclosed. The generated agenda is screened automatically with the report.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "CCM-QTR-NID" + ] + } + }, + { + "id": "DEC-107", + "title": "This offering seeks FedRAMP 20x certification only", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator seeks, if anything, FedRAMP 20x Program Certification (Class C) for this offering and will not seek FedRAMP Rev5 Program Certification for it. Every report states certificationType 20x; the Rev5 control view in the Security Decision Record explains how the 20x evidence meets the Rev5 objectives and is not a second certification claim. tests/test_certification_cycle.py fails if a published label names the Rev5 program as the certification sought.", + "controls": [], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "source": { + "detector": "FedRAMP 20x Class C rule records (data/frr-records.json)", + "drafted_by": "AI-drafted (Claude) for the operator to confirm", + "rules": [ + "FRC-CSO-POP" + ] + } + }, + { + "id": "DEC-150", + "title": "Root and operator MFA stays virtual TOTP: phishing-resistant MFA is accepted as not bought", + "disposition": "accepted", + "status": "in-force", + "justification": "Extends DEC-025. The AWS root user and the operator IAM user keep virtual authenticator-app (TOTP) MFA; a FIDO2 security key or passkey (IA-2(8), the Secure Configuration Guide's recommended default) is not being bought for this proof of concept. Residual risk: a TOTP code can be relayed by a real-time phishing site. Why it is accepted: both principals have MFA (IA-2(1)/(2) met); the root user has no access keys and is used only for root-only tasks; the operator user has no console password, so a phished TOTP code alone opens no console session; every production change goes through the reviewed, approval-gated deploy, not either principal; CloudTrail records both. The deploy checks both principals' MFA on every run (scripts/check-secure-config.py) and publishes the deviation against this record. AI-drafted for the operator to confirm.", + "controls": [ + "ia-2.1", + "ia-2.2", + "ia-2.8", + "cm-6" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [ + "aws-account::root", + "aws-iam-group::operators" + ] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" + }, + { + "id": "DEC-151", + "title": "The operator keeps two-factor authentication on the GitHub owner account and issues no classic personal access tokens", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator keeps two-factor authentication enabled on the GitHub account that owns the repository, issues no classic personal access tokens from it, and reviews its sign-in methods, tokens, SSH keys and authorized applications each quarter. GitHub exposes these settings only to the account itself, so the deploy's token cannot read them; this record is the operator's attestation, cited by the Secure Configuration Guide setting github.owner-2fa. AI-drafted for the operator to confirm.", + "controls": [ + "ia-2.1", + "ia-5", + "cm-6" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [ + "github-owner" + ] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" + }, + { + "id": "DEC-152", + "title": "Service paths with no published CMVP module validation are accepted", + "disposition": "accepted", + "status": "in-force", + "justification": "AWS publishes CMVP certificates for module families (AWS-LC, the KMS HSM) but names no validated module for these paths this system uses: CloudFront viewer TLS, API Gateway HTTP API TLS, the Cognito Hosted UI, S3 SSE-S3, SQS SSE-SQS, the DynamoDB AWS-owned key, CloudTrail digest signing, the IAM OIDC provider, and the Silk Reeling Lambda's outbound TLS from the Python runtime. For the viewer-facing paths AWS offers no validated option (no FIPS endpoint for a distribution's viewer TLS, an HTTP API's execute-api endpoint, or the Hosted UI). The stores on SSE-S3, SSE-SQS and the AWS-owned key hold no customer data (site content, logs, audit trail, Terraform state and lock, failed compliance events); moving them to customer-managed KMS keys would add per-request KMS cost for no customer-data benefit. Every store of app data that supports a customer-managed key uses one, on the KMS HSM (CMVP #4884). The system holds no federal customer data. Listed per service in the Secure Configuration Guide's module list (CMU-CSO-CMD). AI-drafted for the operator to confirm.", + "controls": [ + "sc-13", + "sc-8.1", + "sc-28.1" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [ + "aws-cloudfront-distribution", + "aws-apigatewayv2-api::silk_reeling", + "aws-cognito-user-pool::silk_reeling", + "aws-s3-bucket", + "aws-sqs-queue::compliance_dlq", + "aws-dynamodb-table::tflock", + "aws-cloudtrail::management", + "aws-iam-oidc-provider::github", + "aws-lambda-function::silk_reeling" + ] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" + }, + { + "id": "DEC-160", + "title": "Trust-center access records: what is logged, and a party's own records on request", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "AI-drafted for the operator to confirm. Access to the certification data is logged by CloudFront standard logging with a field allowlist that excludes IP address, forwarded-for, port, cookies, query string, user agent and referrer (infrastructure/bootstrap/trust-access-logs.tf); raw records expire after 90 days and only monthly aggregate counts for /.well-known/ and /trust/ are published, kept 13 months (scripts/build-access-summary.py). Because no requester identity is logged, the operator provides a party, on request to the security contact, the published summaries and any records matching the times and paths the party identifies, within 10 business days. Agencies are identified only by what they state in their own access request, never inferred from network data. This trades per-party attribution (CDS-TRC-ACL's SHOULD) for privacy, at the operator's direction of 2026-11-05.", + "controls": [ + "au-2", + "au-3", + "au-11", + "pt-2" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [ + "aws-cloudfront-distribution" + ] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "point_of_contact": "Sam Aydlette (operator)" + }, + { + "id": "DEC-165", + "title": "Agency access to the certification package: decided by the operator, denials notified to FedRAMP within 5 business days, inventory supplied on request", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator decides every agency access request and records it in data/agency-access.json (agencies and systems, never people); notifies FedRAMP of every denial within 5 business days; and supplies the access inventory and its history to FedRAMP on request (docs/procedures/agency-access.md). The package itself is public, so access needs no provisioning. The deploy fails when a denial notice is late or overdue, and exercises the procedure with fictional agencies on every run. AI-drafted 2026-11-05 for the operator to confirm.", + "controls": [ + "ac-21", + "ca-6" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" + }, + { + "id": "DEC-166", + "title": "Public sharing of the certification package: disclosure standard and determination of no likely adverse effect", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator has determined that publishing the whole certification package is not likely to have an adverse effect on the offering, because it carries no account IDs, secrets, credentials, personal email addresses, IAM user names, run IDs, raw logs or access-request contacts (each refused by a build gate), and the detail published on purpose (role names and policy summaries, the API and CloudFront hostnames, configurations and findings) grants no access on its own (docs/procedures/information-sharing.md). Reviewed annually and when a new kind of artifact is published. AI-drafted 2026-11-05 for the operator to confirm.", + "controls": [ + "ac-22" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" + }, + { + "id": "DEC-167", + "title": "Verification and validation use full populations, never representative samples", + "disposition": "operational-requirement", + "status": "in-force", + "justification": "The operator does not use representative samples in verification or validation: every check runs over its full population (every inventoried component, every live in-boundary resource, every SBOM, every rule record and every test it cites), and the simulated assessor re-checks every rule and KSI. The assessor guide states this (IVV-CSO-DUS). Any future use of sampling would be documented there and this record revised. AI-drafted 2026-11-05 for the operator to confirm.", + "controls": [ + "ca-2", + "ca-7" + ], + "applies_to": { + "check_ids": [], + "vuln_ids": [], + "resources": [] + }, + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05" } ] } diff --git a/data/fedramp-certification-reports/2026-11-05-simulated-certification-report.json b/data/fedramp-certification-reports/2026-11-05-simulated-certification-report.json new file mode 100644 index 00000000..b64e8cd2 --- /dev/null +++ b/data/fedramp-certification-reports/2026-11-05-simulated-certification-report.json @@ -0,0 +1,11 @@ +{ + "title": "FedRAMP Certification Report (SIMULATED: this did not come from FedRAMP)", + "simulated": true, + "issuer": "Nobody with any authority. This proof of concept has no FedRAMP counterpart, so this file stands in for the Certification Report FedRAMP would send, to exercise the path that publishes such a report unmodified within two weeks of receipt (CDS-CSO-FRC).", + "cloudServiceOffering": "samaydlette.com (SAMCOM)", + "fedRampId": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "received": "2026-11-05", + "determination": "None. No certification decision has been made, and none will be: nothing was ever submitted to FedRAMP.", + "findings": [], + "noteToAgencies": "If you came here hoping for a FedRAMP certification, sorry: this one is pretend. Hit me up on LinkedIn: https://www.linkedin.com/in/sa2/" +} diff --git a/data/fedramp-certification-reports/register.json b/data/fedramp-certification-reports/register.json new file mode 100644 index 00000000..b232205e --- /dev/null +++ b/data/fedramp-certification-reports/register.json @@ -0,0 +1,13 @@ +{ + "$comment": "FedRAMP Certification Reports received (CDS-CSO-FRC). Each report FedRAMP sends is committed to this directory byte for byte, as received, and listed here with the date received and its sha256. scripts/publish-certification-reports.py checks every file against its sha256 (an edited report fails the deploy), and the deploy publishes each unmodified at /.well-known/fedramp-certification-reports/, indexed by the signed /.well-known/fedramp-certification-reports.json with the days from receipt to first publication (FedRAMP's window: 2 weeks). SIMULATED: this proof of concept has no FedRAMP counterpart; the one report here is a plainly fake stand-in, flagged simulated, so the path is exercised on every deploy.", + "schema": "fedramp-certification-reports/1", + "reports": [ + { + "file": "2026-11-05-simulated-certification-report.json", + "received_on": "2026-11-05", + "from": "Simulated FedRAMP (no real party: the operator wrote this stand-in)", + "sha256": "ba62ba1d8eb9009047b891855f5f571e6c9ded4aed4667721e28c6c3a5ce5464", + "simulated": true + } + ] +} diff --git a/data/frr-records.json b/data/frr-records.json index d84c52f9..31d6bb8d 100644 --- a/data/frr-records.json +++ b/data/frr-records.json @@ -85,237 +85,533 @@ }, { "frr_id": "CCM-OCR-AFS", - "status": "Not Implemented", - "implementation": "No summary section in build-ocr.py or the live OCR; declared N/A (build-ocr.py:106-110).", - "evidence": [], - "gap": "No anonymized/desensitized summary of feedback, questions and answers, and no stated delivery method. To close: Add a 'feedback summary' section to the OCR (and an addendum file) built from the FBM channel, with a redaction step for names/agency identifiers; when nothing was received, state 'no feedback received on OCR '.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Each OCR carries an anonymized, desensitized summary of the feedback and questions on the previous issued report, with the operator's answers (providerExtensions.feedback.summaryOfPreviousReport, from data/ocr-feedback.json), or says none were received; the OCR's sensitivity screen rejects names, handles and addresses (DEC-102).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_feedback_summary_covers_the_previous_issue" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_feedback_summary_with_more_items_than_received_fails" + }, + { + "kind": "decision", + "ref": "DEC-102" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ] }, { "frr_id": "CCM-OCR-AVL", - "status": "Partially Implemented", - "implementation": "Live https://samaydlette.com/.well-known/ongoing-certification-report.json + .md (fetched 2026-11-05), built by scripts/build-ocr.py in deploy-with-opa.yml step 'Build Ongoing Certification Report' (line ~1555); all eight summary sections present (build-ocr.py:91-105).", - "evidence": [], - "gap": "The OCR is rebuilt on every deploy rather than issued quarterly: there is no frozen, dated, signed issue per period, and no index of past issues.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "On each calendar issue date the maintainer issues the OCR covering the period since the previous issue: frozen ocr-issue-.json and .md, signed, never rewritten, listed with its sha256 in /.well-known/ocr-issues.json. The rolling OCR between issues carries all eight summaries, the incidents from the incident register (or an attestation of none), and the review schedule.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_first_run_on_an_issue_date_freezes_the_report_and_snapshots_the_package" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_issued_report_is_carried_over_and_never_rebuilt" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_reportable_incidents_come_from_the_register_and_exercises_say_so" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Issue the quarterly report when due (frozen, with a snapshot)" + }, + { + "kind": "artifact", + "ref": ".well-known/ocr-issues.json" + } ] }, { "frr_id": "CCM-OCR-FBM", - "status": "Not Implemented", - "implementation": "build-ocr.py:106-110 and the live OCR state the feedback channel is 'N/A absent a consuming agency'; no feedback link in the OCR, CPO or trust center; security.txt contact is the only channel and is not tied to the OCR.", - "evidence": [], - "gap": "No asynchronous feedback/question mechanism for each OCR, and no documented way to access it (artifact missing). To close: Stand up a per-report asynchronous channel (e.g. a GitHub Discussions category or issue form per OCR issue, with a private alternative address for agencies), link it from each OCR, the CPO and the trust center.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Each OCR links its own asynchronous feedback channel, a GitHub issue form (.github/ISSUE_TEMPLATE/ocr-feedback.yml) prefilled with the report's date, with the security contact for anything sensitive; the CPO and the issue index link it too (DEC-102).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_rolling_ocr_validates_and_carries_the_cycle" + }, + { + "kind": "decision", + "ref": "DEC-102" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ] }, { "frr_id": "CCM-OCR-LSI", - "status": "Partially Implemented", - "implementation": "The OCR carries SCN summaries, decision titles and the accepted findings already public in the VDR, and passes the publication redaction gate (no AWS account ID) on every deploy.", - "evidence": [], - "gap": "Met at assessment, but no test, workflow step, published artifact or decision record shows it. No documented sensitivity determination per issue and no screen beyond account IDs (ARNs, IPs, email addresses, secret-like strings). SCN text is copied verbatim.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Before the OCR is written, every string in it passes a sensitivity screen (account IDs, email addresses outside the system's and FedRAMP's domains, IP addresses, AWS keys, tokens and private keys, @handles); a hit fails the build. The publication redaction gate checks it again before publishing. The public-release determination is DEC-101.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_sensitivity_screen_catches_each_kind" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_ocr_carrying_a_personal_address_is_never_built" + }, + { + "kind": "decision", + "ref": "DEC-101" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Ongoing Certification Report (CCM)" + } ] }, { "frr_id": "CCM-OCR-NRD", - "status": "Partially Implemented", - "implementation": "Live OCR json/md carry next_ongoing_certification_report_date 2027-02-04 (build-ocr.py:88).", - "evidence": [], - "gap": "The date is now+91 days recomputed on every deploy, so it is a moving value, not a committed target; it is published only inside the OCR, not with the other public Certification Data (CPO/trust center). To close: Derive the next date from the fixed cycle (last issued OCR + cycle), keep it stable between issues, and publish it in the CPO and trust-center.json as well.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "The next OCR date comes from the fixed CCM calendar (infrastructure/schemas/ccm-calendar.json), stays the same between issues, and is published in the OCR, the CPO (serviceProperties.nextOngoingCertificationReportDate) and the issue index.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_next_dates_hold_steady_between_issues_and_move_on_the_issue_date" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_publishes_the_fixed_cycle_dates" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ] }, { "frr_id": "CCM-OCR-RPS", - "status": "Partially Implemented", - "implementation": "OCR is public at /.well-known/ (fetched).", - "evidence": [], - "gap": "Permissive rule, exercised; but no recorded determination that public release will not adversely affect the offering. To close: Record the public-release determination (who, when, basis) in each OCR issue or in the CPO.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Exercised: each OCR is published in full and records the public-release determination (providerExtensions.publicRelease, DEC-101) after passing the sensitivity screen.", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-101" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_rolling_ocr_validates_and_carries_the_cycle" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ], - "may_rationale": "Exercised. The system exists to demonstrate FedRAMP 20x in the open, and the OCR carries no federal customer or agency data, so it is published in full; each issue will record the no-adverse-effect determination." + "may_rationale": "Exercised. The system exists to demonstrate FedRAMP 20x in the open, and the OCR carries no federal customer or agency data, so it is published in full, and each report records the no-adverse-effect determination (DEC-101)." }, { "frr_id": "CCM-OCR-SOR", - "status": "Not Implemented", - "implementation": "build-ocr.py:34,54-55,88: rolling window recomputed per deploy.", - "evidence": [], - "gap": "No regular 3-month cycle and no chosen phase within the quarter. To close: Pick fixed issue dates (e.g. mid-quarter: 15 Feb/May/Aug/Nov), encode them in config, and have the build issue the OCR only on those dates.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "The OCR is issued on a regular 3-month cycle of fixed dates set in the CCM calendar, each a business day placed away from the beginning, middle and end of its quarter (late in the second month); the calendar is validated on every build and must keep two dates ahead.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_committed_calendar_is_valid" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_bad_calendar_fails_closed" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Issue the quarterly report when due (frozen, with a snapshot)" + }, + { + "kind": "artifact", + "ref": ".well-known/ocr-issues.json" + } ] }, { "frr_id": "CCM-QTR-ACT", - "status": "Not Implemented", - "implementation": "No reviews held.", - "evidence": [], - "gap": "No additional agency-relevant information supplied in reviews. To close: Add a standing agenda item (e.g. upcoming roadmap, KSI trend, VDR trend) to the review template.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Each Quarterly Review covers a standing agenda of agency-relevant items beyond the report (KSI trend, VDR trend, planned changes, upcoming roadmap), published with the OCR (DEC-103).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-103" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_rolling_ocr_validates_and_carries_the_cycle" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ] }, { "frr_id": "CCM-QTR-MTG", - "status": "Not Implemented", - "implementation": "build-ocr.py:106-110 / live OCR declare the Quarterly Review N/A; no meeting record, agenda or schedule anywhere in the repo.", - "evidence": [], - "gap": "No synchronous Quarterly Review has been scheduled or held. To close: Schedule a recurring quarterly review (video call) 3-10 business days after each OCR issue, prepare an agenda from the OCR, hold it even if no agency attends, and keep minutes; publish the schedule.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "The operator hosts a synchronous Quarterly Review by video call 5 business days after each OCR issue, open to all necessary parties who register, held even if nobody registers (DEC-103). The schedule is the published calendar file and appears in the OCR and CPO.", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-103" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_review_is_five_business_days_after_issue_skipping_thanksgiving" + }, + { + "kind": "artifact", + "ref": ".well-known/quarterly-review.ics" + } ] }, { "frr_id": "CCM-QTR-NID", - "status": "Partially Implemented", - "implementation": "No Quarterly Review has been held, so nothing has been disclosed; no content-review procedure exists.", - "evidence": [], - "gap": "No pre-meeting sensitivity review procedure for review content. To close: Add a review checklist (same screen as OCR-LSI) for slides/agenda before each review.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Content for each Quarterly Review is the agenda published in the OCR, which passes the sensitivity screen, and the operator screens anything else shown against the same list before the review (DEC-106).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-106" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_sensitivity_screen_catches_each_kind" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ] }, { "frr_id": "CCM-QTR-NRD", - "status": "Partially Implemented", - "implementation": "Live OCR next_quarterly_review_date 2027-02-04 (build-ocr.py:89).", - "evidence": [], - "gap": "Same moving now+91 value as the OCR date (so the review date equals the report date, contradicting QTR-SAR); not published with the CPO/trust center; no review actually scheduled for that date. To close: Derive the review date from the OCR issue date + 3-10 business days, keep it stable, publish it in CPO and trust center, and tie it to the .ics.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "The next Quarterly Review date is the latest issue's review date from the CCM calendar (issue + 5 business days, holiday-aware), stable between issues, published in the OCR, the CPO and the calendar file.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_next_dates_hold_steady_between_issues_and_move_on_the_issue_date" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "artifact", + "ref": ".well-known/quarterly-review.ics" + } ] }, { "frr_id": "CCM-QTR-REG", - "status": "Not Implemented", - "implementation": "No registration link or .ics anywhere in website/ or the published artifacts.", - "evidence": [], - "gap": "No registration URL or calendar file (artifact missing). To close: Generate an .ics per review from the cycle config and publish it (e.g. /.well-known/quarterly-review.ics) plus a registration form link; reference it from the OCR and CPO.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "/.well-known/quarterly-review.ics (RFC 5545, one event per review) is built from the CCM calendar on every deploy and maintenance run; each event and the OCR and CPO link the registration form (.github/ISSUE_TEMPLATE/quarterly-review-registration.yml).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_review_calendar_file_is_rfc5545" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build CDS certification-data artifacts (availability, policy index, review calendar)" + }, + { + "kind": "artifact", + "ref": ".well-known/quarterly-review.ics" + } ] }, { "frr_id": "CCM-QTR-RTP", - "status": "Partially Implemented", - "implementation": "No reviews held, so no third parties invited; no attendance policy exists.", - "evidence": [], - "gap": "No documented invitation policy limiting third parties. To close: Document an attendee policy (agencies and FedRAMP; third parties only with stated relevance) in the review procedure.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Invitations go to agencies, FedRAMP and the assessor; other third parties only with specific relevance, recorded with the invitation; the registration form states the policy (DEC-105).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-105" + } ] }, { "frr_id": "CCM-QTR-RTR", - "status": "Not Implemented", - "implementation": "No reviews held; no recording/transcript procedure.", - "evidence": [], - "gap": "No recording or transcript supplied to necessary parties. To close: Record or transcribe each review and distribute through the FBM channel; keep them with the OCR issue.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "The operator records or transcribes each Quarterly Review and supplies it to the parties who registered (DEC-104).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-104" + } ] }, { "frr_id": "CCM-QTR-SAR", - "status": "Not Implemented", - "implementation": "build-ocr.py:88-89 set the review date equal to the report date (0 business days after).", - "evidence": [], - "gap": "Review not scheduled 3-10 business days after the OCR release. To close: Compute the review date as OCR issue + N business days with 3<=N<=10 (holiday-aware) and assert it in a test.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Each review is scheduled 5 business days after its OCR issue, counting only weekdays that are not federal holidays; the calendar rejects an offset outside 3 to 10 business days.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_review_is_five_business_days_after_issue_skipping_thanksgiving" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_bad_calendar_fails_closed" + }, + { + "kind": "artifact", + "ref": ".well-known/quarterly-review.ics" + } ] }, { "frr_id": "CCM-QTR-SCR", - "status": "Not Implemented", - "implementation": "No review content exists.", - "evidence": [], - "gap": "No quarterly review has been held yet, so there is no content to publish.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Exercised: the content prepared for each review (its agenda and the report it reviews) is published with the OCR after the no-adverse-effect determination (DEC-101).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-101" + }, + { + "kind": "artifact", + "ref": ".well-known/ongoing-certification-report.json" + } ], - "may_rationale": "Will be exercised: content prepared for each quarterly review will be published with that quarter's OCR, for the same reason the OCR is public, after the same no-adverse-effect check." + "may_rationale": "Exercised: content prepared for each quarterly review is published with that quarter's OCR, for the same reason the OCR is public, after the same no-adverse-effect check (DEC-101)." }, { "frr_id": "CCM-QTR-SRR", - "status": "Not Implemented", - "implementation": "No recordings exist.", - "evidence": [], - "gap": "No quarterly review has been held yet, so there is no recording to publish.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "Exercised: a recording or transcript published beyond registered parties has all agency comments, questions and names removed first and passes the same no-adverse-effect check (DEC-104).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-104" + } ], - "may_rationale": "Will be exercised: each review's recording or transcript will be published after all agency comments, questions and names are removed, so the review is as open as the rest of the package." + "may_rationale": "Exercised: each review's recording or transcript is published after all agency comments, questions and names are removed, so the review is as open as the rest of the package (DEC-104)." }, { "frr_id": "CDS-CSO-AVR", - "status": "Partially Implemented", - "implementation": "https://samaydlette.com/.well-known/availability.json + availability.md, scripts/build-availability.py (appends one point per deploy, L47-53; WINDOW_DAYS=45 L27).", - "evidence": [], - "gap": "Not an availability measurement: a point is written only when a deploy succeeds ('A deploy that produces this feed is, by definition, a successful one', L10-11), so an outage can never be recorded and there are no incidents field/records. Days without deploys are simply missing (27 points spanning 2026-08-06..11-05; ~10 in the last 30 days). Trim keeps the last 45 points, not 45 days, so history older than the window persists. Core services are not probed (Silk Reeling API/Cognito not checked at all). Served from the same CloudFront/S3 as the offering, so it is unavailable when the offering is (self-stated residual). To close: Run an external synthetic monitor on independent infrastructure (different provider/region/account and DNS name, e.g. a status subdomain on separate hosting) that probes the site, /.well-known/, and the Silk Reeling API/Cognito every few minutes; record incidents (start, end, affected service, cause); publish JSON + HTML status page from that independent host with 30+ days of continuous history.", - "closes_with": [ - "W8" - ] - }, - { - "frr_id": "CDS-CSO-CBF", - "status": "Partially Implemented", - "implementation": "Each builder renders JSON and Markdown from the same in-memory dict in one run (build-cds-overview.py, build-cpo.py, build-availability.py, build-policy-index.py:109-119, build-sdr.py render_markdown L278, build-ocr.py); trust page renders from trust-center.json.", - "evidence": [], - "gap": "Human-readable twins are lossy, so the formats are not consistent in content: policy-index.md drops summary and version (build-policy-index.py:112-118); security-decision-record.md shows only KSI id/controls/explanation, not verification/validation or the 333 rev5 control statements. No test or reconcile invariant checks JSON/MD parity. Human-readable policies themselves (docs/policies/*.md) are not cross-checked against the SDR/control statements (ac-policy.md:3 says 'no end-user authentication' while the Cognito user pool exists). To close: Render every JSON field into the human view (or generate the MD from a schema-driven template), and add a parity test/reconcile invariant that parses each .md back and compares against the JSON.", - "closes_with": [ - "W8" - ] - }, - { - "frr_id": "CDS-CSO-FID", - "status": "Partially Implemented", - "implementation": "offering.json:3 fedramp_id flows into certification-overview-package.json and certification-package-overview.json (build-cpo.py:80).", - "evidence": [], - "gap": "No FedRAMP ID is assigned. Even once assigned, the wiring would not put it in 'all certification data': build-ocr.py:83 hardcodes its own placeholder string; the SDR, VDR reports, availability feed, policy index, SCN records and ksi-signal carry no FedRAMP ID field. To close: Make offering.json the single source of fedramp_id and stamp it into every generated artifact (OCR, SDR, VDR/VDT/AVI, SCN, availability, policy index, trust-center.json); add a reconcile invariant that every published artifact carries the same FedRAMP ID.", - "closes_with": [ - "W3", - "sam" - ] - }, + "status": "Implemented", + "implementation": "An availability monitor on GitHub Actions, independent of AWS (.github/workflows/availability-probe.yml, scripts/availability-probe.py), probes the website, the trust center, the certification data under /.well-known/, the Silk Reeling application and its Cognito sign-in every 15 minutes, keeps 35 days of history, and derives availability incidents (two or more consecutive failed probes of a service: start, end, failing check). It publishes JSON and a human-readable page to the repository's availability-status branch, served by GitHub, so the status stays readable when the offering is down; an ongoing incident fails the run, which notifies the operator. The deploy fails when that feed is missing or more than 2 hours old, and republishes it signed as /.well-known/availability.json with a Markdown twin (scripts/build-availability.py), which no longer records deploys as availability. History begins at the monitor's first run.", + "evidence": [ + { + "kind": "step", + "ref": "availability-probe.yml#Probe the core services" + }, + { + "kind": "step", + "ref": "availability-probe.yml#Publish the status feed to the availability-status branch" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Read the independent availability feed (fails when missing or stale)" + }, + { + "kind": "artifact", + "ref": ".well-known/availability.json" + }, + { + "kind": "test", + "ref": "tests/test_availability_probe.py::test_consecutive_failures_make_an_incident_and_a_single_one_is_transient" + }, + { + "kind": "test", + "ref": "tests/test_availability_probe.py::test_the_known_bad_stale_feed_fails_the_deploy_guard" + }, + { + "kind": "test", + "ref": "tests/test_availability_probe.py::test_the_monitor_runs_outside_aws_on_a_schedule_and_pushes_only_its_branch" + } + ] + }, { - "frr_id": "CDS-CSO-FRC", - "status": "Not Implemented", - "implementation": "No slot or process for FedRAMP Certification Reports: build-cpo.py PACKAGE_CONTENTS (L30-40) has no entry; no docs/ procedure.", - "evidence": [], - "gap": "No FedRAMP Certification Report has been received, and there is no mechanism to publish one unmodified within 2 weeks. To close: Add a package slot (store received report verbatim under data/, publish byte-identical with its hash, signed) and a runbook with a 2-week clock tracked as a decision/deadline item.", + "frr_id": "CDS-CSO-CBF", + "status": "Implemented", + "implementation": "Every JSON and CSV artifact the deploy publishes under /.well-known/ (the freshness-config list) gets a complete human-readable view, .view.md, giving every value under its JSON Pointer path (scripts/build-human-views.py). The build then parses each view back and fails unless it reproduces the JSON exactly, before anything is signed or published; the nightly does the same for the VDR files it republishes. The curated .md summaries are written from the same in-memory data in the same run. The policies are published as the Markdown documents themselves, indexed by the machine-readable policy index.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_a_view_reproduces_its_json_exactly" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_known_bad_a_view_that_differs_from_its_json_fails" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_a_json_the_view_cannot_represent_fails_closed" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_views_cover_every_deploy_published_json_in_the_governed_list" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_nightly_rebuilds_the_views_of_what_it_republishes" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the human-readable views and the trust manifest (format parity)" + }, + { + "kind": "step", + "ref": "evidence-nightly.yml#Rebuild the human-readable views (format parity)" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-manifest.json" + } + ] + }, + { + "frr_id": "CDS-CSO-FID", + "status": "Partially Implemented", + "implementation": "data/cds/offering.json is the one source of the FedRAMP ID (scripts/_offering.py). No ID is assigned, so it is FedRAMP's fallback, the provider name and acronym, suffixed so it cannot be mistaken for a real one, and flagged simulated (DEC-100). The CPO (serviceIdentification.fedRampPackageId and providerExtensions.fedRampId), the SDR and the OCR carry it, as do the issue index, the snapshot manifests, the FedRAMP Certification Reports index and the package submission log. The deploy gate scripts/check-fedramp-id.py fails the deploy when a report in its REPORTS list lacks it or carries another. The trust-center, scope and assessor files also carry it at top level (trust-center.json, trust-manifest.json, availability.json, policy-index.json, assessor-guide.json, simulated-assessment.json, agency-access-exercise.json, frr-evidence.json, and the independent availability feed as the deploy reads it), and are in REPORTS; a file named to the gate without a top-level fedRampId fails.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_fedramp_id_and_uei_are_the_offerings_and_flagged_simulated" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_gate_fails_a_report_with_another_fedramp_id" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_the_sdr_carries_the_offerings_fedramp_id" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#FedRAMP ID in every FedRAMP report (CDS-CSO-FID)" + }, + { + "kind": "decision", + "ref": "DEC-100" + }, + { + "kind": "test", + "ref": "tests/test_fedramp_id_trust.py::test_known_bad_a_site_file_without_a_fedramp_id_fails" + } + ], + "gap": "The rule covers all certification data, reports and notifications. The VDR family (VDR, VDT, AVI, history), the KSI signal, SCN records and incident notifications carry no FedRAMP ID yet. To close: each builder stamps _offering.fedramp_id() and adds its file to REPORTS in scripts/check-fedramp-id.py (one line each).", "closes_with": [ - "W4", - "sam" + "W2", + "W5", + "W6", + "W8" ] }, + { + "frr_id": "CDS-CSO-FRC", + "status": "Implemented", + "implementation": "FedRAMP Certification Reports received are stored verbatim under data/fedramp-certification-reports/ with the sha256 and date of receipt in register.json. Each deploy checks every report against its sha256 (an edited report fails the deploy), publishes it byte-identical under /.well-known/fedramp-certification-reports/, and writes a signed index recording when it was first published and whether that was within 2 weeks of receipt.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_committed_reports_are_published_byte_identical" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_modified_or_unregistered_report_fails" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#FedRAMP Certification Reports published unmodified (simulated FedRAMP)" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Publish FedRAMP Certification Reports byte-identical" + }, + { + "kind": "artifact", + "ref": ".well-known/fedramp-certification-reports.json" + } + ], + "simulated": { + "counterparty": "fedramp", + "how": "No FedRAMP counterpart exists. The one report is a plainly fake stand-in the operator wrote, flagged simulated in the register and the index." + } + }, { "frr_id": "CDS-CSO-HAD", - "status": "Not Implemented", - "implementation": "No snapshot mechanism: every artifact (including ongoing-certification-report.json) is overwritten in place each deploy; S3 versioning exists on the website bucket but versions are not exposed and are subject to lifecycle expiry (infrastructure/main.tf:148-200).", - "evidence": [], - "gap": "No snapshot of the certification data aligned to each OCR, and no retention for the duration of certification, and no access explanation. To close: At each OCR date, freeze the full package into an immutable, dated path (e.g. /.well-known/snapshots/2027-02-04/ with a manifest + signatures; S3 Object Lock), list snapshots in the trust center, and document access.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "On each OCR issue date the maintainer snapshots the certification data as published (with signatures) to /.well-known/snapshots// and writes a signed manifest of sha256s, listed in /.well-known/ocr-issues.json with an explanation of access; an issue fails if the core files are missing. The publishing role cannot delete, issued files are never overwritten, and the website sync excludes /.well-known/, so snapshots stay for the duration of certification.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_first_run_on_an_issue_date_freezes_the_report_and_snapshots_the_package" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_no_issue_without_the_certification_data_to_snapshot" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_tampered_issue_index_fails" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Issue the quarterly report when due (frozen, with a snapshot)" + }, + { + "kind": "artifact", + "ref": ".well-known/ocr-issues.json" + } ] }, { "frr_id": "CDS-CSO-IRP", - "status": "Partially Implemented", - "implementation": "policy-index.json and .md under /.well-known/ (scripts/build-policy-index.py): 28 policies with summary, owner, related practices, file, last update and version. Since W1 each policy's date and version (git:) come from its own last commit in full history; a shallow checkout is refused.", - "evidence": [], - "gap": "'Related FedRAMP Practices' are mostly Rev5 control families, not FedRAMP rules or KSIs. Procedures (runbooks, verification, deploy notes, architecture decisions) are not indexed. The policies themselves are served only from the repository, with no access explanation in the certification data, and the .md omits summary and version.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "policy-index.json and policy-index.md under /.well-known/ (scripts/build-policy-index.py) list every policy (docs/policies) and procedure (docs/procedures, docs/runbooks, the verification and deploy procedures) with its name, file and URL, summary, word count, version (git:) and date of last update from its own last commit (a shallow checkout is refused), and related FedRAMP practices as concrete rule and KSI IDs from the pinned corpus and KSI catalog (a mapping that matches nothing fails the build). The documents themselves are published beside the index under /.well-known/policies/, and the index states how to access them.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_every_entry_has_the_seven_fields_and_a_url" + }, + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_procedures_are_indexed_beside_policies" + }, + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_related_practices_are_real_rule_and_ksi_ids" + }, + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_a_practice_prefix_that_matches_nothing_fails" + }, + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_the_markdown_carries_every_field_of_every_entry" + }, + { + "kind": "test", + "ref": "tests/test_policy_index.py::test_the_deploy_publishes_the_documents" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build CDS certification-data artifacts (availability, policy index, review calendar)" + }, + { + "kind": "artifact", + "ref": ".well-known/policy-index.json" + } ] }, { @@ -328,206 +624,583 @@ }, { "frr_id": "CDS-CSO-PUB", - "status": "Partially Implemented", - "implementation": "certification-overview-package.json and .md under /.well-known/ (scripts/build-cds-overview.py from data/cds/offering.json): service and deployment model, business category, sales and security contacts, product website, description, service list, documentation and trust-center URLs. The logo is a real PNG at /assets/images/brand/logo.png and /trust/ serves its index (W1).", - "evidence": [], - "gap": "No UEI (no SAM.gov registration) and no FedRAMP ID (none exists; the provider name and acronym stand in, CDS-CSO-FID). The next-OCR date is now+91 days on every deploy, so it recedes and never arrives (W4 fixes the calendar). The secure configuration guide is not served from the site (W10). The documentation overview and the trust-center link are one field. Current assessment service: none. To close: Register in SAM.gov for a UEI; issue the OCR on a fixed calendar; serve the secure configuration guide from the site; split the documentation overview from the trust-center link.", - "closes_with": [ - "W4", - "W10", - "sam" - ] + "status": "Implemented", + "implementation": "The CPO (JSON and Markdown, public under /.well-known/) publishes every listed item that applies: the FedRAMP ID (FedRAMP's fallback, flagged simulated), service and deployment model, business categories, a UEI (simulated, flagged sam-gov: no SAM.gov registration), sales and security contacts (the contact page and security.txt; no email address), the product website, the logo, the description, each service with its security category, the secure configuration guidance link, the documentation overview, the trust center landing page (https://samaydlette.com/trust/index.html) with access instructions, the next OCR date from the fixed calendar, and the current independent assessment service: none FedRAMP Recognized, stated as such, with the simulated assessor named. It is rebuilt on every deploy and daily by the package maintainer.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Certification Package Overview (CPO)" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Rebuild the SDR, OCR and CPO at the deployed commit" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_publishes_the_fixed_cycle_dates" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_fedramp_id_and_uei_are_the_offerings_and_flagged_simulated" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_trust_center_entry_is_the_landing_page_with_access_instructions" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_secure_configuration_guidance_links_the_published_guide" + } + ], + "simulated": { + "counterparty": "sam-gov", + "how": "No SAM.gov registration exists, so the UEI is a plainly fake placeholder from data/cds/offering.json, flagged under providerExtensions.simulated in the published CPO. Nothing is registered or sent; every other item is real." + } }, { "frr_id": "CDS-CSO-RIS", - "status": "Partially Implemented", - "implementation": "Every artifact the deploy publishes passes a publication redaction gate (scripts/check-published-redaction.py, W0) that fails on an AWS account ID; account IDs in ARNs are replaced with ACCOUNT before publication. The trust center and boundary map also refuse ARNs and email addresses.", - "evidence": [], - "gap": "No written disclosure standard says what is public and what is need-to-know; IAM role and policy detail, the API endpoint ID and the CloudFront domain are published without a recorded determination. On sufficiency, the package lacks an independent assessment and the rule records are not yet in the SDR.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "Sufficiency: the package carries the SDR with every applicable rule and KSI and the simulated assessor's independent results, the CPO, the boundary map, inventory, vulnerability reports and the policies, indexed in the signed trust manifest. Sensitivity: the information sharing and disclosure standard (docs/procedures/information-sharing.md, DEC-166) says what is never published (account IDs, secrets, personal email addresses, IAM user names, raw logs, requester identities), what is published on purpose and why that is not likely to enable an attacker. The publication redaction gate fails the deploy on an AWS account ID in anything published, including the views and the policy documents.", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-166" + }, + { + "kind": "test", + "ref": "tests/test_published_redaction.py::test_gate_fails_the_known_bad_fixture_without_printing_the_number" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Publication redaction gate (no AWS account ID)" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-manifest.json" + } ] }, { "frr_id": "CDS-CSO-RPS", - "status": "Partially Implemented", - "implementation": "All data is shared publicly; COP trust_center_status says so (certification-overview-package.json), trust page intro explains the self-attested context.", - "evidence": [], - "gap": "The artifact requires an explanation of if/how information is shared and the provider's determination that public sharing will not likely have an adverse effect. There is a statement of public sharing but no documented adverse-effect determination, and the redaction practice is inconsistent (see CDS-CSO-RIS). To close: Publish a short sharing statement: what is public, to whom else data goes, and the recorded determination (decision record in data/decisions.json with decided_by/on and review date) that it is not adverse.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "The whole package is public. The information sharing and disclosure standard (docs/procedures/information-sharing.md, published under /.well-known/policies/) explains what is shared, with whom (everyone, by HTTPS GET), and records the operator's determination (DEC-166) that public sharing will not likely have an adverse effect on the offering. The trust page links it.", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-166" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_trust_page_indexes_the_data_and_says_how_to_get_access" + }, + { + "kind": "artifact", + "ref": ".well-known/policy-index.json" + } ], - "may_rationale": "Exercised. The whole package is public: the system demonstrates 20x openly and holds no federal customer data. The determination that public sharing will not likely harm the offering is recorded with the sharing statement." + "may_rationale": "Exercised. The whole package is public: the system demonstrates 20x openly and holds no federal customer data. The determination that public sharing will not likely harm the offering is DEC-166, published with the sharing statement." }, { "frr_id": "CDS-CSO-SVC", - "status": "Partially Implemented", - "implementation": "https://samaydlette.com/.well-known/certification-overview-package.json services[] (2 entries) + .md table; source data/cds/offering.json services.", - "evidence": [], - "gap": "List exists and names the two services, but security category is a uniform label ('FIPS-199 Moderate (FedRAMP 20x Class C)') rather than each service's own category (the system categorization is C low / I moderate / A low; component C values range not-applicable..moderate). It does not say what is NOT included (e.g. the optional LLM feedback is mentioned, but third-party-hosted podcast audio, the MediaPipe CDN/model hosts, newsletter/feed are not classified in or out). No separate human-readable page on the trust center. To close: Give each service its own C/I/A category derived from the inventory components it contains, add an explicit 'not included' list, and render the list on the trust page.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "The CPO lists each service (certifiedServices) with its own FIPS 199 category, high-water mark and rationale, and the boundary groups it is made of (providerExtensions.services), plus an explicit list of what is not included (providerExtensions.notIncluded); its Markdown rendering shows the same table. The builder fails when a service's category exceeds the system's or names a boundary group that is not in the boundary classification.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_each_service_has_its_own_category_and_the_list_says_what_is_not_included" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_bad_service_list_fails" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Certification Package Overview (CPO)" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + } ] }, { "frr_id": "CDS-CSO-UTC", - "status": "Partially Implemented", - "implementation": "https://samaydlette.com/trust/index.html (renders https://samaydlette.com/.well-known/trust-center.json) + signed artifacts under /.well-known/.", - "evidence": [], - "gap": "A trust center exists, but it is not FedRAMP-compatible: it does not meet CDS-TRC-AAI (no agency access inventory), CDS-TRC-ACL (no viewer-level access logging or summaries), CDS-TRC-PAC (no documented programmatic index of all data), and it is not the 'complete and definitive source' (FRD-TRC): policies live on GitHub, COP/availability/policy-index/OCR are not listed on the trust page. To close: Close the CDS-TRC-* gaps below and make the trust center list and serve every piece of certification data (including policies) from one place.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "The trust center is https://samaydlette.com/trust/index.html with the certification data under /.well-known/. It is the single definitive source: the signed trust manifest (trust-manifest.json, generated from the governed artifact list on every deploy) lists every artifact with URL, media type, cadence, signature and signer and its human-readable forms, plus every policy and procedure, served from the same site. It meets the trust-center rules recorded here: agency access inventory (CDS-TRC-AAI), access logging with summaries (CDS-TRC-ACL), human-readable and machine-readable formats (CDS-TRC-HMR), documented programmatic access (CDS-TRC-PAC), self-service access (CDS-TRC-SSM) and uptime reported from outside AWS (CDS-TRC-USH).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_manifest_lists_every_governed_artifact_with_its_signature" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_trust_page_indexes_the_data_and_says_how_to_get_access" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the human-readable views and the trust manifest (format parity)" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-manifest.json" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-center.json" + } ] }, { "frr_id": "CDS-TRC-AAI", - "status": "Not Implemented", - "implementation": "Access is anonymous public GET; no identity, registration or access inventory exists anywhere in scripts/ or infrastructure/.", - "evidence": [], - "gap": "No inventory or history of federal agency users or systems with access; no way to give one to FedRAMP; no explanation artifact. To close: Add an access tier for agencies (e.g. Cognito or OIDC federation with agency IdPs / API keys per agency system) for the full package; record every grant/revoke in an append-only register (who, agency, when, by whom) and document how FedRAMP requests it. An empty inventory with the mechanism live would satisfy the rule today.", - "closes_with": [ - "W8" - ] + "status": "Implemented", + "implementation": "data/agency-access.json is the append-only register of agency access requests, grants, denials and withdrawals, naming agencies and systems, never people (a record with an email address fails). scripts/agency-access.py derives the current inventory and the full history from it; every deploy validates it and fails on an overdue FedRAMP denial notice. The package is public, so the register holds only agencies that asked to be on record; it is empty today. FedRAMP requests the inventory through the agency access form or the security contact, and receives `agency-access.py inventory` output (procedure: docs/procedures/agency-access.md, DEC-165).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_inventory_and_history_follow_grants_and_withdrawals" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_known_bad_the_register_never_names_a_person" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_the_committed_register_is_valid_and_has_nothing_overdue" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Agency access register check and simulated-agency exercise" + }, + { + "kind": "artifact", + "ref": ".well-known/agency-access-exercise.json" + }, + { + "kind": "decision", + "ref": "DEC-165" + } + ], + "simulated": { + "counterparty": "agency", + "how": "No agency has asked. Every deploy runs the access procedure against plainly fictional agencies (data/agency-access-exercise.json: 'Department of Hypothetical Affairs (simulated)' and others), with grants, a withdrawal, an inventory request from FedRAMP and denials whose FedRAMP notices are on time, late and overdue, and fails unless the 5-business-day clock (weekends and US federal holidays skipped) reports each outcome expected. Nothing is sent to anyone; the log is published as agency-access-exercise.json." + } }, { "frr_id": "CDS-TRC-ACL", - "status": "Partially Implemented", - "implementation": "S3 server access logging on the website bucket (infrastructure/logging.tf:114) to a log bucket retained 400 days (logging.tf:59).", - "evidence": [], - "gap": "S3 server access logs only see origin fetches; CloudFront edge hits are not logged (no logging_config on the distribution, bootstrap/cloudfront.tf:233-311), so most access to certification data is invisible. No access summaries are produced or stored; no explanation of how parties obtain their log information. To close: Enable CloudFront standard (or real-time) logging for /.well-known/ and /trust/, build a scheduled job that writes monthly access summaries (per artifact, per requester/agency once authenticated) retained >= 6 months, and document how a party requests its records.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "CloudFront standard logging (v2) records every request to the site with a field allowlist that excludes IP address, forwarded-for, port, cookies, query string, user agent and referrer (infrastructure/bootstrap/trust-access-logs.tf). Records go to the encrypted, non-public access-log bucket and expire after 90 days (infrastructure/logging.tf). On every deploy, scripts/check-edge-access-logging.py fails the deploy unless that delivery exists and logs only allowlisted fields, and scripts/build-access-summary.py counts the requests to /.well-known/ and /trust/ (CloudFront cannot limit logging by path, so the limit is applied here and every other record is discarded) into monthly summaries per artifact, response class and country, published signed at /.well-known/access-summary.json with a Markdown twin and carried forward for 13 months. A party can ask for the summaries and for the records of its own requests, identified by the times and paths it gives, since no requester identity is logged (DEC-160); the trust page's privacy notice says so.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#Check edge access logging and build the access summary" + }, + { + "kind": "artifact", + "ref": ".well-known/access-summary.json" + }, + { + "kind": "test", + "ref": "tests/test_edge_access_logging.py::test_the_known_bad_fixture_fails_for_identifying_fields" + }, + { + "kind": "test", + "ref": "tests/test_edge_access_logging.py::test_only_trust_paths_are_counted_and_nothing_identifying_survives" + }, + { + "kind": "test", + "ref": "tests/test_edge_access_logging.py::test_a_month_younger_than_six_is_never_dropped" + }, + { + "kind": "test", + "ref": "tests/test_edge_access_logging.py::test_raw_edge_records_expire_after_90_days" + }, + { + "kind": "decision", + "ref": "DEC-160" + } ] }, { "frr_id": "CDS-TRC-HMR", - "status": "Partially Implemented", - "implementation": "JSON + .md twins for COP, CPO, SDR, OCR, availability, policy index, VDR (https://samaydlette.com/.well-known/*.md return 200, text/markdown); trust page renders trust-center.json and boundary-map.json.", - "evidence": [], - "gap": "ksi-signal.json, iiw.csv and boundary-map.json have no full human-readable twin; SDR .md omits most of the record; the .md files are not linked from the trust page; policies are not viewable/downloadable from the trust center. To close: Generate complete human views for every artifact and link both formats for each from one trust-center index.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "Every JSON and CSV artifact the deploy publishes has a complete human-readable view (.view.md, checked to reproduce the JSON), most have a curated .md summary, and the policies and procedures are published as Markdown. The trust manifest lists both formats for each artifact and the trust page links the manifest; everything can be viewed in a browser and downloaded with a GET. The runtime signal and the nightly beacon, published outside the deploy, are rendered human-readably by the trust page from the live JSON.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_a_view_reproduces_its_json_exactly" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_manifest_names_only_human_views_that_exist" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_views_cover_every_deploy_published_json_in_the_governed_list" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the human-readable views and the trust manifest (format parity)" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-manifest.json" + } ] }, { "frr_id": "CDS-TRC-PAC", - "status": "Partially Implemented", - "implementation": "All data is plain HTTPS GET under /.well-known/ (fetched live); the trust page 'Verify' section shows curl + cosign usage; docs/ksi-signal.md documents the signal schema.", - "evidence": [], - "gap": "No signed machine-readable manifest lists every certification artifact with URL, media type, schema and signature, and no programmatic-access documentation exists to cite. Human-readable policies are served only from the repository.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "The signed trust manifest (/.well-known/trust-manifest.json and .md) is the documented programmatic index of all certification data: each artifact's URL, media type, cadence, schema, signature bundle and signing identity, its human-readable forms, every policy and procedure (Markdown under /.well-known/policies/), and how to fetch and verify (HTTPS GET with read-only CORS; cosign verify-blob against the named identity). The assessor guide gives the command for each piece of evidence.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_manifest_lists_every_governed_artifact_with_its_signature" + }, + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_manifest_names_only_human_views_that_exist" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the human-readable views and the trust manifest (format parity)" + }, + { + "kind": "artifact", + "ref": ".well-known/trust-manifest.json" + }, + { + "kind": "artifact", + "ref": ".well-known/assessor-guide.json" + } ] }, { "frr_id": "CDS-TRC-SSM", - "status": "Not Implemented", - "implementation": "Checked: no account, API-key, or access-management features exist (public anonymous access only).", - "evidence": [], - "gap": "No features for parties to provision or manage their own users' and services' access, and no documentation URL. To close: With the agency access tier from CDS-TRC-AAI, let an agency administrator self-register and manage its own users/service credentials (Cognito groups or API keys scoped per agency), and document it. If staying fully public, document that anonymous access requires no provisioning (weaker).", - "closes_with": [ - "W8" - ] + "status": "Implemented", + "implementation": "Parties provision their own access directly: all data is public, so a user or service needs no account or key (the trust manifest documents how to fetch and verify). An agency that wants to be on record files the agency access issue form (.github/ISSUE_TEMPLATE/agency-access.yml) itself, and withdraws or asks for the inventory the same way; the trust page's Request access section says how (docs/procedures/agency-access.md, DEC-165).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_trust_page_indexes_the_data_and_says_how_to_get_access" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_inventory_and_history_follow_grants_and_withdrawals" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Agency access register check and simulated-agency exercise" + }, + { + "kind": "artifact", + "ref": ".well-known/agency-access-exercise.json" + }, + { + "kind": "decision", + "ref": "DEC-165" + } + ], + "simulated": { + "counterparty": "agency", + "how": "No agency has asked. Every deploy runs the access procedure against plainly fictional agencies (data/agency-access-exercise.json: 'Department of Hypothetical Affairs (simulated)' and others), with grants, a withdrawal, an inventory request from FedRAMP and denials whose FedRAMP notices are on time, late and overdue, and fails unless the 5-business-day clock (weekends and US federal holidays skipped) reports each outcome expected. Nothing is sent to anyone; the log is published as agency-access-exercise.json." + } }, { "frr_id": "CDS-TRC-USH", - "status": "Partially Implemented", - "implementation": "The trust center is a static public site on CloudFront; /trust/ and every directory URL serve their index through a CloudFront Function (W1), and /.well-known/*.json are served directly.", - "evidence": [], - "gap": "Availability of the trust center is not measured independently (CDS-CSO-AVR), there is a single origin with no failover (DEC-009), and the page's content needs JavaScript.", - "closes_with": [ - "W8" + "status": "Implemented", + "implementation": "The certification data is static, signed files under /.well-known/ served from the CloudFront edge (cached, with AWS Shield Standard), readable as plain JSON and Markdown without JavaScript and, since the deploy checks it, with CORS for programs on any origin. Interruptions are measured from outside AWS every 15 minutes, and an ongoing one fails the monitor's run, which notifies the operator (CDS-CSO-AVR); the status itself is served by GitHub, so it stays available during an outage. The single origin without failover is an accepted risk (DEC-009).", + "evidence": [ + { + "kind": "step", + "ref": "availability-probe.yml#Alert on an ongoing availability incident" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Read the independent availability feed (fails when missing or stale)" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Check /.well-known/ JSON response headers (CORS, Content-Type, nosniff)" + }, + { + "kind": "artifact", + "ref": ".well-known/availability.json" + }, + { + "kind": "test", + "ref": "tests/test_availability_probe.py::test_an_ongoing_incident_fails_the_monitor_run_after_publishing" + }, + { + "kind": "decision", + "ref": "DEC-009" + } ] }, { "frr_id": "CDS-UTC-AAD", - "status": "Not Implemented", - "implementation": "Checked: no access-request process, denial path or FedRAMP-notification procedure in docs/policies, docs/runbooks or data/decisions.json.", - "evidence": [], - "gap": "No procedure to notify FedRAMP within 5 business days of denying an agency access request, and no tracking of the clock. To close: Write the access-request/denial procedure (who decides, record as a decision kind, auto-compute the 5-business-day deadline, notify FedRAMP via its published channel) and add it to the policy index.", - "closes_with": [ - "W8" - ] + "status": "Implemented", + "implementation": "The agency access procedure (docs/procedures/agency-access.md, DEC-165) requires the operator to notify FedRAMP within 5 business days of denying an agency access request and to record the notice date in the register. scripts/agency-access.py computes each deadline (weekends and US federal holidays skipped) and every deploy fails when a denial's notice is overdue. Since everything is public, a denial would be rare; the clock is exercised on every deploy with simulated denials.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_business_days_skip_weekends_and_federal_holidays" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_known_bad_an_unnotified_denial_past_five_business_days_fails" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_the_exercise_observes_every_expected_outcome_on_any_day" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Agency access register check and simulated-agency exercise" + }, + { + "kind": "artifact", + "ref": ".well-known/agency-access-exercise.json" + }, + { + "kind": "decision", + "ref": "DEC-165" + } + ], + "simulated": { + "counterparty": "agency", + "how": "No agency has asked. Every deploy runs the access procedure against plainly fictional agencies (data/agency-access-exercise.json: 'Department of Hypothetical Affairs (simulated)' and others), with grants, a withdrawal, an inventory request from FedRAMP and denials whose FedRAMP notices are on time, late and overdue, and fails unless the 5-business-day clock (weekends and US federal holidays skipped) reports each outcome expected. Nothing is sent to anyone; the log is published as agency-access-exercise.json." + } }, { "frr_id": "CDS-UTC-AGA", - "status": "Partially Implemented", - "implementation": "Everything is public, so any agency can obtain the package without asking.", - "evidence": [], - "gap": "Neither artifact exists: no URL/explanation of how to request the package (beyond the public data) and no explanation of how the provider decides whether to share. To close: Add a 'Request access' section to the trust page (contact, what is provided, turnaround) and a sharing-decision policy entry.", - "closes_with": [ - "W8" - ] + "status": "Implemented", + "implementation": "Agencies get the whole package without asking, since it is public. The trust page's Request access section says what is provided, how to ask to be on record (the agency access form, or privately via security.txt) and the turnaround, and links the procedure (DEC-165) and the sharing standard that explains how sharing is decided (DEC-166).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_trust_data.py::test_the_trust_page_indexes_the_data_and_says_how_to_get_access" + }, + { + "kind": "test", + "ref": "tests/test_agency_access.py::test_the_exercise_writes_a_log_that_says_it_is_simulated" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Agency access register check and simulated-agency exercise" + }, + { + "kind": "artifact", + "ref": ".well-known/agency-access-exercise.json" + }, + { + "kind": "decision", + "ref": "DEC-165" + } + ], + "simulated": { + "counterparty": "agency", + "how": "No agency has asked. Every deploy runs the access procedure against plainly fictional agencies (data/agency-access-exercise.json: 'Department of Hypothetical Affairs (simulated)' and others), with grants, a withdrawal, an inventory request from FedRAMP and denials whose FedRAMP notices are on time, late and overdue, and fails unless the 5-business-day clock (weekends and US federal holidays skipped) reports each outcome expected. Nothing is sent to anyone; the log is published as agency-access-exercise.json." + } }, { "frr_id": "CMU-CSO-CAT", - "status": "Not Implemented", - "implementation": "Checked infrastructure/cognito.tf, silk-reeling.tf and bootstrap/cloudfront.tf: tenant-facing defaults use standard endpoints; no list of default modules exists.", - "evidence": [], - "gap": "No configuration that defaults agency tenants (Silk Reeling users/tenants) to validated modules, and no list of default modules with validation status. To close: Define the agency-tenant default (FIPS endpoints, TLS policy on CloudFront/API Gateway, KMS CMKs) in Terraform, and publish the generated list of default modules with CMVP status.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The app's tenants (Silk Reeling users) get validated cryptography by default where AWS offers it, set in Terraform: the app's Lambda environment and every app log group are encrypted with a customer-managed key on the AWS KMS HSM (CMVP #4884) with rotation on, and viewer and origin TLS are fixed at TLS 1.2 or later. AWS offers no validated-module option for a distribution's viewer TLS, an HTTP API's endpoint or the Cognito Hosted UI (DEC-152). The published module list marks each service's agency-tenant default.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_agency_tenant_defaults_use_the_validated_kms_hsm_in_terraform" + }, + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "decision", + "ref": "DEC-152" + } ] }, { "frr_id": "CMU-CSO-CMD", - "status": "Partially Implemented", - "implementation": "certification-package-overview.json cryptographic_modules (4 entries, from offering.json); research/authorization-boundary.html#fips (L86-91); boundary-map.json fips_modules.", - "evidence": [], - "gap": "Not per service and not complete: Silk Reeling's Cognito, API Gateway TLS, Lambda runtime TLS, DynamoDB/SQS/SNS encryption, Secrets Manager, CloudTrail log-file validation, Route 53 DNSSEC signing are not listed. Validation status is imprecise: 'FIPS-validated cipher suites' for CloudFront TLS is not a CMVP status (no module name/cert number); S3 SSE-S3 has no validation status; no CMVP certificate numbers anywhere. Stale: lists an 'app secret' CMK (removed by SCN-2026-006) and omits the silk_reeling CMK (silk-reeling.tf:50). To close: Build the module list from the inventory per service: for each AWS service used, cite the module (e.g. AWS-LC FIPS, KMS HSM) with CMVP certificate number and whether it is validated or an update stream, from AWS's published FIPS documentation; generate it, don't hand-maintain it, and fail the build when a new crypto-using service appears unmapped.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The Secure Configuration Guide publishes the cryptographic module used by each service (CloudFront and API Gateway TLS, Cognito, KMS, Lambda, CloudWatch Logs, SNS, Secrets Manager, S3, SQS, DynamoDB, CloudTrail, Route 53 DNSSEC, the IAM OIDC provider, Sigstore signing), with the CMVP certificate and its status where AWS publishes one (the AWS KMS HSM, FIPS 140-3 Level 3, certificate #4884, read from NIST's CMVP page) and says plainly where AWS publishes none. The list is generated each deploy from data/crypto-modules.json joined with the inventory; the build fails when the inventory holds a component type with no module mapping.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the secure configuration guide (SCG, cryptographic modules)" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_an_unmapped_component_type_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_every_validated_module_cites_its_cmvp_certificate_page" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_every_inventory_type_the_builder_knows_is_mapped" + } ] }, { "frr_id": "CMU-CSO-UVM", - "status": "Partially Implemented", - "implementation": "Customer-managed keys use AWS KMS (FIPS 140-3 HSM): infrastructure/main.tf:532,605,648; silk-reeling.tf:50,207.", - "evidence": [], - "gap": "Validated modules are not shown for the paths that would protect customer data in transit: CloudFront, API Gateway and Cognito are reached via standard (non-FIPS) endpoints with no evidence their TLS module is validated; buckets use SSE-S3 rather than SSE-KMS; Sigstore signing is non-validated (not customer data, but documented). To close: Confirm and document each customer-data path's module validation from AWS FIPS docs; use FIPS endpoints where offered (cognito-idp-fips, API Gateway via FIPS endpoint, KMS-fips), move data-bearing stores to SSE-KMS, and record any remaining non-validated path as a decision.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Where a validated module is available for data the app holds, it is used: the app's Lambda environment and log groups, the alert topic and the signing keys are protected by customer-managed keys on the AWS KMS HSM (CMVP #4884, FIPS 140-3 Level 3). The paths where AWS publishes no CMVP module (viewer TLS on CloudFront, the HTTP API, the Cognito Hosted UI; SSE-S3, SSE-SQS and AWS-owned keys on stores that hold no customer data; the Lambda runtime's outbound TLS) are listed per service and accepted by decision (DEC-152). The system holds no federal customer data.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "decision", + "ref": "DEC-152" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_paths_without_a_published_validation_are_covered_by_a_decision" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_agency_tenant_defaults_use_the_validated_kms_hsm_in_terraform" + } ] }, { "frr_id": "CPO-CSO-MTD", - "status": "Partially Implemented", - "implementation": "certification-package-overview.json accountable_official (name, title, email) and metadata.last_updated / source_of_update (build-cpo.py:66-72).", - "evidence": [], - "gap": "Version is the constant 'live (regenerated each deploy)' (build-cpo.py:69), which identifies nothing; fields are not in the schema's names. To close: Use a real version (e.g. semver bumped on content change, or commit SHA + signal_id) and map to the schema's metadata fields.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "The CPO carries metadata.accountableOfficial (name, title, contact), metadata.version (semver: unchanged content keeps its version, changed content bumps it, judged by a sha256 of the content), metadata.lastUpdated and metadata.updateSource.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_version_is_semver_and_bumps_only_on_change" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_validates_against_fedramps_schema" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Certification Package Overview (CPO)" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + } ] }, { "frr_id": "CPO-CSO-OSA", - "status": "Not Implemented", - "implementation": "certification-package-overview.json independent_assessment.status = 'N/A ... no FedRAMP Recognized independent assessment service engaged' (build-cpo.py:97-102).", - "evidence": [], - "gap": "No independent assessment, so no assessor-supplied overall summary. To close: Engage a FedRAMP Recognized assessment service, receive its IVV-IAS-OSA summary (signed assessor record, as _assessor.py already supports), and embed it unmodified in the CPO.", - "closes_with": [ - "sam" - ] + "status": "Implemented", + "implementation": "The CPO (certification-package-overview.json and .md) carries the assessor's overall summary (IVV-IAS-OSA) under providerExtensions.independentAssessment.overallSummary, quoted verbatim from the signed assessment set: rule and KSI pass, observation and fail counts, failures, areas of dispute and observations. scripts/build-cpo.py requires the set, verifies it (scripts/_assessor.load_assessment) and fails without a summary; the daily package maintainer rebuilds the CPO from the same published set. The schema's `assessor` object is left out because the simulated assessor has no FedRAMP assessor ID, and none is invented.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_overall_summary_is_the_assessors_record_verbatim" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_known_bad_an_assessment_without_a_summary_fails" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_cpo_refuses_to_build_without_the_assessment" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_deploy_and_the_maintainer_give_the_cpo_the_assessment" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Certification Package Overview (CPO)" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Rebuild the SDR, OCR and CPO at the deployed commit" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + }, + { + "kind": "artifact", + "ref": ".well-known/simulated-assessment.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "The overall summary is written on every deploy by Totally Real Assessment Services, LLC (simulated), a reusable workflow in this repository (simulated-assessor.yml) that signs its set keylessly under its own pinned workflow identity. build-cpo.py quotes the summary record only after the set's signature verifies against that identity and every record's hash matches, and refuses to build without it. It is not a FedRAMP Recognized assessment service and the CPO says so; only the assessor is simulated." + } }, { "frr_id": "CPO-CSO-OVR", - "status": "Partially Implemented", - "implementation": "https://samaydlette.com/.well-known/certification-package-overview.json + .md (scripts/build-cpo.py).", - "evidence": [], - "gap": "Does not validate against FedRAMP's CPO schema (vendored infrastructure/schemas/fedramp-2026-06-24/...certification-package-overview...: running scripts/_fedramp_schema.validate on the live file: wrong $schema, missing serviceIdentification, serviceProperties, contactInformation) even though its 'schema' field names it. Of the required content: CDS-CSO-PUB is only linked (and partial); IRP only linked; MAS-CSO-IIR is a count and a link; MAS-CSO-FLO and MAS-CSO-TPR are absent (only named in a 'reference' string); CMU-CSO-CMD is partial; IVV-CSO-ICP is 'N/A'. To close: Rebuild the CPO in FedRAMP's schema shape (serviceIdentification, serviceProperties, contactInformation, assessor, certifiedServices, thirdPartyInformationResources), validate it with write_validated() like the VDR reports, and include or reference the MAS flow/TPR data and the assessor's IVV material.", - "closes_with": [ - "W3", - "sam" + "status": "Implemented", + "implementation": "scripts/build-cpo.py writes the CPO in FedRAMP's 2026-06-24 schema through write_validated, with JSON and Markdown from the same data, carrying what each listed rule requires: metadata (CPO-CSO-MTD); the public information (CDS-CSO-PUB) including the trust center and secure configuration guidance; each service and its security category (CDS-CSO-SVC); the policy and procedure index (CDS-CSO-IRP), the KSI signal inventory and the Minimum Assessment Scope (MAS-CSO-IIR, MAS-CSO-FLO) as repositories; thirdPartyInformationResources (MAS-CSO-TPR); the cryptographic modules (CMU-CSO-CMD); and the assessment results with the assessor's overall summary (IVV-CSO-ICP, CPO-CSO-OSA). The simulated package submission refuses a CPO missing the trust center, secure configuration guidance, third-party resources or assessor summary.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_validates_against_fedramps_schema" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_the_cpo_with_group_5_fields_validates_against_fedramps_schema" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_third_party_resources_are_the_decided_records" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_incomplete_or_inconsistent_package_is_not_submitted" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Certification Package Overview (CPO)" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Rebuild the SDR, OCR and CPO at the deployed commit" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + } ] }, { "frr_id": "CPO-CSX-CPM", - "status": "Partially Implemented", - "implementation": "The package (CPO, SDR, OCR, CDS artifacts) is rebuilt and published on every deploy to main; the VDR family is rebuilt twice daily.", - "evidence": [], - "gap": "Nothing guarantees a rebuild at least every 2 weeks: with no push to main for 14 days, the CPO, SDR and OCR go stale, and no freshness window covers them at that cadence.", - "closes_with": [ - "W4" + "status": "Implemented", + "implementation": "package-maintenance.yml runs daily, unattended, in its own environment: it fetches the published package and its inputs, verifies their signatures (fail closed), rebuilds the SDR, OCR and CPO at the deployed commit, signs and publishes them with a role that may write only those objects, and checks the edge serves them. Every deploy also runs it. The deploy's preflight fails if the role variable or environment is missing. The SDR, CPO and OCR have 14-day freshness windows (metadata.lastUpdated), alarmed by the evidence watchdog.", + "evidence": [ + { + "kind": "step", + "ref": "package-maintenance.yml#Rebuild the SDR, OCR and CPO at the deployed commit" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Package maintainer preflight" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_maintainer_runs_daily_and_the_package_windows_are_two_weeks_at_most" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_maintainer_preflight_fails_when_not_in_place" + }, + { + "kind": "artifact", + "ref": ".well-known/certification-package-overview.json" + } ] }, { @@ -575,85 +1248,209 @@ }, { "frr_id": "FRC-CSO-FCP", - "status": "Partially Implemented", - "implementation": "Target stated: Class C, Moderate, 20x (system-profile categorization in ksi-signal.json; CPO class/impact). Conformance self-report: trust-center.json profile summary 18 implemented / 16 partial / 38 not yet.", - "evidence": [], - "gap": "The profile is identified, but 'apply all relevant FedRAMP Practices' is not met: most applicable rules are partially implemented or not implemented (see these records), and docs/cr26-applicability.md still records some families as not applicable.", - "closes_with": [ - "W3", - "W10" + "status": "Implemented", + "implementation": "The target profile is identified: FedRAMP 20x, Program path, Class C, Moderate (data/system-profile.json; the CPO's certificationType and providerExtensions). Every applicable rule has a record in data/frr-records.json, and the deploy's completeness gate stops every deploy unless each record is Implemented or Not Applicable, so a deployed system applies all relevant FedRAMP practices.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#FedRAMP rules complete (no gaps)" + }, + { + "kind": "test", + "ref": "tests/test_frr_records.py::test_any_open_record_keeps_the_deploy_from_proceeding" + }, + { + "kind": "test", + "ref": "tests/test_frr_records.py::test_the_gate_runs_before_anything_is_applied" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } ] }, { "frr_id": "FRC-CSO-JSN", - "status": "Partially Implemented", - "implementation": "The VDT, AVI and VDR history are written through scripts/_fedramp_schema.write_validated against the vendored 2026-06-24 schemas and published (C3a, #496). The CPO, SDR and OCR are JSON but in their own field names.", - "evidence": [], - "gap": "Live CPO, SDR and OCR do not validate against the vendored FedRAMP schemas (validate(): cpo 4 errors, sdr 6, ocr 11 — wrong $schema, missing required top-level objects), and their builders do not call write_validated. No CORS: a GET with Origin: https://example.org returns no Access-Control-Allow-Origin, so browser apps on other domains cannot read the JSON. To close: Port build-cpo.py, build-sdr.py and build-ocr.py to the FedRAMP schemas and write them via write_validated(); add a CloudFront response-headers policy for /.well-known/* with Access-Control-Allow-Origin: * (GET/HEAD/OPTIONS) and add a live check of the headers in verify-published.sh.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "Every JSON document this offering supplies under a FedRAMP JSON schema (CPO, SDR, OCR and issued OCRs; the VDT, AVI and vulnerability history) is written through scripts/_fedramp_schema.write_validated against the vendored 2026-06-24 schemas: a document that fails is not written and the deploy stops, and the package submission re-validates the CPO, SDR and OCR. Public JSON under /.well-known/ is served by a CloudFront response-headers policy with read-only CORS (Access-Control-Allow-Origin: *, GET/HEAD/OPTIONS), Content-Type application/json and X-Content-Type-Options: nosniff (infrastructure/bootstrap/cloudfront.tf); every deploy checks those headers live and fails, before the SDR is built, when any is missing. SCN and incident JSON are not yet emitted; their builders must use write_validated when they are (SCN-CSO-HRM).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_validates_against_fedramps_schema" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_rolling_ocr_validates_and_carries_the_cycle" + }, + { + "kind": "test", + "ref": "tests/test_sdr.py::test_it_validates_against_fedramps_schema" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_incomplete_or_inconsistent_package_is_not_submitted" + }, + { + "kind": "test", + "ref": "tests/test_wellknown_headers.py::test_the_known_bad_fixture_fails_for_missing_cors" + }, + { + "kind": "test", + "ref": "tests/test_wellknown_headers.py::test_the_well_known_behaviour_sends_read_only_cors_and_nosniff" + }, + { + "kind": "test", + "ref": "tests/test_wellknown_headers.py::test_the_deploy_checks_the_headers_before_the_sdr" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Check /.well-known/ JSON response headers (CORS, Content-Type, nosniff)" + } ] }, { "frr_id": "FRC-CSO-MRA", - "status": "Partially Implemented", - "implementation": "Reconciliation gate (scripts/reconcile.py; live reconcile-report.json: 10 invariants held) blocks publishing inconsistent artifacts; signed provenance; AI-drafted third-party records are held at 'not recorded' until decided (data/third-party-components.json _note).", - "evidence": [], - "gap": "The reconciliation gate checks the inventory but not the package's claims: the CPO, SDR and OCR do not validate against their schemas, and no check covers URL liveness, the CMK list against the inventory, a fixed OCR calendar, or one FedRAMP ID across artifacts. W1 corrected the logo, policy dates, AC policy and CMK list, each with a test.", - "closes_with": [ - "W3", - "W8" + "status": "Implemented", + "implementation": "The operator keeps the package accurate with gates that fail the deploy: schema validation of the CPO, SDR and OCR; the reconciliation gate (one impact level and one inventory binding across the CPO, SDR, VDR and signal); one FedRAMP ID across the reports (check-fedramp-id.py); the package submission's completeness check (every applicable rule exactly once, one program); the FedRAMP Certification Reports' recorded sha256s; and a test that every link the CPO and OCR give resolves to something this repository publishes. The CCM calendar is validated on every build. Third-party-supplied records stay 'not recorded' until the operator decides them.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#Reconciliation gate (fail closed on drift)" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#FedRAMP ID in every FedRAMP report (CDS-CSO-FID)" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Simulated package submission to FedRAMP (nothing is sent)" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_every_link_in_the_cpo_and_ocr_resolves" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_incomplete_or_inconsistent_package_is_not_submitted" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_bad_calendar_fails_closed" + } ] }, { "frr_id": "FRC-CSO-PKG", - "status": "Not Implemented", - "implementation": "Package components exist publicly (CPO, SDR, OCR under /.well-known/), but nothing has been supplied to FedRAMP.", - "evidence": [], - "gap": "No package supplied to FedRAMP; the components that exist are incomplete (CPO/SDR/OCR fail FedRAMP schemas; SDR lacks FRR records and independent V&V). To close: Complete CPO/SDR/OCR per their rules and schemas, then submit through the FedRAMP application (FRC-APP-*).", - "closes_with": [ - "W3", - "sam" - ] + "status": "Implemented", + "implementation": "scripts/submit-package.py checks the package on every deploy: the CPO (complete per CPO-CSO-OVR, including the trust center, secure configuration guidance, third-party resources and assessor summary), the SDR with every applicable rule exactly once, and the OCR, each valid against FedRAMP's schema, one FedRAMP ID across them and certificationType 20x. It then supplies the package to a simulated FedRAMP intake and appends a signed entry to /.well-known/package-submission-log.json for each content change. Nothing is sent.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_a_complete_package_is_logged_once_per_content_change" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_incomplete_or_inconsistent_package_is_not_submitted" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Simulated package submission to FedRAMP (nothing is sent)" + }, + { + "kind": "artifact", + "ref": ".well-known/package-submission-log.json" + } + ], + "simulated": { + "counterparty": "fedramp", + "how": "FedRAMP is simulated: the package goes to simulated_fedramp_intake() in scripts/submit-package.py, a function that never touches the network and returns an obviously fake receipt. The only trace is the signed, published submission log; any unexpected outcome fails the deploy." + } }, { "frr_id": "FRC-CSO-POP", - "status": "Partially Implemented", - "implementation": "Checked: no application for either program exists (no FedRAMP ID, no Marketplace listing, no application in repo/docs); docs/cr26-applicability.md targets 20x Class C.", - "evidence": [], - "gap": "Met at assessment, but no test, workflow step, published artifact or decision record shows it. Labels mix programs (CPO/SDR impact_level_canonical 'Moderate (FedRAMP Rev 5; 20x Class C)'; SDR carries rev5_controls), which could read as seeking both. To close: When applying, apply for 20x only and state certificationType '20x Class C' alone in the CPO.", - "closes_with": [ - "sam" + "status": "Implemented", + "implementation": "The offering seeks FedRAMP 20x Program Certification only (DEC-107). The CPO states certificationType 20x; the package submission refuses any other; no label in the CPO or OCR names Rev5 as a program (the SDR's Rev5 view is the Moderate control baseline the 20x evidence maps onto).", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-107" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_the_cpo_seeks_20x_only" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_no_cpo_or_ocr_label_names_rev5_as_a_program" + }, + { + "kind": "test", + "ref": "tests/test_certification_cycle.py::test_an_incomplete_or_inconsistent_package_is_not_submitted" + } ] }, { - "frr_id": "FRC-CSX-MAS", - "status": "Partially Implemented", - "implementation": "The KSI signal applies the KSIs to the inventoried components (ksi-signal.json), derived from Terraform state.", - "evidence": [], - "gap": "The inventory misses external services the site loads from (cdn.jsdelivr.net, storage.googleapis.com) and some flows, and human-process KSIs are not applied per component; MAS-CSO-IIR and MAS-CSO-FLO carry the detail.", - "closes_with": [ - "W10" + "frr_id": "FRC-CSX-MAS", + "status": "Implemented", + "implementation": "Every KSI is applied to the whole Minimum Assessment Scope. The inventory now includes the external services the app and the VDR depend on (MAS-CSO-IIR), and each KSI's evidence domain names the component types it covers. KSIs with a per-component domain apply to every component of those types; inventory and documentation KSIs (PIY, CED) apply over the whole set. scripts/build-mas.py publishes the application per KSI and per component type in .well-known/minimum-assessment-scope.json, and fails the deploy when a component type is in no KSI's per-component domain and has no stated whole-set reason (static pages and the state lock table carry one).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_mas.py::test_every_ksi_applies_and_every_component_type_is_covered" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_component_type_in_no_ksi_domain_fails" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_audit_trail_is_in_the_logging_ksi_domain" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the Minimum Assessment Scope" + }, + { + "kind": "artifact", + "ref": ".well-known/minimum-assessment-scope.json" + } ] }, { "frr_id": "FRC-CSX-VVK", "status": "Partially Implemented", - "implementation": "Terraform plans are checked against the OPA policies on every deploy, and the runtime Lambda re-evaluates the same Rego against live configuration for object stores and the distribution daily (ksi-signal-runtime.json).", + "implementation": "Terraform plans are checked against the OPA policies on every deploy, and the runtime Lambda re-evaluates the same Rego against live configuration daily. The SDR counts the automated methods in place for each KSI (plan gate, plus runtime only when the signed runtime signal verifies and is fresh).", "evidence": [], - "gap": "Class C requires at least two automated methods for each KSI. The runtime check covers only some component types, and no record counts the automated methods per KSI to show two exist for each.", + "gap": "On the latest inputs 34 KSIs have two automated methods, 3 have one, and 9 have none (KSI-CED-RAT, KSI-IAM-AAM, KSI-IAM-APM, KSI-IAM-ELP, KSI-IAM-JIT, KSI-IAM-SNU, KSI-IAM-SUS, KSI-SCR-MIT, KSI-SCR-MON). To close: a second automated method for the 3, and two for the 9.", "closes_with": [ "W7" ] }, { "frr_id": "FRC-CSX-VVR", - "status": "Partially Implemented", - "implementation": "scripts/_frr.py checks the rule records automatically on every build: the set matches the pinned corpus, and every piece of evidence cited resolves to a test, workflow step, published artifact or decision.", - "evidence": [], - "gap": "Resolution shows the evidence exists, not that it passed for the rule: the records are not yet tied to test results (conformance-results.json) or published in the SDR.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "scripts/_frr.py validates the rule records on every build (set matches the pinned corpus, every cited piece of evidence resolves). In addition the unit-test job runs pytest with JUnit output and scripts/check-frr-evidence.py fails the deploy unless every test cited as evidence for a rule passed (a skipped or missing cited test is not a pass), and publishes the result per record (frr-evidence.json). The simulated assessor then re-runs the cited tests and re-checks every step, decision and artifact independently.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_frr_evidence.py::test_known_bad_a_failing_cited_test_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_frr_evidence.py::test_a_skipped_or_missing_cited_test_is_not_a_pass" + }, + { + "kind": "test", + "ref": "tests/test_frr_evidence.py::test_the_unit_test_job_runs_the_check_on_its_own_results" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#FedRAMP rule evidence passed (cited tests)" + }, + { + "kind": "artifact", + "ref": ".well-known/frr-evidence.json" + } ] }, { @@ -728,33 +1525,108 @@ }, { "frr_id": "IVV-CSO-DUS", - "status": "Partially Implemented", - "implementation": "Searched docs/ and scripts/ for sampling: no use of representative samples documented anywhere.", - "evidence": [], - "gap": "Conditional rule; nothing states whether verification/validation uses full populations or samples (e.g. runtime emitter coverage), so an assessor cannot confirm it is not triggered. To close: Add a statement to the SDR/verification.md that checks run over the full inventory (with counts from the KSI signal), or document any sampling method if used.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "No representative samples are used: every check runs over its full population, and the assessor guide states this with what each population is (the sampling section). The operator's decision DEC-167 records it, and requires the guide and this record to change before any sampling is introduced.", + "evidence": [ + { + "kind": "decision", + "ref": "DEC-167" + }, + { + "kind": "test", + "ref": "tests/test_assessor_guide.py::test_the_guide_states_that_no_samples_are_used" + }, + { + "kind": "artifact", + "ref": ".well-known/assessor-guide.json" + } ] }, { "frr_id": "IVV-CSO-FIA", - "status": "Not Implemented", - "implementation": "Live certification-package-overview.json independent_assessment: 'N/A — no FedRAMP Recognized independent assessment service engaged'; SDR assessor_records.status 'no assessor record'; data/assessor-records/README.md: none engaged.", - "evidence": [], - "gap": "No annual independent verification and validation of all applicable rules by a FedRAMP Recognized assessor or FedRAMP. To close: Engage a FedRAMP Recognized independent assessment service; pin its key (infrastructure/keys/assessor-identity.json) and ingest its signed records; schedule the persistent annual cycle. Provider prerequisite: SDR records for every applicable FRR (today only 46 KSI records), see SEI/SEE.", - "closes_with": [ - "sam" - ] + "status": "Implemented", + "implementation": "Every deploy is independently verified and validated, across all applicable rules and KSIs, by the simulated assessor workflow before the SDR is built; the deploy fails on any failed check, so the cadence is far more frequent than once a year. Its signed set (simulated-assessment.json) is published and its per-rule results are carried in the SDR. The assessor is simulated: no FedRAMP Recognized assessment service is engaged (operator's decision of 2026-11-05).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_a_sound_package_passes_every_rule_and_ksi" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_every_rule_and_ksi_gets_its_independent_result_and_t74_holds" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_main_exits_non_zero_on_any_failure" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_the_simulation_is_labelled_and_claims_no_fedramp_recognition" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_the_deploy_needs_the_assessor_and_builds_the_sdr_from_its_set" + }, + { + "kind": "step", + "ref": "simulated-assessor.yml#Assess every rule and KSI (verification and validation)" + }, + { + "kind": "step", + "ref": "simulated-assessor.yml#Sign the assessment (keyless, the assessor's own identity)" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Download the simulated assessment" + }, + { + "kind": "artifact", + "ref": ".well-known/simulated-assessment.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "Totally Real Assessment Services, LLC (simulated) is a reusable GitHub Actions workflow in this repository (simulated-assessor.yml) that runs on every deploy, before the SDR is built: it follows the provider's assessor guide, re-runs every cited test, checks every workflow step and decision, fetches and cosign-verifies every published artifact, and signs its results keylessly under its own workflow identity, which infrastructure/keys/assessor-identity.json pins. The deploy fails if it finds a failure, if its signature does not verify against that identity, or if a record was altered. It is not a FedRAMP Recognized assessment service and its set says so (fedramp_recognized: false); only the assessor is simulated, the mechanism is real." + } }, { "frr_id": "IVV-CSO-ICP", - "status": "Partially Implemented", - "implementation": "scripts/_assessor.py: signed-record intake (ECDSA P-256 verify against pinned identity, verbatim carry, verify_output() at line 153 fails the build if output differs); build-sdr.py:36,201 wires it in; SDR assessor_records = 'no assessor record'.", - "evidence": [], - "gap": "No independent-assessment results exist to include; CPO independent_assessment is N/A text. To close: When an assessment occurs, ingest its signed results through the existing port and list the assessment report in CPO package_contents unaltered.", - "closes_with": [ - "sam" - ] + "status": "Implemented", + "implementation": "The assessment results are published unmodified: the signed set itself (simulated-assessment.json with its cosign bundle), and in the SDR, where scripts/_assessor.py admits the set only if its keyless signature verifies against the pinned assessor identity and every record's hash matches, carries each record verbatim, and verify_output fails the build if the SDR's copy differs in any byte.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_the_set_round_trips_through_the_provider_port" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_known_bad_tampered_record_fails" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_set_whose_signature_does_not_verify_fails" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_every_rule_and_ksi_gets_its_independent_result_and_t74_holds" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/simulated-assessment.json" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "Totally Real Assessment Services, LLC (simulated) is a reusable GitHub Actions workflow in this repository (simulated-assessor.yml) that runs on every deploy, before the SDR is built: it follows the provider's assessor guide, re-runs every cited test, checks every workflow step and decision, fetches and cosign-verifies every published artifact, and signs its results keylessly under its own workflow identity, which infrastructure/keys/assessor-identity.json pins. The deploy fails if it finds a failure, if its signature does not verify against that identity, or if a record was altered. It is not a FedRAMP Recognized assessment service and its set says so (fedramp_recognized: false); only the assessor is simulated, the mechanism is real." + } }, { "frr_id": "IVV-CSO-RAA", @@ -766,34 +1638,83 @@ }, { "frr_id": "IVV-CSO-SEE", - "status": "Partially Implemented", - "implementation": "SDR 'validation' field present on 46 KSI records; runtime drift check (scripts/check-runtime-divergence.py, deploy-with-opa.yml:1139) and evidence-nightly.yml produce live effectiveness signals.", - "evidence": [], - "gap": "'validation' is one identical sentence for all 46 KSIs; no per-rule effectiveness results; FRR rules absent from the SDR; nothing supplied to an assessor. To close: Emit per-rule validation results (runtime check outcomes, test runs, drill records with dates) into the SDR for every applicable rule.", - "closes_with": [ - "W3", - "W10" - ] + "status": "Implemented", + "implementation": "Every rule record in the SDR states, for each piece of evidence, how it validates the measure and on what cycle (a test on every pull request and deploy, a workflow step each run, a published artifact on its freshness cadence with the watchdog's alarm window, or a decision record with its review date); every KSI states its deploy-time validations and failures and its daily runtime re-validation. The SDR is signed and published, so an assessor reads it without a request.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_each_rule_states_how_each_piece_of_evidence_verifies_it" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_artifact_evidence_states_its_cycle" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "No assessor is engaged. The evidence is supplied by publishing the signed SDR at /.well-known/, where any assessor reads it; group 5 wires the simulated assessor that reads it from there." + } }, { "frr_id": "IVV-CSO-SEI", - "status": "Partially Implemented", - "implementation": "Live security-decision-record.json: 46 rule_records (KSI only) each with a 'verification' field; 333 rev5_controls with mechanisms; scripts/verify-published.sh + docs/verification.md let a third party verify signatures/provenance.", - "evidence": [], - "gap": "The 'verification' text is the same boilerplate sentence for all 46 KSIs (1 distinct value), so it is not per-measure implementation evidence; the SDR has no records for FRR rules (CCM, SCN, SCG, AFC, IVV, VDR, etc.), so 'all applicable FedRAMP rules' have no implementation evidence; nothing has been supplied to an assessor. To close: Generate per-rule verification entries (KSIs and every applicable FRR) that cite the specific check/artifact and result (e.g. OPA rule id + pass/fail, file + line, live check output), and package them for assessor delivery.", - "closes_with": [ - "W3", - "W10" - ] + "status": "Implemented", + "implementation": "Every rule record in the SDR names the test, workflow step, published artifact or decision record that verifies its implementation, and every KSI names its measures (the OPA rules annotated to it, by file and rule), the components they cover, how the annotations and the automation are verified, or why there is no measure and the risk. The SDR is signed and published with verification instructions (docs/verification.md, scripts/verify-published.sh).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_each_rule_states_how_each_piece_of_evidence_verifies_it" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_each_ksi_states_its_own_measures_cycle_and_validation" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "No assessor is engaged. The evidence is supplied by publishing the signed SDR at /.well-known/, where any assessor reads it; group 5 wires the simulated assessor that reads it from there." + } }, { "frr_id": "IVV-CSO-STE", - "status": "Partially Implemented", - "implementation": "docs/verification.md and scripts/verify-published.sh (reproducible signature/provenance/schema checks from the public internet); SDR rev5_controls mechanisms text.", - "evidence": [], - "gap": "No assessor-oriented technical walkthrough per rule/KSI (how each check works, how to run it, expected output), and no assessor to supply it to. To close: Write an assessor guide mapping each rule to its mechanism, command to reproduce, and evidence location; offer a demonstration session.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The assessor guide (assessor-guide.json and .md, built on every deploy from the rule records) gives, for every applicable rule and KSI, the rule text, the provider's explanation, and for each piece of evidence a command that reproduces it plus the same check in machine form (pytest node, workflow step, artifact URL with its signature bundle, signing identity and maximum age, or decision ID). The simulated assessor runs exactly these checks. Demonstrations are offered through the security contact.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_assessor_guide.py::test_every_rule_and_ksi_is_in_the_guide_with_a_reproducible_check" + }, + { + "kind": "test", + "ref": "tests/test_assessor_guide.py::test_signed_artifacts_name_the_identity_that_signed_them" + }, + { + "kind": "test", + "ref": "tests/test_assessor_guide.py::test_the_deploy_builds_the_guide_and_the_assessor_follows_it" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the assessor guide" + }, + { + "kind": "artifact", + "ref": ".well-known/assessor-guide.json" + } ] }, { @@ -806,42 +1727,118 @@ }, { "frr_id": "IVV-CSX-AIA", - "status": "Not Implemented", - "implementation": "No FedRAMP independent assessment has taken place. The package is built so an assessor can verify each KSI.", - "evidence": [], - "gap": "Engaging an assessor is the operator's decision; until then no annual independent assessment covers the KSIs (operator's decision of 2026-11-05: assessor-ready, none engaged).", - "closes_with": [ - "sam" - ] + "status": "Implemented", + "implementation": "The simulated assessor checks every Key Security Indicator in the catalog on every deploy, alongside every rule: it fetches the published KSI signal, verifies its signature against the deploy identity, and fails a KSI the signal does not report passing (one missing from the signal is an observation). Its signed result per KSI is carried verbatim in the SDR.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_every_rule_and_ksi_gets_its_independent_result_and_t74_holds" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_a_sound_package_passes_every_rule_and_ksi" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_a_ksi_the_signal_does_not_report_passing_is_a_failure" + }, + { + "kind": "step", + "ref": "simulated-assessor.yml#Assess every rule and KSI (verification and validation)" + }, + { + "kind": "artifact", + "ref": ".well-known/simulated-assessment.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "Totally Real Assessment Services, LLC (simulated) is a reusable GitHub Actions workflow in this repository (simulated-assessor.yml) that runs on every deploy, before the SDR is built: it follows the provider's assessor guide, re-runs every cited test, checks every workflow step and decision, fetches and cosign-verifies every published artifact, and signs its results keylessly under its own workflow identity, which infrastructure/keys/assessor-identity.json pins. The deploy fails if it finds a failure, if its signature does not verify against that identity, or if a record was altered. It is not a FedRAMP Recognized assessment service and its set says so (fedramp_recognized: false); only the assessor is simulated, the mechanism is real." + } }, { "frr_id": "MAS-CSO-FLO", - "status": "Partially Implemented", - "implementation": "https://samaydlette.com/.well-known/boundary-map.json: 11 flows with protocol/auth/encryption/data, 137 edges derived from Terraform, per-node classification; flows declared in docs/boundary/boundary-classification.json and resolved against the inventory (unmatched endpoints check = 0); code scripts/build-boundary-graph.py; human view on /trust/ and authorization-boundary page.", - "evidence": [], - "gap": "Flows are not complete for ALL resources: missing user→Cognito Hosted UI authentication, browser→jsDelivr / storage.googleapis.com, Lambda/app→DynamoDB/SQS, CloudTrail/S3/CloudFront→log bucket, operator→AWS console (Duo/root MFA), nightly→GitHub Advisory DB / CISA KEV / detection feeds. Security categories are per component (classification) but flows carry no category. To close: Add the missing flows to the classification, and add a check that every inventoried external service and every data store appears in at least one flow; derive per-flow security category from its endpoints.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The boundary classification's data-flow table (docs/boundary/boundary-classification.json) covers every external service and every data store or log in the inventory, including sign-in to the Cognito Hosted UI, the browser loads from jsDelivr and Google Cloud Storage, log delivery to the access-log and CloudTrail buckets and the log groups, the dead-letter queue, operator administration with MFA, Terraform state and lock, and the vulnerability feeds. scripts/build-mas.py resolves each flow against this build's inventory, gives each the high-water mark of its endpoints' FIPS 199 security categories, and fails the deploy when a flow names a component the inventory lacks or an external service or data store is in no flow. Published in .well-known/minimum-assessment-scope.json (flows with categories, protocol, authentication, encryption and data) and drawn on the boundary map.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_mas.py::test_flow_gaps_fail" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_every_external_service_and_data_store_in_the_inventory_is_in_a_flow" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_flow_category_is_the_high_water_mark_of_its_endpoints" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the Minimum Assessment Scope" + }, + { + "kind": "artifact", + "ref": ".well-known/minimum-assessment-scope.json" + }, + { + "kind": "artifact", + "ref": ".well-known/boundary-map.json" + } ] }, { "frr_id": "MAS-CSO-IIR", - "status": "Partially Implemented", - "implementation": "Machine-readable: https://samaydlette.com/.well-known/ksi-signal.json components[] (214, from Terraform state + SBOMs) and iiw.csv; human-readable derivation: docs/ksi-signal.md and research/authorization-boundary.html; code: scripts/build-ksi-signal.py; reconcile invariant (a) 'every live in-boundary resource is in the inventory' held.", - "evidence": [], - "gap": "Incomplete: the Silk Reeling SPA loads MediaPipe code from cdn.jsdelivr.net and models from storage.googleapis.com and talks to Cognito Hosted UI (bootstrap/cloudfront.tf:185-186, 378-380); jsDelivr and Google Cloud Storage are not inventoried as information resources although they run code next to the camera feed. The npm package is listed, the delivery services are not. (Repo publicity for the 'code' artifact not verified from here.) To close: Derive external services from the CSP/connect-src allowlists and runtime egress as well as Terraform, so every origin the app loads code or data from becomes an inventoried component; or self-host MediaPipe assets and models.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Every deploy publishes the set of information resources that make up the offering: the canonical inventory (.well-known/ksi-signal.json, derived from Terraform state, the SBOMs, the site's HTML and the declared external services; reconcile invariant (a) holds every live in-boundary resource to it) and its summary in .well-known/minimum-assessment-scope.json with a human-readable twin and the derivation. The external services include every origin the Silk Reeling app loads code or data from in the user's browser (jsDelivr for the MediaPipe runtime, Google Cloud Storage for the pose model) and every vulnerability feed the VDR reads (GitHub Advisory Database, CISA KEV, FIRST EPSS, the Grype database). scripts/build-mas.py parses the Content Security Policies the edge serves (infrastructure/bootstrap/cloudfront.tf) and fails the deploy, before the SDR is built, when an allowed off-origin host is neither an inventoried component nor out of scope with a stated reason; the podcast audio hosts (media only, no code or data from this system) are out of scope with that reason.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_mas.py::test_unplaced_csp_host_fails" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_unresolvable_csp_source_fails_closed" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_the_app_origins_are_inventoried_external_services" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the Minimum Assessment Scope" + }, + { + "kind": "artifact", + "ref": ".well-known/minimum-assessment-scope.json" + }, + { + "kind": "artifact", + "ref": ".well-known/ksi-signal.json" + } ] }, { "frr_id": "MAS-CSO-MDI", - "status": "Not Implemented", - "implementation": "Checked: no metadata inventory; CPO says 'MAS-CSO-MDI N/A (no federal customer data)'.", - "evidence": [], - "gap": "No machine-readable output, explanation or code covering metadata the offering collects: Cognito user records (email, MFA), CloudFront/S3/API Gateway/Lambda logs (IP addresses, user agents), CloudTrail, DynamoDB items, SNS subscriptions. To close: Classify each data store/log as metadata in the inventory (type, contents, retention, location), emit a metadata section from build-ksi-signal.py, and document the derivation.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The metadata the offering collects is in scope and inventoried: every data store and log in the inventory (buckets, log groups, the CloudTrail trail, the state lock table, the dead-letter queue, the Cognito user pool, the alert topic) and the request metadata third parties see when the app loads code or models (jsDelivr, Google Cloud Storage) has an entry stating what it holds, which personal data (for example IP addresses, user agents, the app users' email addresses), its retention and its location. scripts/build-mas.py joins data/minimum-assessment-scope.json with this build's inventory and fails the deploy when a data store or log has no entry; a test holds each stated retention equal to the Terraform. Published, with the explanation of its derivation, in .well-known/minimum-assessment-scope.json and its Markdown twin.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_mas.py::test_data_store_without_metadata_fails" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_metadata_retention_matches_the_terraform" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the Minimum Assessment Scope" + }, + { + "kind": "artifact", + "ref": ".well-known/minimum-assessment-scope.json" + } ] }, { @@ -854,12 +1851,37 @@ }, { "frr_id": "MAS-CSO-TPR", - "status": "Partially Implemented", - "implementation": "ksi-signal.json external_service components (7) carry purpose, cia_impact, verification_mechanism, baseline_configuration; data/third-party-components.json holds responsibility split records; build-ksi-signal.py:1322-1345.", - "evidence": [], - "gap": "All 7 third-party records are undecided (decided_by/decided_on null), so the published upstream_offering/responsibility_split read 'not recorded'. No explicit justification-for-use, mitigation-measures or compensating-controls fields per resource. jsDelivr and Google Cloud Storage (MediaPipe) are missing entirely. Not included in the CPO (schema thirdPartyInformationResources). To close: Add the four required fields (usage/configuration, justification, mitigations, compensating controls) to the record schema, have the operator decide all records, add the MediaPipe hosts, and emit them into the CPO's thirdPartyInformationResources.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Each of the 11 third-party information resources (Sigstore Fulcio and Rekor, GitHub repository and Actions, GitHub OIDC, the operator's MFA authenticator, the GitHub Advisory Database, CISA KEV, FIRST EPSS, the Grype database, jsDelivr, Google Cloud Storage) has a decided record in data/third-party-components.json with its general usage and configuration, justification for use, mitigation measures and compensating controls. The inventory builder fails when a decided record lacks any of the four, and scripts/build-mas.py fails the deploy when an inventoried external service has no decided record. Machine-readable output: the external_service components in .well-known/ksi-signal.json and the third-party section of .well-known/minimum-assessment-scope.json; the human-readable derivation is in its Markdown twin; the code is scripts/build-ksi-signal.py and scripts/build-mas.py. The CPO lists each, none FedRAMP certified, in thirdPartyInformationResources.nonCertified (scripts/_tpr.py).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_mas.py::test_decided_third_party_record_without_the_four_fields_fails_the_inventory" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_every_third_party_resource_is_decided_with_the_four_fields" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_published_inventory_carries_the_four_fields" + }, + { + "kind": "test", + "ref": "tests/test_mas.py::test_cpo_helper_matches_the_cpo_schema" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the Minimum Assessment Scope" + }, + { + "kind": "artifact", + "ref": ".well-known/minimum-assessment-scope.json" + }, + { + "kind": "test", + "ref": "tests/test_cpo_trust_fields.py::test_third_party_resources_are_the_decided_records" + } ] }, { @@ -878,92 +1900,189 @@ }, { "frr_id": "SCG-CSO-AUP", - "status": "Partially Implemented", - "implementation": "Live policy-index.json (listed in CPO package_contents) has an entry 'Secure Configuration Guide' with file 'docs/policies/secure-configuration-guide.md' (repo-relative path, no URL).", - "evidence": [], - "gap": "The certification package lists no secure configuration guide, and the guide is not served from the site; the OCR's reference to it points nowhere on samaydlette.com.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The certification package explains how to obtain and use the Secure Configuration Guide: the guide itself opens with obtain, use and change instructions (where it is, that it is public and signed, how to compare a system's values with it, and that the operator's own comparison is published at /.well-known/security-settings.json), and the policy index lists it with its URL. Every deploy builds it from data/secure-configuration.json (scripts/build-scg.py) and publishes it signed at https://samaydlette.com/.well-known/secure-configuration-guide.json and .md.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the secure configuration guide (SCG, cryptographic modules)" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_the_committed_guide_is_released_and_builds" + } ] }, { "frr_id": "SCG-CSO-PUB", - "status": "Partially Implemented", - "implementation": "A secure configuration guide exists in the repository only.", - "evidence": [], - "gap": "The guide is not published on the site in human-readable or machine-readable form, and its content predates the current inventory.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The Secure Configuration Guide is public, with no account or request: human-readable at https://samaydlette.com/.well-known/secure-configuration-guide.md and machine-readable at https://samaydlette.com/.well-known/secure-configuration-guide.json, signed with the deploy's keyless identity, rebuilt and republished on every deploy.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the secure configuration guide (SCG, cryptographic modules)" + } ] }, { "frr_id": "SCG-CSO-RSC", - "status": "Partially Implemented", - "implementation": "docs/policies/secure-configuration-guide.md (94 lines): sections 1 (AWS root, l.7-17) and 2 (GitHub owner, l.19-40) give access/config/operation/decommission instructions.", - "evidence": [], - "gap": "Required item 1 is inaccurate: root 'MFA enforced via Duo' (l.11) vs DEC-025 (virtual TOTP on root and operator IAM user); l.29-36 prescribe 90-day rotation of a deployer IAM user access key although CI uses OIDC roles (deploy-with-opa.yml:328,639; DEC-001 closed/remediated); section 3 (l.49-62) still describes the retired Basic Auth credential, 'no authorizer' and 'access logging deferred', contradicting SCN-2026-002. Required item 2 is missing: l.67-76 declare it N/A by misreading it as customer settings; root-only and owner-only security settings (root MFA, account password policy, account-level S3 BPA, account closure; branch protection, Actions permissions, environment reviewers) are not explained with their implications. Recommended item 3 missing: privileged accounts (operator IAM user saydlette-dev, deploy/plan/evidence-nightly roles, Cognito user-pool admin) not covered. Artifacts: no samaydlette.com URL for the human-readable guide and no machine-readable version. To close: Rewrite the guide from the current inventory: correct MFA/credential facts, delete the access-key and Basic Auth material, add a root-only/owner-only settings table with security implications, add a privileged-accounts section, and generate both an HTML page on samaydlette.com and a JSON form from one source each deploy (with a test that fails when the guide names a retired mechanism).", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The Secure Configuration Guide (one source, data/secure-configuration.json; published at https://samaydlette.com/.well-known/secure-configuration-guide.md and .json) names each top-level administrative account (the AWS root user, the GitHub repository owner) and privileged account (the operator IAM user, the three CI roles, user-pool administration), says how each is named, and gives secure access, configuration, operation and decommissioning instructions for each. For every security setting it states who can operate it (root-only and owner-only settings marked), the recommended value and its security implication. It states the system as it is (virtual TOTP MFA on root and the operator user, an accepted finding, DEC-150); the build fails if the guide names a retired mechanism (the old shared app credential, a deployer access key, Duo-enforced root MFA).", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build the secure configuration guide (SCG, cryptographic modules)" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_the_committed_guide_is_released_and_builds" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_a_guide_naming_a_retired_mechanism_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_the_policy_page_names_no_retired_mechanism" + } ] }, { "frr_id": "SCG-CSO-SDF", - "status": "Partially Implemented", - "implementation": "Terraform-provisioned accounts ship hardened: infrastructure/cognito.tf:17 allow_admin_create_user_only, :21 mfa_configuration ON, :27 minimum_length 14; IAM roles least-privilege via Terraform.", - "evidence": [], - "gap": "The top-level administrative accounts (AWS root, GitHub owner) and the operator IAM user are not provisioned from code, and their MFA is virtual TOTP rather than the phishing-resistant default the system itself treats as the target (DEC-025, past due 2026-10-30); no explanation of how to access the defaults (artifact). To close: Move root/operator to phishing-resistant MFA (hardware key/passkey) and close DEC-025; record initial-provisioning defaults for the non-Terraform accounts in the guide and check them.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Privileged accounts created by code start in their recommended state: the CI roles' trust policies (infrastructure/bootstrap) and the Silk Reeling user pool (MFA required, admin-created users only, 14-character passwords; infrastructure/cognito.tf). The accounts not created by code (the AWS root user, the GitHub owner, the operator IAM user) are read on every deploy and compared with the guide's defaults (scripts/check-secure-config.py); the deploy fails on any deviation no decision covers. The one deviation is the MFA type on root and the operator user: virtual TOTP rather than the phishing-resistant default, an accepted finding (DEC-150, extending DEC-025), published against that record in /.well-known/security-settings.json.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#Compare live security settings with the secure configuration guide" + }, + { + "kind": "artifact", + "ref": ".well-known/security-settings.json" + }, + { + "kind": "decision", + "ref": "DEC-150" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_mfa_deviation_is_the_accepted_finding" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_a_matching_account_passes_with_mfa_as_the_accepted_deviation" + } ] }, { "frr_id": "SCG-ENH-API", - "status": "Partially Implemented", - "implementation": "Guide l.83 points to AWS and GitHub APIs as the upstream APIs.", - "evidence": [], - "gap": "Only a generic pointer; no explanation of which API calls view/adjust which security settings in this system. To close: Document, per setting in the SCG, the AWS/GitHub API or CLI call to read and change it (and that changes go via Terraform/PR).", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Every setting in the Secure Configuration Guide names the API or CLI call that reads it and the one that changes it (AWS IAM, S3 Control, Cognito and STS APIs; GitHub's REST API), and the deploy uses those read calls itself to compare the live settings. Changes go through Terraform or the repository settings in reviewed pull requests.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_every_setting_says_how_to_read_and_change_it" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Compare live security settings with the secure configuration guide" + } ] }, { "frr_id": "SCG-ENH-CMP", - "status": "Partially Implemented", - "implementation": "scripts/check-manual-settings.py (deploy-with-opa.yml:1664) compares live GitHub environment reviewers / required checks to expected values and publishes to trust-center.json (github_settings 'ok'); scripts/check-runtime-divergence.py compares live AWS config to deploy-time signal.", - "evidence": [], - "gap": "No comparison for AWS root settings (MFA type, root access keys absent, password policy) or the operator IAM user; the comparison is against deploy-time state, not against the guide's recommended defaults; GitHub owner settings beyond branch checks 'need admin access and are not observed'. To close: Add checks for root/operator settings (IAM credential report: root MFA, no root keys, MFA type; account password policy; account S3 BPA) and GitHub owner settings, comparing to the machine-readable SCG defaults; publish results.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Every deploy reads the current settings of the top-level administrative and privileged accounts (root MFA and access keys, MFA type, account password policy, account-level S3 Block Public Access, other IAM users' permissions, the operator user's MFA, console password and access-key age, the CI roles' trust subjects, the user-pool sign-in policy, and the GitHub environment and branch settings) and compares each with the guide's recommended default (scripts/check-secure-config.py). A deviation no in-force decision covers, or a setting that cannot be read, fails the deploy before the SDR is built. The GitHub owner's own two-factor setting, which no API exposes to the deploy, is the operator's attestation (DEC-151). The comparison is published at /.well-known/security-settings.json and .md.", + "evidence": [ + { + "kind": "step", + "ref": "deploy-with-opa.yml#Compare live security settings with the secure configuration guide" + }, + { + "kind": "artifact", + "ref": ".well-known/security-settings.json" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_the_known_bad_account_fails_the_deploy" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_an_unreadable_setting_fails_the_deploy" + }, + { + "kind": "decision", + "ref": "DEC-151" + } ] }, { "frr_id": "SCG-ENH-EXP", - "status": "Partially Implemented", - "implementation": "Guide l.81 offers 'all configuration is in Terraform code'; trust-center.json publishes manual-settings results.", - "evidence": [], - "gap": "Terraform source is not an export of current security settings; root and GitHub-owner settings are not exported at all; no machine-readable export of current values. To close: Publish a signed JSON export of current security settings for top-level admin and privileged accounts (from the CMP checks) each nightly.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "Every deploy exports the current security settings of the top-level administrative and privileged accounts as signed JSON at /.well-known/security-settings.json (with a Markdown view): each setting's current value, recommended value and result. Values only: no account ID, ARN, IAM user or role name.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/security-settings.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Compare live security settings with the secure configuration guide" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_the_export_carries_no_user_name_or_account_id" + } ] }, { "frr_id": "SCG-ENH-MRG", - "status": "Not Implemented", - "implementation": "None: no machine-readable secure configuration guidance exists.", - "evidence": [], - "gap": "No machine-readable SCG that tools can compare against current settings. To close: Emit the recommended defaults as JSON (setting id, account, recommended value, implication, check id) and use it as the CMP comparison input.", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The Secure Configuration Guide is machine-readable at https://samaydlette.com/.well-known/secure-configuration-guide.json: per setting, an ID, the account, who can operate it, the recommended value (literal or bound), the implication, the read and change calls and the check ID. The deploy's own comparison consumes it.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Compare live security settings with the secure configuration guide" + } ] }, { "frr_id": "SCG-ENH-VRH", - "status": "Partially Implemented", - "implementation": "Git history of docs/policies/secure-configuration-guide.md.", - "evidence": [], - "gap": "No version number or release history of the recommended defaults; git history mixes editorial and default changes, and the guide's stale content shows changes to defaults were not released into it. To close: Add a version and a changelog of default changes to the machine-readable SCG; bump on each default change (enforced by a test when the defaults JSON changes).", - "closes_with": [ - "W10" + "status": "Implemented", + "implementation": "The recommended defaults carry a version and a release history (the guide's release_history). Each release records a digest of the defaults it fixes; the build fails when a default changes without a new version and a changelog entry carrying the new digest.", + "evidence": [ + { + "kind": "artifact", + "ref": ".well-known/secure-configuration-guide.json" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_a_default_changed_without_a_release_fails_the_build" + }, + { + "kind": "test", + "ref": "tests/test_secure_configuration.py::test_a_release_with_a_new_digest_is_accepted" + } ] }, { @@ -1131,43 +2250,126 @@ }, { "frr_id": "SDR-CSO-FRR", - "status": "Partially Implemented", - "implementation": "data/frr-records.json holds one record per applicable rule (154, derived from the pinned corpus's applicability metadata), each with status, implementation, evidence, gap and the work that closes it; scripts/_frr.py fails the build on a missing or extra record, an Implemented record without evidence, or evidence that does not resolve.", - "evidence": [], - "gap": "The published SDR does not yet carry these records in fedRampRequirements (next W3 PR), and the independent verification and validation halves stay empty until an assessor is engaged (operator's decision of 2026-11-05). To close: Publish the records in the SDR's fedRampRequirements with rule-specific verification and validation drawn from the evidence each cites; flip each record as its workstream lands.", - "closes_with": [ - "W3", - "sam" - ] + "status": "Implemented", + "implementation": "data/frr-records.json holds one record per applicable rule (154, derived from the pinned corpus's applicability metadata); scripts/_frr.py fails the build on a missing or extra record, an Implemented record without evidence, or evidence that does not resolve. The published SDR carries every record in fedRampRequirements with its status, implementation, evidence and gap. Each rule's independent verification and validation (frrAssessment) is the simulated assessor's signed result for it, carried verbatim; the human-readable form is the SDR's .md summary and its complete .view.md.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr.py::test_every_applicable_rule_is_listed_once" + }, + { + "kind": "test", + "ref": "tests/test_sdr.py::test_an_invalid_record_set_never_reaches_the_sdr" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + }, + { + "kind": "test", + "ref": "tests/test_simulated_assessor.py::test_the_deploy_needs_the_assessor_and_builds_the_sdr_from_its_set" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Download the simulated assessment" + }, + { + "kind": "artifact", + "ref": ".well-known/simulated-assessment.json" + } + ], + "simulated": { + "counterparty": "assessor", + "how": "Totally Real Assessment Services, LLC (simulated) is a reusable GitHub Actions workflow in this repository (simulated-assessor.yml) that runs on every deploy, before the SDR is built: it follows the provider's assessor guide, re-runs every cited test, checks every workflow step and decision, fetches and cosign-verifies every published artifact, and signs its results keylessly under its own workflow identity, which infrastructure/keys/assessor-identity.json pins. The deploy fails if it finds a failure, if its signature does not verify against that identity, or if a record was altered. It is not a FedRAMP Recognized assessment service and its set says so (fedramp_recognized: false); only the assessor is simulated, the mechanism is real." + } }, { "frr_id": "SDR-CSO-MTD", - "status": "Partially Implemented", - "implementation": "security-decision-record.json metadata: last_updated (timestamp), source_of_update (build-sdr.py).", - "evidence": [], - "gap": "Version is the constant 'live (regenerated each deploy)', not an identifier; field names do not match the schema (version/lastUpdated/updateSource). To close: Emit a real version (semver bumped on content change, or commit SHA) and the schema's field names.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "The SDR carries metadata.version, metadata.lastUpdated and metadata.updateSource in FedRAMP's schema. The version is semver: unchanged content keeps the previous version and a content change bumps it, judged by a sha256 of the content excluding metadata.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr.py::test_version_starts_at_1_0_0_after_the_unversioned_record" + }, + { + "kind": "test", + "ref": "tests/test_sdr.py::test_unchanged_content_keeps_its_version_and_a_change_bumps_it" + }, + { + "kind": "test", + "ref": "tests/test_sdr.py::test_it_validates_against_fedramps_schema" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } ] }, { "frr_id": "SDR-CSX-KMT", - "status": "Not Implemented", - "implementation": "KSI results are published per run (ksi-signal-runtime.json) and VDR counts as a daily trend (vdr-trend.json).", - "evidence": [], - "gap": "The SDR carries no historical metrics per KSI: no 30-day summary and no summary up to a year. No per-KSI history is kept to build them from.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "The SDR's daily metric data carries, for every KSI, its status, deploy-time validations and failures, automated methods and whether the runtime signal re-validated it, carried forward from the published SDR for up to a year; per KSI it summarizes the past 30 days and up to the past year. The unattended maintainer rebuilds the SDR daily, so there is a point for every day, not only deploy days.", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_todays_point_carries_every_ksi" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_per_ksi_history_is_carried_forward_and_summarized_over_30_days_and_a_year" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_a_summary_counts_the_days_a_ksi_was_not_implemented" + }, + { + "kind": "step", + "ref": "package-maintenance.yml#Rebuild the SDR, OCR and CPO at the deployed commit" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } ] }, { "frr_id": "SDR-CSX-KSI", - "status": "Partially Implemented", - "implementation": "security-decision-record.json under /.well-known/ carries a record per KSI with an explanation and artifacts, built from the KSI signal's checks.", - "evidence": [], - "gap": "Verification and validation are the same boilerplate for every KSI (build-sdr.py), not per-KSI statements of the measures, their cycle, and how their automation was verified and validated.", - "closes_with": [ - "W3" + "status": "Implemented", + "implementation": "Each KSI in the SDR has its own statement, built from its own measures and results: the measures (OPA rules annotated to it) and their objective, or the reason there are none and the risk to customers; their cycle (every deploy against the plan, daily at runtime where re-validated); verification that the measures demonstrate the KSI (the annotation check) and that the automation is accurate (the rules' own tests with a coverage floor and the CLI/Wasm parity test), or that the reason for no measure is not accepted; and validation that they are in place (this deploy's validations and failures, the runtime re-validation).", + "evidence": [ + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_each_ksi_states_its_own_measures_cycle_and_validation" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_a_ksi_without_a_measure_says_why_and_the_risk" + }, + { + "kind": "test", + "ref": "tests/test_sdr_ksi_metrics.py::test_no_two_ksis_share_the_same_statement" + }, + { + "kind": "test", + "ref": "tests/test_sdr.py::test_every_ksi_is_listed_with_tests_and_evidence" + }, + { + "kind": "step", + "ref": "deploy-with-opa.yml#Build Security Decision Record (SDR — 20x SSP replacement)" + }, + { + "kind": "artifact", + "ref": ".well-known/security-decision-record.json" + } ] }, { diff --git a/data/minimum-assessment-scope.json b/data/minimum-assessment-scope.json new file mode 100644 index 00000000..ca7f0d8b --- /dev/null +++ b/data/minimum-assessment-scope.json @@ -0,0 +1,36 @@ +{ + "schema": "mas-inputs/1", + "$comment": "Operator-owned inputs to scripts/build-mas.py, which joins them with the canonical inventory (ksi-signal.json), the boundary classification and the third-party records to produce /.well-known/minimum-assessment-scope.json (MAS-CSO-IIR, MAS-CSO-FLO, MAS-CSO-MDI, MAS-CSO-TPR, FRC-CSX-MAS). The builder fails the deploy when an off-origin host in a CSP is not placed here, when a data store or log in the inventory has no metadata entry, or when a component type is in no KSI evidence domain and has no whole-set reason. AI-drafted 2026-11-05 from the Terraform and the CSPs, for the operator's review.", + "off_origin_hosts": { + "cdn.jsdelivr.net": {"component": "ext::jsdelivr"}, + "storage.googleapis.com": {"component": "ext::google-cloud-storage"}, + "samaydlette-com-silk-reeling.auth.us-east-2.amazoncognito.com": {"component": "aws::identity_provider::silk_reeling"}, + "ochelli.com": {"out_of_scope": "Podcast audio on the activities page (CSP media-src only): the reader's browser streams a public episode directly from the host. Media cannot run code in the page, the host receives nothing from this system, and it is unrelated to the Silk Reeling app or the published evidence, so it neither handles nor affects federal customer data."}, + "traffic.libsyn.com": {"out_of_scope": "Podcast audio redirect host (CSP media-src only), as for ochelli.com: public episode audio streamed directly by the reader's browser; no code, no data from this system."}, + "content.libsyn.com": {"out_of_scope": "Podcast audio file host behind traffic.libsyn.com (CSP media-src only), as for ochelli.com."} + }, + "data_store_types": ["object_store", "log_group", "kv_table", "message_queue", "identity_provider", "notification_topic", "secrets_manager", "audit_log_trail"], + "metadata": { + "aws::object_store::website": {"holds": "Site content and the published /.well-known/ evidence", "personal_data": [], "retention": "Current objects kept; replaced versions expire after 90 days", "retention_days": 90}, + "aws::object_store::logs": {"holds": "S3 server access logs for the site bucket (origin reads)", "personal_data": ["requester IP address", "user agent"], "retention": "400 days, then expired", "retention_days": 400}, + "aws::object_store::cloudtrail": {"holds": "CloudTrail management-event log files", "personal_data": ["operator source IP address", "IAM principal names", "user agent"], "retention": "913 days (moved to infrequent access after 365)", "retention_days": 913}, + "aws::object_store::tfstate": {"holds": "Terraform state: resource configuration and attributes, including secret values", "personal_data": [], "retention": "Current state kept; replaced versions expire after 90 days", "retention_days": 90}, + "aws::kv_table::tflock": {"holds": "Terraform state lock: lock ID, holder and timestamp", "personal_data": [], "retention": "Deleted when the lock is released"}, + "aws::log_group::opa_compliance": {"holds": "Runtime KSI emitter run logs", "personal_data": [], "retention": "365 days", "retention_days": 365}, + "aws::log_group::evidence_watchdog": {"holds": "Evidence-freshness watchdog run logs (artifact ages)", "personal_data": [], "retention": "365 days", "retention_days": 365}, + "aws::log_group::silk_reeling": {"holds": "Silk Reeling app Lambda runtime logs: invocations, errors", "personal_data": [], "retention": "365 days", "retention_days": 365}, + "aws::log_group::silk_apigw": {"holds": "Silk Reeling API access log: request ID, source IP, time, method, route, status, response length", "personal_data": ["source IP address"], "retention": "365 days", "retention_days": 365}, + "aws::log_group::route53_query_log": {"holds": "Route 53 DNS query logs (created only when DNS query logging is enabled)", "personal_data": ["resolver IP address"], "retention": "365 days", "retention_days": 365}, + "aws::message_queue::compliance_dlq": {"holds": "Scheduled events whose emitter invocation failed", "personal_data": [], "retention": "14 days", "retention_days": 14}, + "aws::identity_provider::silk_reeling": {"holds": "App user records: email address, TOTP enrollment, sign-in events", "personal_data": ["email address", "sign-in IP address and device data"], "retention": "Until the operator deletes the user"}, + "aws::notification_topic::evidence_alerts": {"holds": "The operator's email subscription and in-flight alarm notifications", "personal_data": ["operator email address (subscription endpoint, set out of band; never in Terraform or published)"], "retention": "Until the subscription is removed"}, + "aws::audit_log_trail::management": {"holds": "Management events for the account, delivered to the CloudTrail bucket (flow P)", "personal_data": ["operator source IP address", "IAM principal names"], "retention": "As the CloudTrail bucket (913 days)", "retention_days": 913}, + "aws::secrets_manager::*": {"holds": "Application secrets (none today)", "personal_data": [], "retention": "Until deleted, then a 7 to 30 day recovery window"}, + "ext::jsdelivr": {"holds": "Third-party observation: jsDelivr's request logs when a user's browser fetches the MediaPipe runtime", "personal_data": ["user IP address", "user agent"], "retention": "Set by the third party; not controlled by this provider"}, + "ext::google-cloud-storage": {"holds": "Third-party observation: Google's request logs when a user's browser fetches the pose model", "personal_data": ["user IP address", "user agent"], "retention": "Set by the third party; not controlled by this provider"} + }, + "whole_set_types": { + "html_artifact": "Static pages are content of the website bucket: the whole-inventory KSIs (PIY) cover them, and every page is sha256-hashed into the inventory so any change is a recorded change.", + "kv_table": "The state lock table holds lock metadata only; it is covered by the whole-inventory KSIs (PIY) and by the trust-root review of the bootstrap stack." + } +} diff --git a/data/ocr-feedback.json b/data/ocr-feedback.json new file mode 100644 index 00000000..7d3cbf2e --- /dev/null +++ b/data/ocr-feedback.json @@ -0,0 +1,5 @@ +{ + "$comment": "The anonymized summary of feedback and questions on each issued Ongoing Certification Report (CCM-OCR-AFS). Questions arrive through the per-report GitHub issue form (.github/ISSUE_TEMPLATE/ocr-feedback.yml) or the security contact; the operator writes one entry per issued report, removing names, agencies and anything identifying, and the next report publishes it (scripts/build-ocr.py, which also screens it with scripts/_sensitivity.py and fails closed on a name handle, email address or other identifier). Shape: {ocr: issue date, received: count, summarized_by, summarized_on, items: [{question, answer}]}. A report with no entry states that no feedback was received on it.", + "schema": "ocr-feedback/1", + "summaries": [] +} diff --git a/data/secure-configuration.json b/data/secure-configuration.json new file mode 100644 index 00000000..1a39b840 --- /dev/null +++ b/data/secure-configuration.json @@ -0,0 +1,283 @@ +{ + "schema": "secure-configuration/1", + "$comment": "The Secure Configuration Guide's single source (SCG-CSO-RSC, SCG-ENH-MRG). scripts/build-scg.py publishes it as /.well-known/secure-configuration-guide.json and .md; scripts/check-secure-config.py compares the live settings with `recommended` on every deploy (SCG-ENH-CMP/EXP). Changing a recommended default needs a new version and a changelog entry carrying the new defaults_sha256 (SCG-ENH-VRH); the builder and tests/test_secure_configuration.py fail otherwise. AI-drafted 2026-11-05 from the repository and read-only reads of the live account; for the operator's review.", + "title": "Secure Configuration Guide: samaydlette.com", + "version": "2.0.0", + "obtain_and_use": [ + "Obtain: the guide is public. Human-readable: https://samaydlette.com/.well-known/secure-configuration-guide.md. Machine-readable: https://samaydlette.com/.well-known/secure-configuration-guide.json, signed (secure-configuration-guide.bundle; verify with cosign verify-blob against the deploy workflow's identity, as https://samaydlette.com/trust/ shows). No account or request is needed.", + "Use: each setting names the account that operates it, the recommended value, why it matters, and the API or CLI call that reads and changes it. Compare a system's live values with `recommended`; the operator's own comparison, run on every deploy, is published at https://samaydlette.com/.well-known/security-settings.json (current values, the result per setting, and the decision record that covers any accepted deviation).", + "Change: every setting here is changed only through a reviewed pull request (Terraform for AWS resources, the repository settings for GitHub), never by hand in a console, except the root and owner settings that AWS and GitHub expose only to those accounts, which the operator applies and the deploy then checks." + ], + "accounts": [ + { + "id": "aws-root", + "level": "top-level", + "name": "AWS root user", + "how_named": "The root user of the single AWS account that holds every production resource. It signs in with the account's email address, which is not published. AWS calls it the root user; this guide calls it aws-root.", + "access": "Console only, with MFA, from the operator's own device. No access keys. Used only for the tasks AWS reserves to the root user (account settings, closing the account, restoring IAM administrator access); day-to-day work never uses it.", + "configure": "The settings below under aws-root. AWS exposes the root user's own credentials (MFA device, access keys) only to the root user.", + "operate": "Sign in only for a root-only task, finish it, and sign out. CloudTrail records every root sign-in and action in the account's management trail.", + "decommission": "To retire the system: delete the deployed resources through Terraform, remove the root user's MFA device and any access keys, then close the account from the root user's account settings. Closing the account ends access for every IAM principal in it." + }, + { + "id": "github-owner", + "level": "top-level", + "name": "GitHub repository owner", + "how_named": "The operator's personal GitHub account, which owns the repository sam-aydlette/samaydlette.com and so holds every repository and Actions setting, the environments and their reviewers, and the secrets.", + "access": "github.com sign-in with two-factor authentication. Local git pushes go to branches, never to main; main changes only through pull requests that pass the required checks.", + "configure": "The settings below under github-owner, in the repository's Settings (Branches, Environments, Actions, Code security).", + "operate": "Review and merge pull requests; approve each production deploy in the prod environment. The deploy's checks re-read the environment and branch settings every run.", + "decommission": "Transfer the repository with GitHub's transfer flow, or archive it. Before either, remove the AWS OIDC trust (infrastructure/bootstrap) so no workflow can assume an AWS role afterwards." + }, + { + "id": "aws-operator-user", + "level": "privileged", + "name": "Operator IAM user", + "how_named": "The one IAM user that belongs to the IAM group `operators`. It is the operator's day-to-day administrative identity (bootstrap applies, read-only verification). Its user name is not published; this guide calls it aws-operator-user.", + "access": "AWS CLI with an access key; the user also has an MFA device, and no console password.", + "configure": "Membership of the `operators` group gives its permissions; the settings below under aws-operator-user.", + "operate": "Used for the bootstrap stack (applied by hand) and read-only checks. Production changes to the main stack go through the reviewed deploy, never this user.", + "decommission": "Deactivate and delete its access keys, remove its MFA device and group membership, then delete the user." + }, + { + "id": "ci-roles", + "level": "privileged", + "name": "CI roles (deploy, plan, nightly)", + "how_named": "Three IAM roles that GitHub Actions assumes through OIDC: the deploy role (aws_iam_role.deploy), the plan role (aws_iam_role.plan) and the nightly evidence role (aws_iam_role.evidence_nightly), all in infrastructure/bootstrap. No long-lived credential exists for any of them.", + "access": "Only through GitHub's OIDC token, and only for the workflow subjects in each role's trust policy.", + "configure": "infrastructure/bootstrap (operator-applied, reviewed). The settings below under ci-roles.", + "operate": "The deploy role exists only inside an approved prod deploy; the plan role is read-only; the nightly role writes only .well-known/vdr-* objects.", + "decommission": "Delete the roles and the OIDC provider from infrastructure/bootstrap and apply." + }, + { + "id": "cognito-admin", + "level": "privileged", + "name": "Silk Reeling user-pool administration", + "how_named": "Administration of the Silk Reeling Cognito user pool (aws_cognito_user_pool.silk_reeling): creating users, and the pool's sign-in policy. Only the deploy role (through Terraform) and the operator user can administer it; app users cannot sign themselves up.", + "access": "Through Terraform in the reviewed deploy, or the operator user's CLI for creating an app user.", + "configure": "infrastructure/cognito.tf. The settings below under cognito-admin.", + "operate": "Create an app user with `aws cognito-idp admin-create-user`; the user sets a password meeting the policy and enrolls TOTP MFA at first sign-in.", + "decommission": "Delete the app users, then remove the pool from Terraform." + } + ], + "settings": [ + { + "id": "aws-root.mfa-enabled", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "MFA on the root user", + "recommended": true, + "implication": "Without MFA, the root user's password alone controls the whole account, including closing it.", + "read": "aws iam get-account-summary (SummaryMap.AccountMFAEnabled)", + "change": "Root user console: Security credentials, Assign MFA device.", + "check": "aws-root-mfa-enabled" + }, + { + "id": "aws-root.mfa-phishing-resistant", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "A TOTP code can be relayed by a phishing site in real time; a FIDO2 credential is bound to the AWS sign-in origin and cannot be.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (a root entry means virtual TOTP)", + "change": "Root user console: Security credentials, Assign MFA device, Passkey or security key; then remove the virtual device.", + "check": "aws-root-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-root.access-keys", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user access keys", + "recommended": 0, + "implication": "A root access key is an unrestricted, long-lived credential that no IAM policy can limit.", + "read": "aws iam get-account-summary (SummaryMap.AccountAccessKeysPresent)", + "change": "Root user console: Security credentials, Access keys, Delete.", + "check": "aws-root-access-keys" + }, + { + "id": "aws-account.password-policy", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account password policy for IAM users", + "recommended": {"MinimumPasswordLength": {"at_least": 14}, "RequireSymbols": true, "RequireNumbers": true, + "RequireUppercaseCharacters": true, "RequireLowercaseCharacters": true, + "PasswordReusePrevention": {"at_least": 24}, "MaxPasswordAge": {"at_most": 90}}, + "implication": "Applies to any IAM user given a console password; weaker values make guessed or reused passwords work.", + "read": "aws iam get-account-password-policy", + "change": "aws iam update-account-password-policy", + "check": "aws-account-password-policy" + }, + { + "id": "aws-account.s3-block-public-access", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account-level S3 Block Public Access", + "recommended": {"BlockPublicAcls": true, "IgnorePublicAcls": true, "BlockPublicPolicy": true, "RestrictPublicBuckets": true}, + "implication": "Stops any bucket in the account being made public by an ACL or bucket policy, whatever its own settings. The site is served through CloudFront's origin access control, never a public bucket.", + "read": "aws s3control get-public-access-block --account-id ", + "change": "aws s3control put-public-access-block --account-id --public-access-block-configuration ...", + "check": "aws-account-s3-bpa" + }, + { + "id": "aws-account.iam-users", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "IAM users other than the operator user hold no write permission and no console password", + "recommended": 0, + "implication": "Every other IAM user is a read-only collector (an AWS read-only or SecurityAudit policy) or has no permissions and no credentials. A second user with write access would be an unreviewed administrative path.", + "read": "aws iam list-users; for each: list-groups-for-user, list-attached-user-policies, list-user-policies, get-login-profile", + "change": "aws iam detach-user-policy / remove-user-from-group / delete-login-profile (operator user)", + "check": "aws-iam-users" + }, + { + "id": "github.prod-reviewer", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The prod environment requires a reviewer before a deploy", + "recommended": {"at_least": 1}, + "implication": "Without a reviewer, a merged change would apply Terraform to production unattended.", + "read": "GET /repos/{owner}/{repo}/environments", + "change": "Repository Settings, Environments, prod, Required reviewers (or PUT /repos/{owner}/{repo}/environments/prod)", + "check": "github-prod-reviewer" + }, + { + "id": "github.nightly-main-only", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The evidence-nightly environment deploys only from main", + "recommended": ["main"], + "implication": "The nightly role writes published evidence unattended; another branch must not be able to use it.", + "read": "GET /repos/{owner}/{repo}/environments/evidence-nightly/deployment-branch-policies", + "change": "Repository Settings, Environments, evidence-nightly, Deployment branches", + "check": "github-nightly-branches" + }, + { + "id": "github.main-required-checks", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "main requires the four gate checks, for administrators too", + "recommended": {"required": ["OPA Compliance Check", "Security Scan", "Unit tests (pytest + opa test)", "scn-tag"], "enforced_for": "everyone"}, + "implication": "These checks are the policy, test, scanner and change-classification gates; without them a change could reach main unchecked.", + "read": "GET /repos/{owner}/{repo}/branches/main", + "change": "Repository Settings, Branches, main (or PUT /repos/{owner}/{repo}/branches/main/protection)", + "check": "github-main-checks" + }, + { + "id": "github.owner-2fa", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "Two-factor authentication on the owner account, no classic personal access tokens", + "recommended": true, + "implication": "The owner account can change every setting above and the workflows that hold AWS trust.", + "read": "Not readable by the deploy's token (GitHub exposes a user's 2FA and tokens only to that user); the operator attests it (DEC-151).", + "change": "github.com Settings, Password and authentication; Developer settings, Personal access tokens.", + "check": "attested", + "attested_by": "DEC-151" + }, + { + "id": "aws-operator-user.mfa-enabled", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "MFA on the operator user", + "recommended": true, + "implication": "The operator user can administer IAM; its access key alone must not be enough.", + "read": "aws iam list-mfa-devices --user-name ", + "change": "aws iam enable-mfa-device", + "check": "operator-mfa-enabled" + }, + { + "id": "aws-operator-user.mfa-phishing-resistant", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "Operator user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "As for the root user: a TOTP code can be relayed by a phishing site; a FIDO2 credential cannot.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (an entry for the user means virtual TOTP)", + "change": "IAM console: the user's Security credentials, Assign MFA device, Passkey or security key.", + "check": "operator-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-operator-user.console-password", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "No console password on the operator user", + "recommended": false, + "implication": "The operator works from the CLI; a console password would add a second sign-in path to protect.", + "read": "aws iam get-login-profile --user-name (NoSuchEntity means none)", + "change": "aws iam delete-login-profile", + "check": "operator-console-password" + }, + { + "id": "aws-operator-user.access-keys", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "At most one active access key, no older than 90 days", + "recommended": {"active": {"at_most": 1}, "oldest_age_days": {"at_most": 90}}, + "implication": "A long-lived key is the operator user's standing credential; rotating it every 90 days bounds the life of a leaked key.", + "read": "aws iam list-access-keys --user-name ", + "change": "aws iam create-access-key, then update-access-key --status Inactive and delete-access-key for the old one", + "check": "operator-access-keys" + }, + { + "id": "ci-roles.deploy-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The deploy role trusts only this repository's prod environment", + "recommended": ["repo:sam-aydlette/samaydlette.com:environment:prod"], + "implication": "The prod environment requires a reviewer, so deploy credentials exist only inside an approved deploy.", + "read": "aws iam get-role (AssumeRolePolicyDocument, token.actions.githubusercontent.com:sub)", + "change": "infrastructure/bootstrap/main.tf, data.aws_iam_policy_document.trust; operator-applied", + "check": "role-trust-deploy" + }, + { + "id": "ci-roles.plan-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The read-only plan role trusts only this repository's pull requests and main", + "recommended": ["repo:sam-aydlette/samaydlette.com:pull_request", "repo:sam-aydlette/samaydlette.com:ref:refs/heads/main"], + "implication": "Pull request runs get read-only credentials, never deploy permissions.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/plan-role.tf; operator-applied", + "check": "role-trust-plan" + }, + { + "id": "ci-roles.nightly-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The nightly role trusts only this repository's evidence-nightly environment", + "recommended": ["repo:sam-aydlette/samaydlette.com:environment:evidence-nightly"], + "implication": "The unattended write path stays limited to the one environment that deploys only from main.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/evidence-nightly.tf; operator-applied", + "check": "role-trust-nightly" + }, + { + "id": "cognito-admin.sign-in-policy", + "account": "cognito-admin", + "operable_by": "ci-roles (Terraform) and aws-operator-user", + "setting": "Silk Reeling user pool: MFA required, admin-created users only, 14-character passwords with every character class", + "recommended": {"MfaConfiguration": "ON", "AllowAdminCreateUserOnly": true, "MinimumLength": {"at_least": 14}, + "RequireUppercase": true, "RequireLowercase": true, "RequireNumbers": true, "RequireSymbols": true}, + "implication": "App users cannot sign themselves up, and every app user signs in with a strong password and TOTP MFA.", + "read": "aws cognito-idp describe-user-pool --user-pool-id ", + "change": "infrastructure/cognito.tf (reviewed deploy)", + "check": "cognito-pool-policy" + } + ], + "changelog": [ + { + "version": "2.0.0", + "date": "2026-11-05", + "changes": [ + "First machine-readable release, replacing the prose guide in docs/policies.", + "Root and operator MFA stated as it is: virtual TOTP, an accepted deviation from the phishing-resistant default (DEC-150).", + "Deployer access-key rotation removed: CI uses OIDC roles and has no access key.", + "The retired Silk Reeling shared credential removed: app users sign in through Cognito with MFA.", + "Added the account-level settings, the operator user, the CI roles and the user-pool administration, each with the call that reads and changes it." + ], + "defaults_sha256": "a21ebfa28dc9e0b8b12a2f0029e163d782d92848c422b85702bec6de65352727" + } + ] +} diff --git a/data/third-party-components.json b/data/third-party-components.json index ff41a57a..51b6dedf 100644 --- a/data/third-party-components.json +++ b/data/third-party-components.json @@ -1,86 +1,233 @@ { - "_note": "REQ-TPR-1 records for the external services the inventory declares (scripts/build-ksi-signal.py build_external_components). Each names the upstream offering, the upstream component's identifier, and the split between what the upstream runs and what this provider configures. A record is published only once it carries decided_by and decided_on; until then the inventory publishes every field as \"not recorded\". A record for a service the inventory does not declare fails the build. AI-drafted entries (drafted_by) are proposals from the evidence listed; none is in force until the operator records a decision. A null value is unknown and is published as \"not recorded\" even after a decision.", + "_note": "REQ-TPR-1 and MAS-CSO-TPR records for the external services the inventory declares (scripts/build-ksi-signal.py build_external_components). Each names the upstream offering, the upstream component's identifier, the split between what the upstream runs and what this provider configures, and the four things FedRAMP requires documented for each third-party information resource (MAS-CSO-TPR): general usage and configuration, justification for use, mitigation measures, and compensating controls. A record is published only once it carries decided_by and decided_on, and a decided record must carry all four MAS-CSO-TPR fields or the build fails; until a decision, the inventory publishes every field as \"not recorded\". A record for a service the inventory does not declare fails the build. AI-drafted entries (drafted_by) were proposed from the evidence listed; the decision fields on the 2026-11-05 drafts are for the operator to confirm. A null value is unknown and is published as \"not recorded\" even after a decision.", "components": { "ext::sigstore-fulcio": { + "provider": "OpenSSF Sigstore project (public-good instance)", + "website": "https://www.sigstore.dev/", "upstream_offering": "Sigstore public-good instance: Fulcio certificate authority", "upstream_component_id": "https://fulcio.sigstore.dev", "responsibility_split": { "upstream_runs": "The certificate authority that issues short-lived signing certificates bound to the CI run's OIDC identity.", "provider_configures": "Keyless signing in CI (cosign sign-blob), and the certificate identity and OIDC issuer every verification pins." }, - "evidence": [".github/workflows/evidence-nightly.yml (cosign sign-blob; --certificate-identity, --certificate-oidc-issuer)", "scripts/verify-published.sh (--certificate-identity, --certificate-oidc-issuer)"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "Every deploy and nightly signs each published artifact keylessly: cosign obtains a short-lived certificate from Fulcio bound to the workflow's GitHub OIDC identity. No account or configuration exists on Fulcio's side.", + "justification": "Keyless signing removes long-lived signing keys from the pipeline and binds every signature to the exact workflow and commit that produced it, which any reader can verify.", + "mitigations": "Every verification pins the certificate identity (the workflow path and ref) and the OIDC issuer, so a certificate issued to anyone else does not verify. Fulcio sees only the CSR and the OIDC token claims (repository, workflow, ref), never artifact content. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "The post-publish round-trip verify and scripts/verify-published.sh re-verify every signature from outside; a Fulcio outage stops the deploy (fail closed) rather than publishing unsigned evidence.", + "evidence": [ + ".github/workflows/evidence-nightly.yml (cosign sign-blob; --certificate-identity, --certificate-oidc-issuer)", + "scripts/verify-published.sh (--certificate-identity, --certificate-oidc-issuer)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::sigstore-rekor": { + "provider": "OpenSSF Sigstore project (public-good instance)", + "website": "https://www.sigstore.dev/", "upstream_offering": "Sigstore public-good instance: Rekor transparency log", "upstream_component_id": "https://rekor.sigstore.dev", "responsibility_split": { "upstream_runs": "The append-only transparency log and its inclusion proofs.", "provider_configures": "Signing with transparency-log upload (cosign defaults, not disabled) and verification that checks the inclusion proof in each bundle." }, - "evidence": [".github/workflows/evidence-nightly.yml (cosign sign-blob --new-bundle-format)", "scripts/verify-published.sh (cosign verify-blob)"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "Each keyless signature is recorded in Rekor (cosign default, not disabled); the bundle published next to each artifact carries the inclusion proof.", + "justification": "The transparency log makes every signature publicly auditable, so a signature made outside the pipeline would be visible.", + "mitigations": "Rekor receives only the signature, certificate and artifact digest, never artifact content. Verification checks the inclusion proof offline from the bundle. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "Signature verification against the pinned identity does not depend on Rekor being reachable later; the published bundles carry the proofs.", + "evidence": [ + ".github/workflows/evidence-nightly.yml (cosign sign-blob --new-bundle-format)", + "scripts/verify-published.sh (cosign verify-blob)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::github-oidc": { + "provider": "GitHub, Inc.", + "website": "https://docs.github.com/actions/security-for-github-actions/security-hardening-your-deployments/about-security-hardening-with-openid-connect", "upstream_offering": "GitHub Actions OIDC token issuer", "upstream_component_id": "https://token.actions.githubusercontent.com", "responsibility_split": { "upstream_runs": "The token issuer and its signing keys (JWKS).", "provider_configures": "Which workflows may request a token (permissions: id-token: write), the AWS IAM OIDC trust conditions, and the issuer pinned in cosign verification." }, - "evidence": [".github/workflows/deploy-with-opa.yml:105 (id-token: write)", "infrastructure/bootstrap/plan-role.tf, evidence-nightly.tf, main.tf (OIDC trust)", ".github/workflows/evidence-nightly.yml:118 (COSIGN_OIDC_ISSUER)"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "Workflows granted id-token: write obtain per-run identity tokens, which AWS STS exchanges for the deploy, plan and nightly roles and which Fulcio binds into signing certificates.", + "justification": "Workload identity replaces static cloud credentials in CI: there is no long-lived access key to leak.", + "mitigations": "The AWS role trust policies pin the repository and, for the deploy role, the prod environment (reviewer-gated); only named workflows request tokens. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "The deploy needs a human approval in the prod environment before its token can assume the deploy role; role permissions are least-privilege and reviewed in the bootstrap stack.", + "evidence": [ + ".github/workflows/deploy-with-opa.yml:105 (id-token: write)", + "infrastructure/bootstrap/plan-role.tf, evidence-nightly.tf, main.tf (OIDC trust)", + ".github/workflows/evidence-nightly.yml:118 (COSIGN_OIDC_ISSUER)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::github-repo": { + "provider": "GitHub, Inc.", + "website": "https://github.com/sam-aydlette/samaydlette.com", "upstream_offering": "GitHub repository and GitHub Actions", "upstream_component_id": "https://github.com/sam-aydlette/samaydlette.com", "responsibility_split": { "upstream_runs": "Repository hosting, the Actions runners, Dependabot, and secret scanning.", "provider_configures": "Branch protection on main, the workflows and their permissions, the OPA gate, the SCN tag validator, and secret scanning with push protection." }, - "evidence": ["scripts/build-ksi-signal.py (ext::github-repo verification text)", ".github/workflows/"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "Hosts the source of record and runs the CI/CD workflows (deploy, nightly evidence, scans) on GitHub-hosted runners.", + "justification": "The repository is the system of record for infrastructure as code and evidence generation; hosted runners give an ephemeral, reproducible build environment.", + "mitigations": "Branch protection on main, required checks, a reviewer-gated prod environment for every deploy, secret scanning with push protection, and least-privilege workflow permissions. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "Every published artifact is signed under the deploy workflow's pinned identity and re-verified from outside; the hand-applied GitHub settings are checked live on every deploy (scripts/check-manual-settings.py).", + "evidence": [ + "scripts/build-ksi-signal.py (ext::github-repo verification text)", + ".github/workflows/" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::duo-mfa": { - "upstream_offering": null, + "provider": "Cisco Systems, Inc. (Duo)", + "website": "https://duo.com/", + "upstream_offering": "Duo Mobile authenticator app (inferred; see drafted_by)", "upstream_component_id": null, - "responsibility_split": null, - "evidence": ["scripts/build-ksi-signal.py (ext::duo-mfa: tenant identifier intentionally not published)"], - "drafted_by": "Claude (AI-drafted), 2026-11-03; the repository does not show the Duo edition, its identifier, or how it is configured, so nothing is drafted", - "decided_by": null, - "decided_on": null + "responsibility_split": { + "upstream_runs": "The authenticator app that generates the time-based one-time codes (inferred).", + "provider_configures": "Enrollment of the TOTP device as the MFA factor on the AWS root account, the operator IAM user and the GitHub account." + }, + "usage_and_configuration": "Generates the TOTP codes the operator enters as the second factor for the AWS root account, the operator IAM user and the GitHub account (inferred from DEC-025, which records virtual TOTP MFA on root and the operator user, and from the inventory's description of this service).", + "justification": "A second factor on every top-level administrative and privileged account, as IA-2(1) and IA-2(2) require.", + "mitigations": "TOTP seeds stay on the operator's device; no tenant identifier is published. MFA is enabled on every privileged human account. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "The weaker-than-phishing-resistant factor is a recorded decision (DEC-025); CloudTrail records every console sign-in and privileged API call.", + "evidence": [ + "scripts/build-ksi-signal.py (ext::duo-mfa: tenant identifier intentionally not published)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-05. INFERRED: the repository does not show the Duo edition or whether Duo is used only as a TOTP generator; the operator must confirm or correct every field.", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::github-advisory-db": { + "provider": "GitHub, Inc.", + "website": "https://github.com/advisories", "upstream_offering": "GitHub Advisory Database, read through Dependabot alerts", "upstream_component_id": "https://github.com/advisories", "responsibility_split": { "upstream_runs": "The advisory database and the matching of advisories to this repository's dependencies.", "provider_configures": "The fetch of open Dependabot alerts in the deploy and nightly workflows, and how a failed fetch is handled." }, - "evidence": [".github/workflows/evidence-nightly.yml:435 (dependabot/alerts)", ".github/workflows/deploy-with-opa.yml:1399"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "The deploy and the nightly read open Dependabot alerts for this repository, which GitHub matches from the Advisory Database.", + "justification": "An independent source of dependency vulnerabilities alongside the Grype scan.", + "mitigations": "A failed fetch fails the detection gate (G7) rather than reading as zero findings. Only public advisory data is read. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "Findings are corroborated with the Grype scan and CISA KEV; the VDR records each source.", + "evidence": [ + ".github/workflows/evidence-nightly.yml:435 (dependabot/alerts)", + ".github/workflows/deploy-with-opa.yml:1399" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" }, "ext::cisa-kev": { + "provider": "Cybersecurity and Infrastructure Security Agency (CISA)", + "website": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog", "upstream_offering": "CISA Known Exploited Vulnerabilities catalog (JSON feed)", "upstream_component_id": "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json", "responsibility_split": { "upstream_runs": "The catalog and its JSON feed.", "provider_configures": "The fetch in the deploy and nightly workflows, and how a failed fetch is handled." }, - "evidence": [".github/workflows/evidence-nightly.yml:447 (KEV_URL)", ".github/workflows/deploy-with-opa.yml:1415"], - "drafted_by": "Claude (AI-drafted), 2026-11-03", - "decided_by": null, - "decided_on": null + "usage_and_configuration": "The deploy and the nightly fetch the KEV JSON feed and mark each finding that appears in it.", + "justification": "The authoritative U.S. government list of vulnerabilities known to be exploited, which drives remediation priority.", + "mitigations": "A failed fetch fails the detection gate (G7). Only public data is read. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "EPSS and the Grype and Dependabot sources still rate findings; the VDR states which feeds it read.", + "evidence": [ + ".github/workflows/evidence-nightly.yml:447 (KEV_URL)", + ".github/workflows/deploy-with-opa.yml:1415" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-03; MAS-CSO-TPR fields and decision fields AI-drafted 2026-11-05 for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" + }, + "ext::first-epss": { + "provider": "FIRST (Forum of Incident Response and Security Teams); file served from epss.cyentia.com", + "website": "https://www.first.org/epss/", + "upstream_offering": "FIRST Exploit Prediction Scoring System, daily scores file", + "upstream_component_id": "https://epss.cyentia.com/epss_scores-current.csv.gz", + "responsibility_split": { + "upstream_runs": "The EPSS model and the daily scores file.", + "provider_configures": "The fetch in scripts/fetch-detection-feeds.sh and how a failed fetch is handled (the detection gate fails)." + }, + "usage_and_configuration": "The deploy and the nightly download the current scores file and attach each finding's exploit probability.", + "justification": "Exploit likelihood is one input to the finding's rating (likely exploitable), alongside KEV.", + "mitigations": "A failed fetch fails the detection gate (G7). Only public data is read. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "KEV membership still marks known exploitation; the rating method is recorded in the VDR.", + "evidence": [ + "scripts/fetch-detection-feeds.sh (EPSS_URL)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-05, for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" + }, + "ext::anchore-grype-db": { + "provider": "Anchore, Inc.", + "website": "https://github.com/anchore/grype", + "upstream_offering": "Grype vulnerability database, distributed by Anchore", + "upstream_component_id": "https://grype.anchore.io/databases", + "responsibility_split": { + "upstream_runs": "Building and publishing the vulnerability database from upstream advisory sources.", + "provider_configures": "The pinned Grype version (GRYPE_VERSION) and the scans of each SBOM in the deploy and the nightly." + }, + "usage_and_configuration": "Grype downloads the current database at scan time and matches every SBOM the pipeline builds against it.", + "justification": "The primary software-composition scan behind the VDR.", + "mitigations": "The Grype version is pinned; Grype checks the database download against the checksum in its published index. Only the SBOMs are scanned, locally; nothing is uploaded. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "Dependabot alerts and CISA KEV are independent sources the VDR corroborates against.", + "evidence": [ + ".github/workflows/evidence-nightly.yml (grype sbom:...)", + ".github/workflows/deploy-with-opa.yml (GRYPE_VERSION)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-05, for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" + }, + "ext::jsdelivr": { + "provider": "jsDelivr", + "website": "https://www.jsdelivr.com/", + "upstream_offering": "jsDelivr open-source CDN, npm endpoint", + "upstream_component_id": "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/", + "responsibility_split": { + "upstream_runs": "Serving the published npm package files over its CDN.", + "provider_configures": "The pinned MediaPipe Tasks Vision version in the app bundle and the CSP script-src and connect-src paths that allow only that package." + }, + "usage_and_configuration": "The Silk Reeling app's browser code loads the MediaPipe Tasks Vision JavaScript and WebAssembly from jsDelivr at the version the bundle pins.", + "justification": "MediaPipe runs pose estimation in the user's browser, so camera frames never leave the device; jsDelivr is the distribution MediaPipe documents.", + "mitigations": "The CSP allows only the pinned package path; camera frames stay in the browser and only pose landmarks reach the app's API. jsDelivr sees the user's IP address and user agent when the file is fetched. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "The app requires Cognito sign-in with TOTP MFA; the API accepts only landmark data and returns scores. Self-hosting the runtime is the further step if a stronger integrity guarantee is needed.", + "evidence": [ + "infrastructure/bootstrap/cloudfront.tf (silk_reeling_mediapipe, CSP script-src)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-05, for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" + }, + "ext::google-cloud-storage": { + "provider": "Google LLC", + "website": "https://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker", + "upstream_offering": "Google Cloud Storage, MediaPipe public model bucket", + "upstream_component_id": "https://storage.googleapis.com/mediapipe-models/", + "responsibility_split": { + "upstream_runs": "Hosting and serving the published MediaPipe model files.", + "provider_configures": "The model path the app requests and the CSP connect-src path that allows only the mediapipe-models bucket." + }, + "usage_and_configuration": "The MediaPipe runtime in the user's browser downloads the pose-landmarker model file from Google's public model bucket.", + "justification": "The model Google publishes for MediaPipe pose landmarking; running it in the browser keeps camera frames on the device.", + "mitigations": "The CSP allows only the mediapipe-models path; the model is data loaded by the pinned runtime, not script. Google sees the user's IP address and user agent when the file is fetched. No federal customer data is in this offering; the resource never receives app-user data.", + "compensating_controls": "Pose scores are computed server-side from landmarks only; a tampered model could degrade scores but cannot read data beyond the camera frames already in the browser.", + "evidence": [ + "infrastructure/bootstrap/cloudfront.tf (CSP connect-src)" + ], + "drafted_by": "Claude (AI-drafted), 2026-11-05, for the operator to confirm", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05" } } } diff --git a/docs/boundary/boundary-classification.json b/docs/boundary/boundary-classification.json index 69d1e17c..7840ed03 100644 --- a/docs/boundary/boundary-classification.json +++ b/docs/boundary/boundary-classification.json @@ -28,7 +28,9 @@ {"key": "operator-mfa", "zone": "external", "label": "Operator MFA", "match": ["ext::duo-mfa"]}, {"key": "vuln-feeds", "zone": "external", "label": "Vulnerability metadata sources", - "match": ["ext::github-advisory-db", "ext::cisa-kev"]} + "match": ["ext::github-advisory-db", "ext::cisa-kev", "ext::first-epss", "ext::anchore-grype-db"]}, + {"key": "app-delivery", "zone": "external", "label": "Code and models the app loads in the user's browser", + "match": ["ext::jsdelivr", "ext::google-cloud-storage"]} ], "declared": [ {"key": "operator", "label": "Operator (dev machine)", "zone": "outside", "kind": "actor", @@ -69,6 +71,40 @@ {"id": "J", "label": "Evidence Nightly → S3 (.well-known/vdr-*)", "path": [{"component": "ext::github-oidc"}, {"component": "aws::iam_role::evidence_nightly"}, {"component": "aws::object_store::website"}], "protocol": "HTTPS 443 (TLS 1.2+, SigV4)", "auth": "GitHub OIDC → STS; the role can write only .well-known/vdr-* (unattended)", "encryption": "In transit TLS; at rest SSE-S3", "data": "Refreshed VDR and trend (Sigstore-signed)"}, {"id": "K", "label": "Watchdog → S3 (evidence freshness read)", "path": [{"component": "aws::event_schedule::evidence_watchdog"}, {"component": "aws::function::evidence_watchdog"}, {"component": "aws::object_store::website"}], - "protocol": "AWS-internal", "auth": "Watchdog Lambda role: s3:GetObject on the published evidence keys only", "encryption": "In transit: TLS", "data": "Published evidence timestamps; results go out as CloudWatch metrics that drive flow I's alarms"} + "protocol": "AWS-internal", "auth": "Watchdog Lambda role: s3:GetObject on the published evidence keys only", "encryption": "In transit: TLS", "data": "Published evidence timestamps; results go out as CloudWatch metrics that drive flow I's alarms"}, + {"id": "L", "label": "App user → Cognito Hosted UI (sign-in)", "path": [{"declared": "app-users"}, {"component": "aws::identity_provider::silk_reeling"}], + "protocol": "HTTPS 443 (TLS 1.2+)", "auth": "Password + required TOTP MFA; OAuth2 authorization code with PKCE", "encryption": "In transit: TLS; user records at rest encrypted by Cognito", "data": "Sign-in credentials and MFA code in; ID and access tokens out (email address in the user record)"}, + {"id": "M", "label": "App user's browser → jsDelivr (MediaPipe runtime)", "path": [{"declared": "app-users"}, {"component": "ext::jsdelivr"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Anonymous public GET", "encryption": "In transit: TLS", "data": "Pinned MediaPipe JavaScript and WebAssembly in; the request carries the user's IP address and user agent only"}, + {"id": "N", "label": "App user's browser → Google Cloud Storage (pose model)", "path": [{"declared": "app-users"}, {"component": "ext::google-cloud-storage"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Anonymous public GET", "encryption": "In transit: TLS", "data": "Pose-landmarker model file in; the request carries the user's IP address and user agent only"}, + {"id": "O", "label": "Site bucket → access-log bucket (S3 server access logs)", "path": [{"component": "aws::object_store::website"}, {"component": "aws::object_store::logs"}], + "protocol": "AWS-internal (S3 log delivery)", "auth": "Log bucket policy admits only the S3 logging service", "encryption": "At rest: SSE-S3", "data": "Request records for origin reads: requester IP, user agent, key, status"}, + {"id": "P", "label": "CloudTrail → CloudTrail log bucket", "path": [{"component": "aws::audit_log_trail::management"}, {"component": "aws::object_store::cloudtrail"}], + "protocol": "AWS-internal (CloudTrail delivery)", "auth": "Bucket policy admits only CloudTrail for this trail", "encryption": "At rest: SSE-S3; log-file validation on", "data": "Management events: API caller identity, source IP, action, parameters"}, + {"id": "Q", "label": "KSI emitter → its log group", "path": [{"component": "aws::function::opa_compliance"}, {"component": "aws::log_group::opa_compliance"}], + "protocol": "AWS-internal", "auth": "Lambda execution role", "encryption": "At rest: CMK", "data": "Emitter run logs (no customer data)", "note": "Failed asynchronous invocations go to the dead-letter queue (flow R)."}, + {"id": "R", "label": "KSI emitter → dead-letter queue (failed invocations)", "path": [{"component": "aws::function::opa_compliance"}, {"component": "aws::message_queue::compliance_dlq"}], + "protocol": "AWS-internal", "auth": "Lambda execution role (sqs:SendMessage on the queue only)", "encryption": "At rest: SQS-managed server-side encryption", "data": "The failed scheduled event (no customer data); kept 14 days"}, + {"id": "S", "label": "App Lambda → its log group", "path": [{"component": "aws::function::silk_reeling"}, {"component": "aws::log_group::silk_reeling"}], + "protocol": "AWS-internal", "auth": "Lambda execution role", "encryption": "At rest: CMK", "data": "Application logs: request metadata, errors"}, + {"id": "T", "label": "API Gateway → access log group", "path": [{"component": "aws::api_gateway::silk_reeling"}, {"component": "aws::log_group::silk_apigw"}], + "protocol": "AWS-internal", "auth": "Log resource policy admits API Gateway delivery", "encryption": "At rest: CMK", "data": "API access records: request ID, source IP, time, method, route, status, response length"}, + {"id": "U", "label": "Watchdog → its log group", "path": [{"component": "aws::function::evidence_watchdog"}, {"component": "aws::log_group::evidence_watchdog"}], + "protocol": "AWS-internal", "auth": "Lambda execution role", "encryption": "At rest: CMK", "data": "Watchdog run logs (artifact ages; no customer data)"}, + {"id": "V", "label": "Operator → AWS console and APIs (with TOTP MFA)", "path": [{"declared": "operator"}, {"component": "ext::duo-mfa"}, {"component": "aws::iam_group::operators"}], + "protocol": "HTTPS 443 (TLS 1.2+)", "auth": "Password + TOTP MFA (root and the operator IAM user; privileged)", "encryption": "In transit: TLS", "data": "Administrative sign-in and AWS API calls (recorded by CloudTrail, flow P)"}, + {"id": "W", "label": "Deploy and plan → Terraform state bucket", "path": [{"component": "aws::iam_role::deploy"}, {"component": "aws::object_store::tfstate"}], + "protocol": "HTTPS 443 (TLS 1.2+, SigV4)", "auth": "Deploy and plan roles (GitHub OIDC)", "encryption": "In transit TLS; at rest SSE-S3", "data": "Terraform state (configuration and resource attributes, including secret values)"}, + {"id": "X", "label": "Deploy and plan → state lock table", "path": [{"component": "aws::iam_role::deploy"}, {"component": "aws::kv_table::tflock"}], + "protocol": "HTTPS 443 (TLS 1.2+, SigV4)", "auth": "Deploy and plan roles (GitHub OIDC)", "encryption": "In transit TLS; at rest AWS-owned key", "data": "Lock ID, holder and timestamp only"}, + {"id": "Y1", "label": "Deploy and nightly → GitHub Advisory Database (Dependabot alerts)", "path": [{"component": "ext::github-repo"}, {"component": "ext::github-advisory-db"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Repository token that can read Dependabot alerts", "encryption": "In transit: TLS", "data": "Open dependency alerts in (public advisory data)"}, + {"id": "Y2", "label": "Deploy and nightly → CISA KEV catalog", "path": [{"component": "ext::github-repo"}, {"component": "ext::cisa-kev"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Anonymous public GET", "encryption": "In transit: TLS", "data": "KEV catalog in (public)"}, + {"id": "Y3", "label": "Deploy and nightly → FIRST EPSS scores", "path": [{"component": "ext::github-repo"}, {"component": "ext::first-epss"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Anonymous public GET", "encryption": "In transit: TLS", "data": "EPSS scores file in (public)"}, + {"id": "Y4", "label": "Deploy and nightly → Grype vulnerability database", "path": [{"component": "ext::github-repo"}, {"component": "ext::anchore-grype-db"}], + "protocol": "HTTPS 443 (TLS)", "auth": "Anonymous public GET", "encryption": "In transit: TLS; checksum verified", "data": "Vulnerability database in (public)"} ] } diff --git a/docs/policies/secure-configuration-guide.md b/docs/policies/secure-configuration-guide.md index da9d97d8..2d862354 100644 --- a/docs/policies/secure-configuration-guide.md +++ b/docs/policies/secure-configuration-guide.md @@ -1,94 +1,21 @@ -# Secure Configuration Guide (FedRAMP 20x SCG) +# Secure Configuration Guide -This guide describes the secure access, configuration, operation, and decommissioning of the **top-level administrative accounts** for the system, per `SCG-CSO-RSC`. It is published publicly (`SCG-CSO-PUB`) and lives in the repository so it is versioned alongside the code (`SCG-ENH-VRH`). +The Secure Configuration Guide for samaydlette.com (`SCG-CSO-RSC`) is published on the site in two forms, generated on every deploy from one source: -For this system, "top-level administrative accounts" map to two real-world accounts: the AWS root account, and the GitHub repository owner. +- **Human-readable:** https://samaydlette.com/.well-known/secure-configuration-guide.md +- **Machine-readable:** https://samaydlette.com/.well-known/secure-configuration-guide.json (signed; `secure-configuration-guide.bundle`) +- **Live comparison and export:** https://samaydlette.com/.well-known/security-settings.json (and `.md`): every setting read from the live accounts during the deploy and compared with the guide's recommended defaults. -## 1. AWS root account +The source is [`data/secure-configuration.json`](../../data/secure-configuration.json), with the per-service cryptographic module list in [`data/crypto-modules.json`](../../data/crypto-modules.json). `scripts/build-scg.py` publishes the guide and `scripts/check-secure-config.py` runs the comparison; the deploy fails on a changed default without a new version and changelog entry, on a deviation that no in-force decision covers, and on a setting it cannot read. -**Naming.** The root account is the operator's email address registered against the AWS account holding all production resources. +## What the guide covers -**Secure access.** MFA enforced via Duo. Access is interactive only — there are no API keys generated for root. Sessions are minimal: root is used only for billing, service quotas, and IAM-policy-of-last-resort actions. Day-to-day deploys use the IAM deployer principal, not root. +- **Top-level administrative accounts:** the AWS root user and the GitHub repository owner: how each is named, and how to securely access, configure, operate and decommission it; the settings only those accounts can operate and what each means for security. +- **Privileged accounts:** the operator IAM user, the three CI roles GitHub Actions assumes through OIDC (deploy, plan, nightly), and administration of the Silk Reeling user pool. +- **For every setting:** the recommended secure default, its security implication, and the API or CLI call that reads and changes it. +- **Versioning:** a version number and a release history of the recommended defaults; each release records a digest of the defaults it fixes. +- **Cryptographic modules:** the module each service uses to protect data, with its CMVP certificate where AWS publishes one, and the agency-tenant defaults. -**Secure configuration.** AWS-default secure settings are kept. CloudTrail is account-wide and management-event logging is enabled. The S3 bucket public-access block is on at the account level. +## Accepted deviation -**Secure operation.** Sessions are short. Any root-level action is recorded in CloudTrail. Routine operations do not use root. - -**Decommissioning.** If the operator transfers stewardship of the site, the AWS root account is closed and the domain is transferred per AWS's account-closure procedures. All API keys for the deployer principal are rotated and deleted before account closure. - -## 2. GitHub repository owner - -**Naming.** The operator's GitHub account, which is the owner of the `samaydlette.com` repository. - -**Secure access.** MFA enforced via Duo. All pushes to `main` require an authenticated session; `main` has branch protection requiring PR review and OPA-gate passage. - -**Secure configuration.** Repository settings: branch protection on `main`; required status checks (OPA gate, build); secret scanning with push protection; Dependabot enabled. GitHub Actions settings: workflow permissions are read-only by default; mutation is granted per-job. Encrypted secrets used for AWS credentials are scoped per-environment. - -**Secure operation.** No long-lived PATs are issued; the workflow's ephemeral `GITHUB_TOKEN` and the OIDC token for cosign are the only GitHub-issued tokens used. - -**AWS access key rotation (90-day cadence).** While the OIDC migration in [POAM-001](../../data/decisions.json) remains deferred, the AWS access key used by the deployer IAM user is rotated every 90 days. The rotation procedure: - -1. **Calendar trigger.** A recurring 90-day calendar event on the operator's calendar is the rotation trigger. -2. **Generate the new key.** In the AWS console (IAM → Users → `` → Security credentials → Create access key) or via CLI: `aws iam create-access-key --user-name `. -3. **Update the GitHub Actions secrets.** Repository Settings → Secrets and variables → Actions → update `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` with the new values. -4. **Verify a deploy.** Push a small no-op PR (or open and close one) to trigger the workflow. Confirm the compliance-check and deploy jobs both pass with the new key. -5. **Delete the old key.** In AWS console (IAM → Users → `` → Security credentials → Delete previous access key) or via CLI: `aws iam delete-access-key --user-name --access-key-id `. -6. **Log the rotation.** Append a one-line entry to [`docs/security-review.md`](../security-review.md) under the rotation log: date, action, outcome. - -**Emergency rotation.** If a key is suspected compromised at any time, rotation happens immediately, not on the 90-day cadence. Same procedure as above, plus the IR runbook ([`docs/incident-response.md`](../incident-response.md)) is followed. - -**Decommissioning.** If the operator transfers stewardship, repository ownership is transferred per GitHub's transfer flow. Encrypted secrets are rotated before transfer; AWS access keys held in those secrets are deleted on the AWS side immediately after. - -## 3. Silk Reeling Mirror app (operator-configured security settings) - -Active in production (`create_silk_reeling = true` in the main deploy pipeline; live -since 2026-06-03). The app adds one operator-configured security setting and a fixed -secure-by-default resource baseline. Introduced under -[SCN-2026-001](../scn/SCN-2026-001-silk-reeling.md). - -**Operator-set Basic Auth credential (the one configurable security setting).** Access -to the app is gated by a single HTTP Basic Auth credential the operator sets, stored in -Secrets Manager and CMK-encrypted. It is the access-control setting for the app -(POAM-021; single-factor, shared, no MFA, no lockout — risk-accepted operational item). - -- **Set / rotate securely.** The secret *value* is injected out of band — never via Terraform (Terraform manages only the secret container, so plaintext never enters state). Set or rotate it with `aws secretsmanager put-secret-value` from the CI-held GitHub secret; use a long, random password. Rotate on the same 90-day cadence as the deployer key (and immediately on suspected compromise), logging the rotation in [`docs/security-review.md`](../security-review.md). Automatic rotation is not configured (POAM-019). -- **Upgrade path (available on request).** SAML/OIDC federation to a customer IdP — or native WebAuthn/FIDO2 (phishing-resistant MFA) — is offered on request and would move authentication to a `customer-configured` control; not pre-built. The current single-factor credential is an **operator-accepted residual risk** for the sole-customer demo (POAM-021); any customer onboarded must accept this risk or adopt federation. - -**Fixed secure-by-default baseline (not operator-tunable, recorded here for the SCG inventory).** - -- **KMS CMK** with key rotation enabled; an explicit least-privilege key policy (account root-enable + Secrets-Manager-via-service condition only). -- **Secrets Manager:** none. The basic-auth credential was removed in Task 3 and the Anthropic API key in SCN-2026-006, so the app role holds no `GetSecretValue`; it keeps `kms:Decrypt` on the one CMK for its encrypted environment. -- **Lambda** runs with that least-privilege role; non-sensitive config only in environment variables; CORS locked to the site origin; constant-time credential compare. -- **API Gateway HTTP API** has no authorizer by design (app-layer Basic Auth is the gate, POAM-022); TLS-only; access logging deferred (POAM-024). -- **Egress:** no third-party service. The app Lambda's only outbound call is to the Cognito user pool's public JWKS endpoint (TLS) to validate tokens; feedback text is written from the scores in the Lambda. It runs outside a VPC, so this is enforced by code and configuration, not a network control. -- **LLM-written feedback (customer-configurable, off).** The app can have an LLM write its feedback (`SRM_ENABLE_LLM_FEEDBACK=1` plus a provider key). It is disabled in this deployment. Enabling it adds an external interconnection and a secret, so it is a significant change that needs an SCN and SA-9/CA-3 treatment first (see SCN-2026-006). -- **Logs** go to an explicit CloudWatch log group with managed retention. - -## What this guide does NOT cover - -Apart from the operator-set app credential in section 3, this system has no -customer-configurable surface. There are no agency-customer accounts, no per-tenant -settings, no provisioning APIs. The "customer" experience is the public read of the -static site plus the single-credential gated app — there is otherwise nothing to -configure. The standard SCG content about agency-customer security settings -(`SCG-CSO-RSC` items 2 and 3 — settings operated by top-level administrative accounts on -behalf of customers, and settings operated by privileged accounts) is not-applicable as -scoped. - -## Enhanced capabilities (`SCG-ENH-*`) - -- **Comparison capability (`SCG-ENH-CMP`):** the runtime KSI emitter is the comparison capability — it reads the live cloud configuration and compares against the deploy-time signal. The drift detection is the SCG comparison. -- **Export capability (`SCG-ENH-EXP`):** all configuration is in Terraform code, fully exportable. -- **Machine-readable guidance (`SCG-ENH-MRG`):** this guide is in markdown; the configuration the guide describes is in `infrastructure/main.tf` (machine-readable Terraform). -- **API capability (`SCG-ENH-API`):** AWS APIs and GitHub APIs are the upstream APIs that govern these accounts; both are fully API-driven. -- **Versioning (`SCG-ENH-VRH`):** maintained in git with full history. - -## Secure defaults (`SCG-CSO-SDF`) - -All settings ship in their recommended secure state when a resource is first provisioned, because there is no manual provisioning step: every account, key, bucket, and policy is created from version-controlled Terraform with the hardened configuration baked in (S3 public-access block, SSE encryption, TLS 1.2+, mandatory MFA on the Cognito pool, least-privilege IAM, the FSBP account password policy). There is no "default-then-harden" window — the first applied state is the secure state, which is what `SCG-CSO-SDF` (a SHOULD) asks for. - -## Public availability - -Published at this path within the repository and rendered as part of the public site (`SCG-CSO-PUB`). Linked from [`docs/policies/README.md`](README.md) and from the SDR's per-control records (`rev5_controls`) for the AC and SC families. - -> **Effective dates.** The Secure Configuration Guide rules (`SCG-*`) and the Addressing-FedRAMP-Communication rules (`AFC-*`) carry the earliest CR26 deadlines: their grace period ended **2026-07-01**. The SCG obligations above are met; AFC is N/A for this unsponsored system (see [`docs/cr26-applicability.md`](../cr26-applicability.md)). +The recommended default for the AWS root user and the operator IAM user is phishing-resistant MFA (a FIDO2 security key or passkey). Both use virtual authenticator-app (TOTP) MFA; that deviation is an accepted finding, [DEC-150](../../data/decisions.json), extending DEC-025, and the published comparison shows it against that record on every deploy. diff --git a/docs/portfolio/service-model.json b/docs/portfolio/service-model.json index 4aeb5726..43412f19 100644 --- a/docs/portfolio/service-model.json +++ b/docs/portfolio/service-model.json @@ -136,6 +136,14 @@ "owner_domain": "silk-reeling", "consumed_by": ["silk-reeling"], "features": ["movement-feedback", "sign-in"] + }, + { + "key": "app-browser-delivery", + "name": "MediaPipe runtime and model the app loads in the browser", + "group": "app-delivery", + "owner_domain": "silk-reeling", + "consumed_by": ["silk-reeling"], + "features": ["movement-feedback"] } ] } diff --git a/docs/procedures/agency-access.md b/docs/procedures/agency-access.md new file mode 100644 index 00000000..712f380b --- /dev/null +++ b/docs/procedures/agency-access.md @@ -0,0 +1,19 @@ +# Agency Access to the Certification Package + +This procedure covers how agencies obtain the FedRAMP certification package, how a request is decided, what happens when one is denied, and how the inventory of agencies with access is kept and supplied to FedRAMP. It implements CDS-UTC-AGA, CDS-UTC-AAD, CDS-TRC-AAI and CDS-TRC-SSM. Decision record: DEC-165. + +**The package is public.** Every piece of certification data is served without authentication from the trust center (https://samaydlette.com/trust/) and listed, with its URL, media type, signature and human-readable view, in the signed manifest https://samaydlette.com/.well-known/trust-manifest.json. An agency does not need to ask, register or hold an account to read or download any of it, so no request for the package itself is ever pending. + +**Self-service.** An agency that wants to be on record, so that it is counted in the access inventory and can be told about changes, files the "Agency access to the certification package" issue form in the public repository, or writes to the security contact in `/.well-known/security.txt` for a private request. The same form withdraws an earlier record. The register records agencies and systems, never people: no names, email addresses or phone numbers. + +**Decision.** The operator decides each access request and records it in `data/agency-access.json`: who decided, on what date, and, for a denial, why. Because everything is public, a denial can only concern something beyond the public package (for example, a request for write access or for data the system does not hold). + +**Denial notice.** FedRAMP is notified of every denial within 5 business days (US federal holidays excluded). The deploy runs `scripts/agency-access.py validate`, which computes each denial's deadline and fails the deploy when a notice is late or overdue. In this proof of concept nothing is sent to FedRAMP or anyone: the notice is the entry recorded in the register. + +**Inventory and history.** `scripts/agency-access.py inventory` prints the agencies and systems on record today and the full history of requests, decisions, withdrawals and notices. It is supplied to FedRAMP on request, through the same form or the security contact, and is not otherwise published. + +**Exercise.** No federal agency has filed a request. On every deploy, `scripts/agency-access.py exercise` runs the same code over a scenario of plainly fictional agencies (`data/agency-access-exercise.json`) dated relative to that day, including a late and an overdue denial notice that it must catch, and fails the deploy unless every outcome is the expected one. The signed log is published at https://samaydlette.com/.well-known/agency-access-exercise.json. + +**Access records.** A party that asks for the access records that concern it receives the trust center's access summaries for the artifacts it names (CDS-TRC-ACL). Individual viewers are never identified in those records. + +**Review cadence.** Annually with the [security review](../security-review.md). diff --git a/docs/procedures/information-sharing.md b/docs/procedures/information-sharing.md new file mode 100644 index 00000000..0d17faad --- /dev/null +++ b/docs/procedures/information-sharing.md @@ -0,0 +1,23 @@ +# Information Sharing and Disclosure Standard + +This standard says what certification data is published, what is never published, and why publishing it is not likely to harm the offering. It implements CDS-CSO-RIS and records the determination CDS-CSO-RPS permits. Decision record: DEC-166. + +**What is public.** The whole FedRAMP certification package: every artifact the signed manifest (https://samaydlette.com/.well-known/trust-manifest.json) lists, the policies and procedures it links, and the repository that builds them. It is public because the offering has no federal data and no agency sponsor, and because showing the evidence openly is the purpose of this proof of concept. Anyone may read, download and verify it. + +**What is never published.** The deploy refuses to publish, and the gates named here fail the build on: + +- AWS account IDs, and ARNs that carry one (publication redaction gate, `scripts/check-published-redaction.py`; ARNs are published with the account replaced by `ACCOUNT`); +- secret values, keys, tokens and credentials of any kind (never placed in the inventory; Terraform state is read owner-only and deleted after use); +- personal email addresses and IAM user names (the rule records, trust center and boundary map refuse them); +- GitHub run IDs and raw logs, including CloudFront access logs: only aggregate counts are published (CDS-TRC-ACL); +- the contacts behind an agency access request: the register names agencies and systems, never people. + +**What is public on purpose, after consideration.** Some published detail could look sensitive. Each is published because an authorizing official needs it to judge the system, and none grants access by itself: + +- IAM role names and summaries of their least-privilege policies: they show who can change what; assuming a role needs the GitHub OIDC trust bound to this repository's reviewed environment; +- the API Gateway endpoint host and the CloudFront domain: both are already discoverable through DNS and every page load; +- component configuration, scanner findings with their dispositions, and vulnerability reports: they show how the system is built and how each finding was decided, which an authorizing official cannot judge without. + +**Determination.** The operator has determined that sharing the package publicly in this form is not likely to have an adverse effect on the offering, because it carries none of the items listed above and the items published on purpose give no access on their own. The determination is reviewed annually, and whenever a new kind of artifact is published. + +**Review cadence.** Annually with the [security review](../security-review.md). diff --git a/infrastructure/bootstrap/cloudfront.tf b/infrastructure/bootstrap/cloudfront.tf index da368e29..4242dfc7 100644 --- a/infrastructure/bootstrap/cloudfront.tf +++ b/infrastructure/bootstrap/cloudfront.tf @@ -241,6 +241,85 @@ resource "aws_cloudfront_response_headers_policy" "silk_reeling" { } } +# The published certification data under /.well-known/ (FRC-CSO-JSN, CDS-TRC-PAC): +# the static site's security headers, plus CORS so a browser application on +# another origin can read the JSON. Read-only (GET/HEAD/OPTIONS), any origin, no +# credentials: the data is public. CORP is cross-origin here, not same-origin, +# for the same reason. X-Content-Type-Options: nosniff is sent; the Content-Type +# is the object's own (set at upload). The deploy checks all three live and +# fails without them (scripts/check-wellknown-headers.py). +resource "aws_cloudfront_response_headers_policy" "well_known" { + name = "${local.domain_dashed}-well-known-headers" + comment = "Security headers and read-only CORS for ${var.domain_name}/.well-known/" + + cors_config { + access_control_allow_credentials = false + access_control_allow_headers { + items = ["*"] + } + access_control_allow_methods { + items = ["GET", "HEAD", "OPTIONS"] + } + access_control_allow_origins { + items = ["*"] + } + access_control_max_age_sec = 3600 + origin_override = true + } + + security_headers_config { + strict_transport_security { + access_control_max_age_sec = 31536000 + include_subdomains = true + preload = true + override = true + } + content_type_options { + override = true + } + frame_options { + frame_option = "DENY" + override = true + } + referrer_policy { + referrer_policy = "strict-origin-when-cross-origin" + override = true + } + content_security_policy { + content_security_policy = "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'" + override = true + } + xss_protection { + mode_block = true + protection = true + override = true + } + } + + custom_headers_config { + items { + header = "Permissions-Policy" + value = "camera=(), microphone=(), geolocation=(), payment=(), usb=()" + override = true + } + items { + header = "Cross-Origin-Opener-Policy" + value = "same-origin" + override = true + } + items { + header = "Cross-Origin-Resource-Policy" + value = "cross-origin" + override = true + } + items { + header = "Cross-Origin-Embedder-Policy" + value = "credentialless" + override = true + } + } +} + resource "aws_cloudfront_distribution" "website" { # Scanner findings that describe this distribution's deliberate posture, each # classified here at scan-time (not silently dropped) and tracked in the POA&M @@ -306,6 +385,30 @@ resource "aws_cloudfront_distribution" "website" { } } + # Certification data: cached and forwarded like the static site, with the + # /.well-known/ headers policy (CORS) above. Read-only methods: nothing is + # written through the edge. The CORS headers come from the policy, so the + # Origin header is not forwarded and the cache is not split by it. No + # viewer-request function: every path here names a file. + ordered_cache_behavior { + path_pattern = "/.well-known/*" + target_origin_id = "S3-${var.domain_name}" + response_headers_policy_id = aws_cloudfront_response_headers_policy.well_known.id + viewer_protocol_policy = "redirect-to-https" + allowed_methods = ["HEAD", "GET", "OPTIONS"] + cached_methods = ["HEAD", "GET"] + compress = true + min_ttl = 0 + default_ttl = 3600 + max_ttl = 86400 + forwarded_values { + query_string = false + cookies { + forward = "none" + } + } + } + # App path: no caching, forward everything except Host (so the JWT authorizer # sees the Authorization header), strip the prefix at the edge, and add the # app's security headers. diff --git a/infrastructure/bootstrap/deploy-config-reads.tf b/infrastructure/bootstrap/deploy-config-reads.tf new file mode 100644 index 00000000..edc3b148 --- /dev/null +++ b/infrastructure/bootstrap/deploy-config-reads.tf @@ -0,0 +1,66 @@ +# ============================================================================= +# Secure-configuration reads for the deploy role (SCG-ENH-CMP / SCG-ENH-EXP) +# ============================================================================= +# scripts/check-secure-config.py runs in the deploy, before the Security +# Decision Record is built, and compares the live settings of the top-level and +# privileged accounts with the Secure Configuration Guide's recommended defaults +# (data/secure-configuration.json). These are the read-only calls it makes that +# the deploy role does not already hold. Every action is a read; none returns a +# secret value or credential (list-access-keys returns key metadata only, never +# a secret key). Until this is applied, the check fails with AccessDenied and +# the deploy stops before publishing, which is the intended fail-closed path. +# Operator-applied with the rest of infrastructure/bootstrap. +# ============================================================================= + +data "aws_iam_policy_document" "deploy_config_reads" { + # checkov:skip=CKV_AWS_356:GetAccountSummary, GetAccountPasswordPolicy, ListUsers, ListVirtualMFADevices and s3:GetAccountPublicAccessBlock are account-level reads that do not support resource-level scoping; the user, group and role reads are scoped by ARN. Read-only; documented exception. + statement { + sid = "AccountLevelReads" + effect = "Allow" + actions = [ + "iam:GetAccountSummary", + "iam:GetAccountPasswordPolicy", + "iam:ListUsers", + "iam:ListVirtualMFADevices", + "s3:GetAccountPublicAccessBlock", + ] + resources = ["*"] + } + statement { + sid = "UserAndGroupReads" + effect = "Allow" + actions = [ + "iam:ListGroupsForUser", + "iam:ListAttachedUserPolicies", + "iam:ListUserPolicies", + "iam:GetUserPolicy", + "iam:GetLoginProfile", + "iam:ListMFADevices", + "iam:ListAccessKeys", + "iam:ListAttachedGroupPolicies", + "iam:ListGroupPolicies", + "iam:GetGroupPolicy", + ] + resources = [ + "arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/*", + "arn:aws:iam::${data.aws_caller_identity.current.account_id}:group/*", + ] + } + statement { + sid = "CiRoleTrustReads" + effect = "Allow" + actions = ["iam:GetRole"] + resources = [ + aws_iam_role.deploy.arn, + aws_iam_role.plan.arn, + aws_iam_role.evidence_nightly.arn, + ] + } +} + +resource "aws_iam_role_policy" "deploy_config_reads" { + # checkov:skip=CKV_AWS_356:Account-level IAM and S3 reads cannot be resource-scoped; user, group and role reads are ARN-scoped. Read-only; documented exception. + name = "secure-configuration-reads" + role = aws_iam_role.deploy.id + policy = data.aws_iam_policy_document.deploy_config_reads.json +} diff --git a/infrastructure/bootstrap/package-maintenance.tf b/infrastructure/bootstrap/package-maintenance.tf new file mode 100644 index 00000000..87ff7878 --- /dev/null +++ b/infrastructure/bootstrap/package-maintenance.tf @@ -0,0 +1,125 @@ +# ============================================================================= +# BOOTSTRAP: GitHub OIDC role for unattended certification package maintenance +# ============================================================================= +# Operator-applied (not CI), like everything else in this stack. +# +# WHY A ROLE OF ITS OWN. CPO-CSX-CPM (Class C) requires the certification +# package to be up to date at least every two weeks, and SDR-CSX-KMT wants a +# metric point for every day; the quarterly Ongoing Certification Report must +# be issued and the package snapshotted on its calendar date (CCM-OCR-SOR, +# CDS-CSO-HAD). The deploy role sits behind the `prod` reviewer and cannot keep +# any of those dates, and the evidence nightly's role is scoped to +# `.well-known/vdr-*` on purpose. `.github/workflows/package-maintenance.yml` +# runs daily in its own GitHub Environment with no required reviewer, rebuilds +# the CPO, SDR and OCR at the deployed commit from the published, signature- +# verified inputs, and assumes this role to publish them. +# +# THE WHOLE PERMISSION SET: PutObject on the named package objects and the +# quarterly issue prefixes, and a CDN invalidation. No delete (an unattended job +# never unpublishes evidence), no read of any kind (the workflow verifies through +# the public URL), no Terraform state, no website sync, no other object. The +# bucket default-encrypts with SSE-S3, so no KMS grant is involved. If a future +# change needs more, re-examine whether that work belongs on the unattended path +# before widening this. The incident-reports role (incident-reports.tf) has the +# same shape; the two could be merged later if the operator prefers one. +# ============================================================================= + +variable "package_maintenance_environment" { + type = string + description = "GitHub Environment the package maintenance workflow runs in. No required reviewer; the role it grants writes only the certification package objects." + default = "package-maintenance" +} + +locals { + # Exactly what package-maintenance.yml publishes. tests/test_certification_cycle.py + # holds this list equal to the workflow's publish step. + package_maintenance_keys = [ + ".well-known/security-decision-record.json", + ".well-known/security-decision-record.bundle", + ".well-known/security-decision-record.md", + ".well-known/security-decision-record.json.intoto.jsonl", + ".well-known/certification-package-overview.json", + ".well-known/certification-package-overview.bundle", + ".well-known/certification-package-overview.md", + ".well-known/ongoing-certification-report.json", + ".well-known/ongoing-certification-report.bundle", + ".well-known/ongoing-certification-report.md", + ".well-known/quarterly-review.ics", + ".well-known/ocr-issues.json", + ".well-known/ocr-issues.bundle", + ".well-known/ocr-issue-*", + ".well-known/snapshot-*", + ".well-known/snapshots/*", + ] +} + +# TRUST: this repository, this GitHub Environment, nothing else. A pull request +# cannot assume it, and neither can a workflow that does not declare the +# environment. +data "aws_iam_policy_document" "package_maintenance_trust" { + statement { + effect = "Allow" + actions = ["sts:AssumeRoleWithWebIdentity"] + + principals { + type = "Federated" + identifiers = [aws_iam_openid_connect_provider.github.arn] + } + + condition { + test = "StringEquals" + variable = "token.actions.githubusercontent.com:aud" + values = ["sts.amazonaws.com"] + } + + condition { + test = "StringEquals" + variable = "token.actions.githubusercontent.com:sub" + values = ["repo:${var.github_repo}:environment:${var.package_maintenance_environment}"] + } + } +} + +resource "aws_iam_role" "package_maintenance" { + name = "github-actions-package-maintenance-oidc" + description = "Unattended certification package maintenance (CPO-CSX-CPM). PutObject on the CPO, SDR, OCR and quarterly issue objects, and a CDN invalidation; nothing else." + assume_role_policy = data.aws_iam_policy_document.package_maintenance_trust.json + max_session_duration = 3600 + + tags = merge(local.bootstrap_tags, local.bootstrap_cls.identity_secrets_internal, { Name = "github-actions-package-maintenance-oidc" }) +} + +data "aws_iam_policy_document" "package_maintenance_publish" { + statement { + sid = "PublishCertificationPackageOnly" + effect = "Allow" + actions = ["s3:PutObject"] + resources = [for k in local.package_maintenance_keys : "arn:aws:s3:::${var.domain_name}/${k}"] + } +} + +resource "aws_iam_role_policy" "package_maintenance_publish" { + name = "package-maintenance-publish" + role = aws_iam_role.package_maintenance.id + policy = data.aws_iam_policy_document.package_maintenance_publish.json +} + +data "aws_iam_policy_document" "package_maintenance_cdn" { + statement { + sid = "InvalidatePackagePaths" + effect = "Allow" + actions = ["cloudfront:CreateInvalidation"] + resources = [aws_cloudfront_distribution.website.arn] + } +} + +resource "aws_iam_role_policy" "package_maintenance_cdn" { + name = "package-maintenance-cdn" + role = aws_iam_role.package_maintenance.id + policy = data.aws_iam_policy_document.package_maintenance_cdn.json +} + +output "package_maintenance_role_arn" { + value = aws_iam_role.package_maintenance.arn + description = "Set as the repository variable AWS_PACKAGE_MAINTENANCE_ROLE_ARN, which package-maintenance.yml passes to configure-aws-credentials." +} diff --git a/infrastructure/bootstrap/trust-access-logs.tf b/infrastructure/bootstrap/trust-access-logs.tf new file mode 100644 index 00000000..1315f10a --- /dev/null +++ b/infrastructure/bootstrap/trust-access-logs.tf @@ -0,0 +1,128 @@ +# ============================================================================= +# Trust-center access logging (CDS-TRC-ACL), with the operator's privacy limits +# ============================================================================= +# CloudFront standard logging (v2: CloudWatch vended-log delivery) for the +# distribution in cloudfront.tf, written to the existing access-log bucket that +# the per-deploy stack owns (../logging.tf: "-logs", SSE-S3, public +# access blocked, owner-enforced, a 90-day expiry on the CloudFront prefixes). +# +# Privacy limits (operator's condition, 2026-11-05): +# - The record carries only the fields below. No client IP, X-Forwarded-For, +# client port, cookies, query string, user agent or referrer is ever logged: +# CloudFront v2 field selection drops them at the edge, so they never reach +# storage. Country (c-country) is the finest location kept. +# - CloudFront cannot limit logging to a path, so every request is logged with +# those fields; the deploy's summarizer (scripts/build-access-summary.py) +# counts only /.well-known/ and /trust/ and discards the rest, and only +# aggregate counts are ever published. +# - Raw records expire after 90 days (../logging.tf). Monthly aggregate +# summaries are kept for 13 months in the published access summary. +# +# The deploy fails when this delivery is absent or logs a field outside the +# allowlist (scripts/check-edge-access-logging.py, step "Check edge access +# logging and build the access summary"), so the trust center never claims +# logging that is not configured. Operator-applied, like the rest of bootstrap. +# The delivery's record_fields list and ALLOWED_FIELDS in that script are the +# same list; tests/test_edge_access_logging.py holds them equal. +# ============================================================================= + +locals { + edge_access_log_name = "${local.domain_dashed}-edge-access" + # The existing access-log bucket, owned by the per-deploy stack (../logging.tf + # aws_s3_bucket.logs, already inventoried there); named, not read, here. + access_log_bucket_arn = "arn:aws:s3:::${local.domain_dashed}-logs" + edge_access_log_fields = [ + "date", + "time", + "x-edge-location", + "c-country", + "cs-method", + "cs-uri-stem", + "sc-status", + "sc-bytes", + "x-edge-result-type", + ] +} + + +resource "aws_cloudwatch_log_delivery_source" "edge_access" { + provider = aws.us_east_1 + name = local.edge_access_log_name + log_type = "ACCESS_LOGS" + resource_arn = aws_cloudfront_distribution.website.arn +} + +resource "aws_cloudwatch_log_delivery_destination" "edge_access" { + provider = aws.us_east_1 + name = local.edge_access_log_name + output_format = "json" + + delivery_destination_configuration { + destination_resource_arn = "${local.access_log_bucket_arn}/cloudfront" + } +} + +resource "aws_cloudwatch_log_delivery" "edge_access" { + provider = aws.us_east_1 + delivery_source_name = aws_cloudwatch_log_delivery_source.edge_access.name + delivery_destination_arn = aws_cloudwatch_log_delivery_destination.edge_access.arn + record_fields = local.edge_access_log_fields + + s3_delivery_configuration { + suffix_path = "{DistributionId}/{yyyy}/{MM}/{dd}/{HH}" + enable_hive_compatible_path = false + } +} + +# The deploy reads the delivery's configuration (to fail when it is absent or +# logs a forbidden field) and the CloudFront records (to build the aggregate +# summary). Read-only. Describe/Get on deliveries are account-level calls with +# no resource-level scoping for DescribeDeliveries; the Get* calls are scoped +# to this delivery's resources. The object read is limited to the two prefixes +# CloudFront delivery may write under. +data "aws_iam_policy_document" "edge_access_logs_read" { + # checkov:skip=CKV_AWS_356:logs:DescribeDeliveries is an account-level enumeration action that cannot be resource-scoped; read-only. Documented exception. + statement { + sid = "DescribeDeliveries" + actions = ["logs:DescribeDeliveries"] + resources = ["*"] + } + statement { + sid = "ReadEdgeAccessDelivery" + actions = [ + "logs:GetDelivery", + "logs:GetDeliverySource", + "logs:GetDeliveryDestination", + ] + resources = [ + "arn:aws:logs:us-east-1:${data.aws_caller_identity.current.account_id}:delivery:*", + aws_cloudwatch_log_delivery_source.edge_access.arn, + aws_cloudwatch_log_delivery_destination.edge_access.arn, + ] + } + statement { + sid = "ListEdgeAccessRecords" + actions = ["s3:ListBucket"] + resources = [local.access_log_bucket_arn] + condition { + test = "StringLike" + variable = "s3:prefix" + values = ["cloudfront/*", "AWSLogs/${data.aws_caller_identity.current.account_id}/CloudFront/*"] + } + } + statement { + sid = "ReadEdgeAccessRecords" + actions = ["s3:GetObject"] + resources = [ + "${local.access_log_bucket_arn}/cloudfront/*", + "${local.access_log_bucket_arn}/AWSLogs/${data.aws_caller_identity.current.account_id}/CloudFront/*", + ] + } +} + +resource "aws_iam_role_policy" "edge_access_logs_read" { + # checkov:skip=CKV_AWS_356:logs:DescribeDeliveries cannot be resource-scoped; read-only. Documented exception. + name = "edge-access-logs-read" + role = aws_iam_role.deploy.id + policy = data.aws_iam_policy_document.edge_access_logs_read.json +} diff --git a/infrastructure/keys/assessor-identity.json b/infrastructure/keys/assessor-identity.json new file mode 100644 index 00000000..831d1535 --- /dev/null +++ b/infrastructure/keys/assessor-identity.json @@ -0,0 +1,10 @@ +{ + "assessor": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml", + "algorithm": "SIGSTORE_KEYLESS", + "certificate_identity": "https://github.com/sam-aydlette/samaydlette.com/.github/workflows/simulated-assessor.yml@refs/heads/main", + "certificate_oidc_issuer": "https://token.actions.githubusercontent.com", + "pinned_on": "2026-11-05", + "simulated": true, + "note": "SIMULATED assessor. Its signing identity is the simulated-assessor.yml workflow in this repository (called by the deploy as a reusable workflow, so its Sigstore certificate names that workflow, not the deploy). It is not independent of the provider, not a FedRAMP Recognized independent assessment service, and has no FedRAMP assessor ID. Replacing it with a real assessor means pinning that assessor's own identity here in a reviewed change." +} diff --git a/infrastructure/logging.tf b/infrastructure/logging.tf index ed5decd5..fd2f518e 100644 --- a/infrastructure/logging.tf +++ b/infrastructure/logging.tf @@ -60,6 +60,26 @@ resource "aws_s3_bucket_lifecycle_configuration" "logs" { noncurrent_version_expiration { noncurrent_days = 30 } abort_incomplete_multipart_upload { days_after_initiation = 7 } } + # CloudFront access records (CDS-TRC-ACL) are kept 90 days, not 400: the + # operator's privacy limit. S3 applies the earliest expiration when rules + # overlap, so these prefixes expire at 90 days. Only aggregate monthly + # summaries outlive them (/.well-known/access-summary.json, 13 months). + rule { + id = "expire-edge-access-records" + status = "Enabled" + filter { prefix = "cloudfront/" } + expiration { days = 90 } + noncurrent_version_expiration { noncurrent_days = 1 } + abort_incomplete_multipart_upload { days_after_initiation = 7 } + } + rule { + id = "expire-edge-access-records-default-prefix" + status = "Enabled" + filter { prefix = "AWSLogs/${data.aws_caller_identity.current.account_id}/CloudFront/" } + expiration { days = 90 } + noncurrent_version_expiration { noncurrent_days = 1 } + abort_incomplete_multipart_upload { days_after_initiation = 7 } + } } # Allow the AWS log-delivery services to write to their respective prefixes, @@ -86,7 +106,13 @@ resource "aws_s3_bucket_policy" "logs" { Effect = "Allow" Principal = { Service = "delivery.logs.amazonaws.com" } Action = "s3:PutObject" - Resource = "${aws_s3_bucket.logs.arn}/cloudfront/*" + # cloudfront/ is the configured prefix (bootstrap/trust-access-logs.tf); + # AWSLogs//CloudFront/ is the service's default, kept so a + # delivery that ignores the prefix still lands under the 90-day expiry. + Resource = [ + "${aws_s3_bucket.logs.arn}/cloudfront/*", + "${aws_s3_bucket.logs.arn}/AWSLogs/${data.aws_caller_identity.current.account_id}/CloudFront/*", + ] Condition = { StringEquals = { "aws:SourceAccount" = data.aws_caller_identity.current.account_id } } diff --git a/infrastructure/policy/s3.rego b/infrastructure/policy/s3.rego index 7808baef..0243ac65 100644 --- a/infrastructure/policy/s3.rego +++ b/infrastructure/policy/s3.rego @@ -25,7 +25,7 @@ import data.policy.gate # id: versioning_disabled # category: infrastructure # severity: MEDIUM -# nist_controls: [cp-9, cp-10, si-12] +# nist_controls: [cp-9, cp-10] # ksi_ids: [KSI-RPL-ABO] violations contains violation if { some r in gate.resources diff --git a/infrastructure/schemas/assessor-record.schema.json b/infrastructure/schemas/assessor-record.schema.json index bd992c27..4b152eb7 100644 --- a/infrastructure/schemas/assessor-record.schema.json +++ b/infrastructure/schemas/assessor-record.schema.json @@ -2,7 +2,7 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://samaydlette.com/schemas/assessor-record.schema.json", "title": "Assessor record (REQ-ASR-1)", - "description": "A finding, summary or comment written and signed by an assessor. The signature is ECDSA P-256 with SHA-256 over the canonical form of the record without its \"signature\" member: keys sorted, separators \",\" and \":\" with no whitespace, UTF-8, non-ASCII characters unescaped. The signer must be the assessor identity pinned at infrastructure/keys/assessor-identity.json. The provider never edits a record; outputs carry its text verbatim with the signature.", + "description": "A finding, summary or comment written and signed by an assessor. The signature is ECDSA P-256 with SHA-256 over the canonical form of the record without its \"signature\" member: keys sorted, separators \",\" and \":\" with no whitespace, UTF-8, non-ASCII characters unescaped. The signer must be the assessor identity pinned at infrastructure/keys/assessor-identity.json. The provider never edits a record; outputs carry its text verbatim with the signature. A keyless assessor (pinned identity algorithm SIGSTORE_KEYLESS) instead signs one set file holding all its records with Sigstore, and each record carries algorithm SIGSTORE_KEYLESS_SET.", "type": "object", "additionalProperties": false, "required": ["record_type", "schema_version", "record_id", "assessor", "issued_at", "kind", "text", "signature"], @@ -28,8 +28,9 @@ "additionalProperties": false, "required": ["algorithm", "value"], "properties": { - "algorithm": {"const": "ECDSA_P256_SHA256"}, - "value": {"type": "string", "minLength": 1, "description": "Base64 DER signature."} + "algorithm": {"enum": ["ECDSA_P256_SHA256", "SIGSTORE_KEYLESS_SET"]}, + "value": {"type": "string", "minLength": 1, "description": "Base64 DER signature (ECDSA_P256_SHA256), or the hex sha256 of the record's canonical form (SIGSTORE_KEYLESS_SET)."}, + "signed_set": {"type": "string", "minLength": 1, "description": "SIGSTORE_KEYLESS_SET only: the name of the Sigstore-signed set file holding this record."} } } } diff --git a/infrastructure/schemas/ccm-calendar.json b/infrastructure/schemas/ccm-calendar.json new file mode 100644 index 00000000..55ab4988 --- /dev/null +++ b/infrastructure/schemas/ccm-calendar.json @@ -0,0 +1,34 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-24", + "2027-02-23", + "2027-05-25", + "2027-08-24", + "2027-11-23", + "2028-02-29", + "2028-05-30", + "2028-08-29", + "2028-11-28" + ], + "review_business_days_after_issue": 5, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", "2026-01-19", "2026-02-16", "2026-05-25", "2026-06-19", "2026-07-03", "2026-09-07", + "2026-10-12", "2026-11-11", "2026-11-26", "2026-12-25", + "2027-01-01", "2027-01-18", "2027-02-15", "2027-05-31", "2027-06-18", "2027-07-05", "2027-09-06", + "2027-10-11", "2027-11-11", "2027-11-25", "2027-12-24", "2027-12-31", + "2028-01-17", "2028-02-21", "2028-05-29", "2028-06-19", "2028-07-04", "2028-09-04", "2028-10-09", + "2028-11-10", "2028-11-23", "2028-12-25" + ] + } +} diff --git a/infrastructure/schemas/freshness-config.json b/infrastructure/schemas/freshness-config.json index 7d02d3de..6c1a400a 100644 --- a/infrastructure/schemas/freshness-config.json +++ b/infrastructure/schemas/freshness-config.json @@ -149,16 +149,17 @@ { "path": ".well-known/ongoing-certification-report.json", "cadence": "deploy", - "max_age_hours": 720, + "max_age_hours": 336, "timestamp": { "source": "json", - "field": "emitted_at" + "field": "metadata.lastUpdated" }, "signed": true, - "signature": ".well-known/ongoing-certification-report.bundle" + "signature": ".well-known/ongoing-certification-report.bundle", + "note": "Rebuilt on every deploy and daily by package-maintenance.yml at the deployed commit; 14 days is CPO-CSX-CPM's Class C maximum, so the watchdog pages before the package falls out of date." }, { - "path": ".well-known/certification-overview-package.json", + "path": ".well-known/availability.json", "cadence": "deploy", "max_age_hours": 720, "timestamp": { @@ -166,39 +167,40 @@ "field": "emitted_at" }, "signed": true, - "signature": ".well-known/certification-overview-package.bundle" + "signature": ".well-known/availability.bundle" }, { - "path": ".well-known/availability.json", + "path": ".well-known/policy-index.json", "cadence": "deploy", "max_age_hours": 720, "timestamp": { - "source": "json", - "field": "emitted_at" + "source": "last_modified" }, "signed": true, - "signature": ".well-known/availability.bundle" + "signature": ".well-known/policy-index.bundle" }, { - "path": ".well-known/policy-index.json", + "path": ".well-known/minimum-assessment-scope.json", "cadence": "deploy", "max_age_hours": 720, "timestamp": { - "source": "last_modified" + "source": "json", + "field": "generated_at" }, "signed": true, - "signature": ".well-known/policy-index.bundle" + "signature": ".well-known/minimum-assessment-scope.bundle" }, { "path": ".well-known/security-decision-record.json", "cadence": "deploy", - "max_age_hours": 720, + "max_age_hours": 336, "timestamp": { "source": "json", - "field": "metadata.last_updated" + "field": "metadata.lastUpdated" }, "signed": true, - "signature": ".well-known/security-decision-record.bundle" + "signature": ".well-known/security-decision-record.bundle", + "note": "Rebuilt on every deploy and daily by package-maintenance.yml at the deployed commit; 14 days is CPO-CSX-CPM's Class C maximum, so the watchdog pages before the package falls out of date." }, { "path": ".well-known/security-decision-record.json.intoto.jsonl", @@ -212,13 +214,82 @@ { "path": ".well-known/certification-package-overview.json", "cadence": "deploy", + "max_age_hours": 336, + "timestamp": { + "source": "json", + "field": "metadata.lastUpdated" + }, + "signed": true, + "signature": ".well-known/certification-package-overview.bundle", + "note": "Rebuilt on every deploy and daily by package-maintenance.yml at the deployed commit; 14 days is CPO-CSX-CPM's Class C maximum, so the watchdog pages before the package falls out of date." + }, + { + "path": ".well-known/ocr-issues.json", + "cadence": "deploy", + "max_age_hours": 336, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/ocr-issues.bundle", + "note": "Index of the issued Ongoing Certification Reports and their snapshots (CCM-OCR-AVL, CDS-CSO-HAD), rewritten daily by package-maintenance.yml. The issues (ocr-issue-.*) and snapshots (snapshot-.json, snapshots//) it lists are immutable by design, so they carry no freshness window: the index records each one's sha256." + }, + { + "path": ".well-known/quarterly-review.ics", + "cadence": "deploy", + "max_age_hours": 336, + "timestamp": { + "source": "last_modified" + }, + "signed": false, + "note": "Quarterly Review calendar file (CCM-QTR-REG), from the CCM calendar; written by the deploy and daily by package-maintenance.yml. Not signed: the same dates are in the signed CPO and OCR." + }, + { + "path": ".well-known/fedramp-certification-reports.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/fedramp-certification-reports.bundle", + "note": "Index of FedRAMP Certification Reports published unmodified (CDS-CSO-FRC). FedRAMP is simulated: the one report is a stand-in." + }, + { + "path": ".well-known/package-submission-log.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/package-submission-log.bundle", + "note": "Log of the simulated submission of the certification package to FedRAMP on each deploy (FRC-CSO-PKG). Nothing is sent." + }, + { + "path": ".well-known/secure-configuration-guide.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "emitted_at" + }, + "signed": true, + "signature": ".well-known/secure-configuration-guide.bundle" + }, + { + "path": ".well-known/security-settings.json", + "cadence": "deploy", "max_age_hours": 720, "timestamp": { "source": "json", - "field": "metadata.last_updated" + "field": "emitted_at" }, "signed": true, - "signature": ".well-known/certification-package-overview.bundle" + "signature": ".well-known/security-settings.bundle" }, { "path": ".well-known/boundary-map.json", @@ -276,6 +347,78 @@ "signed": true, "signature": ".well-known/conformance-results.bundle", "note": "The conformance suite's results for the method profile (REQ-GOV-2), run, signed and published by the deploy." + }, + { + "path": ".well-known/access-summary.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "emitted_at" + }, + "signed": true, + "signature": ".well-known/access-summary.bundle", + "note": "Monthly aggregate counts of access to the certification data (CDS-TRC-ACL), rebuilt from the CloudFront access records on every deploy." + }, + { + "path": ".well-known/assessor-guide.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/assessor-guide.bundle", + "note": "How to verify and validate each FedRAMP rule and KSI, generated from the rule records on every deploy (IVV-CSO-STE, IVV-CSO-DUS); the simulated assessor runs its checks." + }, + { + "path": ".well-known/simulated-assessment.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "issued_at" + }, + "signed": true, + "signature": ".well-known/simulated-assessment.bundle", + "note": "The simulated assessor's signed result set (not a FedRAMP Recognized assessment), produced on every deploy and signed by the simulated-assessor.yml workflow identity, not the deploy's." + }, + { + "path": ".well-known/frr-evidence.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/frr-evidence.bundle", + "note": "Per rule record, whether each test it cites passed in the build that published it (FRC-CSX-VVR)." + }, + { + "path": ".well-known/agency-access-exercise.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/agency-access-exercise.bundle", + "note": "The agency access procedure run on every deploy against fictional agencies, including the 5-business-day denial clock (CDS-TRC-AAI, CDS-UTC-AAD)." + }, + { + "path": ".well-known/trust-manifest.json", + "cadence": "deploy", + "max_age_hours": 720, + "timestamp": { + "source": "json", + "field": "generated_at" + }, + "signed": true, + "signature": ".well-known/trust-manifest.bundle", + "note": "The signed index of all certification data with media types, signatures and human-readable forms (CDS-TRC-PAC)." } ] } diff --git a/infrastructure/schemas/ksi-catalog.json b/infrastructure/schemas/ksi-catalog.json index 7353e477..4b8dc8a7 100644 --- a/infrastructure/schemas/ksi-catalog.json +++ b/infrastructure/schemas/ksi-catalog.json @@ -121,7 +121,7 @@ { "reference": "NIST SP 800-53B", "reference_url": "https://csrc.nist.gov/pubs/sp/800/53/b/upd1/final", - "description": "Section 2.5 states \"As the number of controls in [SP 800-53] grows in response to an increasingly sophisticated threat space, it is important for organizations to have the ability to describe key capabilities needed to protect organizational missions and business functions, and to subsequently select controls that\u2014if properly designed, developed, and implemented\u2014produce such capabilities. The use of capabilities simplifies how the protection problem is viewed conceptually. Using the construct of a capability provides a method of grouping controls that are employed for a common purpose or to achieve a common objective.\" This section later states \"Ultimately, authorization decisions (i.e., risk acceptance decisions) are made based on the degree to which the desired capabilities have been effectively achieved.\"" + "description": "Section 2.5 states \"As the number of controls in [SP 800-53] grows in response to an increasingly sophisticated threat space, it is important for organizations to have the ability to describe key capabilities needed to protect organizational missions and business functions, and to subsequently select controls that—if properly designed, developed, and implemented—produce such capabilities. The use of capabilities simplifies how the protection problem is viewed conceptually. Using the construct of a capability provides a method of grouping controls that are employed for a common purpose or to achieve a common objective.\" This section later states \"Ultimately, authorization decisions (i.e., risk acceptance decisions) are made based on the degree to which the desired capabilities have been effectively achieved.\"" }, { "reference": "NIST SP 800-53A", @@ -129,9 +129,9 @@ "description": "Section 3.5 states \"When organizations employ the concept of capabilities, automated and manual assessments account for all security and privacy controls that comprise the security and privacy capabilities. Assessors are aware of how the controls work together to provide such capabilities.\"" }, { - "reference": "FedRAMP Authorization Act (44 USC \u00a7 3609 (a) (1))", + "reference": "FedRAMP Authorization Act (44 USC § 3609 (a) (1))", "reference_url": "https://fedramp.gov/docs/authority/law/#a-roles-and-responsibilities", - "description": "requires that the Administrator of the General Services Administration shall \"in consultation with the [DHS] Secretary, develop, coordinate, and implement a process to support agency review, reuse, and standardization, where appropriate, of security assessments of cloud computing products and services...\" 44 USC \u00a7 3609 (c) (2) further states that \"the [GSA] Administrator shall establish a means for the automation of security assessments and reviews.\"", + "description": "requires that the Administrator of the General Services Administration shall \"in consultation with the [DHS] Secretary, develop, coordinate, and implement a process to support agency review, reuse, and standardization, where appropriate, of security assessments of cloud computing products and services...\" 44 USC § 3609 (c) (2) further states that \"the [GSA] Administrator shall establish a means for the automation of security assessments and reviews.\"", "delegation": "These responsibilities are delegated to the FedRAMP Director", "delegation_url": "https://www.gsa.gov/directives-library/gsa-delegations-of-authority-fedramp" } @@ -159,18 +159,6 @@ "moderate": true }, "controls": [ - { - "control_id": "cp-3", - "title": "Contingency Training" - }, - { - "control_id": "ir-2", - "title": "Incident Response Training" - }, - { - "control_id": "ps-6", - "title": "Access Agreements" - }, { "control_id": "at-2", "title": "Literacy Training and Awareness" @@ -183,6 +171,10 @@ "control_id": "at-2.3", "title": "Social Engineering and Mining" }, + { + "control_id": "at-3", + "title": "Role-based Training" + }, { "control_id": "at-3.5", "title": "Processing Personally Identifiable Information" @@ -191,13 +183,53 @@ "control_id": "at-4", "title": "Training Records" }, + { + "control_id": "cm-11", + "title": "User-installed Software" + }, + { + "control_id": "cp-3", + "title": "Contingency Training" + }, + { + "control_id": "cp-3.1", + "title": "Simulated Events" + }, + { + "control_id": "ir-2", + "title": "Incident Response Training" + }, + { + "control_id": "ir-2.1", + "title": "Simulated Events" + }, + { + "control_id": "ir-2.2", + "title": "Automated Training Environments" + }, { "control_id": "ir-2.3", "title": "Breach" }, { - "control_id": "at-3", - "title": "Role-based Training" + "control_id": "ir-9.2", + "title": "Training" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, + { + "control_id": "pl-4", + "title": "Rules of Behavior" + }, + { + "control_id": "pl-4.1", + "title": "Social Media and External Site/Application Usage Restrictions" + }, + { + "control_id": "ps-6", + "title": "Access Agreements" }, { "control_id": "sr-11.1", @@ -224,14 +256,26 @@ "control_id": "au-2", "title": "Event Logging" }, + { + "control_id": "ca-7.4", + "title": "Risk Monitoring" + }, { "control_id": "cm-3", "title": "Configuration Change Control" }, + { + "control_id": "cm-3.1", + "title": "Automated Documentation, Notification, and Prohibition of Changes" + }, { "control_id": "cm-3.2", "title": "Testing, Validation, and Documentation of Changes" }, + { + "control_id": "cm-3.6", + "title": "Cryptography Management" + }, { "control_id": "cm-4.2", "title": "Verification of Controls" @@ -243,10 +287,6 @@ { "control_id": "cm-8.3", "title": "Automated Unauthorized Component Detection" - }, - { - "control_id": "ma-2", - "title": "Controlled Maintenance" } ] }, @@ -345,6 +385,14 @@ "control_id": "cm-4.2", "title": "Verification of Controls" }, + { + "control_id": "cm-6.2", + "title": "Respond to Unauthorized Changes" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, { "control_id": "si-2", "title": "Flaw Remediation" @@ -370,6 +418,18 @@ "control_id": "cm-2", "title": "Baseline Configuration" }, + { + "control_id": "cm-8.4", + "title": "Accountability Information" + }, + { + "control_id": "cp-10.4", + "title": "Restore Within Time Period" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, { "control_id": "si-3", "title": "Malicious Code Protection" @@ -390,8 +450,48 @@ "title": "Independent Assessors" }, { - "control_id": "ca-7.1", - "title": "Independent Assessment" + "control_id": "cm-11", + "title": "User-installed Software" + }, + { + "control_id": "cm-6.2", + "title": "Respond to Unauthorized Changes" + }, + { + "control_id": "cp-10.4", + "title": "Restore Within Time Period" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, + { + "control_id": "sc-24", + "title": "Fail in Known State" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, + { + "control_id": "si-4.22", + "title": "Unauthorized Network Services" + }, + { + "control_id": "si-7", + "title": "Software, Firmware, and Information Integrity" + }, + { + "control_id": "si-7.1", + "title": "Integrity Checks" + }, + { + "control_id": "si-7.5", + "title": "Automated Response to Integrity Violations" + }, + { + "control_id": "si-7.7", + "title": "Integration of Detection and Response" } ] }, @@ -415,6 +515,10 @@ { "control_id": "pl-10", "title": "Baseline Selection" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" } ] }, @@ -447,6 +551,14 @@ "control_id": "ca-9", "title": "Internal System Connections" }, + { + "control_id": "sc-10", + "title": "Network Disconnect" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, { "control_id": "sc-7.3", "title": "Access Points" @@ -457,7 +569,7 @@ }, { "control_id": "sc-7.5", - "title": "Deny by Default \u2014 Allow by Exception" + "title": "Deny by Default — Allow by Exception" }, { "control_id": "sc-7.8", @@ -467,10 +579,6 @@ "control_id": "sc-8", "title": "Transmission Confidentiality and Integrity" }, - { - "control_id": "sc-10", - "title": "Network Disconnect" - }, { "control_id": "si-10", "title": "Information Input Validation" @@ -493,7 +601,16 @@ "low": true, "moderate": true }, - "controls": [] + "controls": [ + { + "control_id": "cp-2.5", + "title": "Continue Mission and Business Functions" + }, + { + "control_id": "sc-12.1", + "title": "Availability" + } + ] }, { "id": "KSI-CNA-RNT", @@ -516,9 +633,41 @@ "control_id": "cm-7.1", "title": "Periodic Review" }, + { + "control_id": "sc-7.10", + "title": "Prevent Exfiltration" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, + { + "control_id": "sc-7.20", + "title": "Dynamic Isolation and Segregation" + }, + { + "control_id": "sc-7.21", + "title": "Isolation of System Components" + }, { "control_id": "sc-7.5", - "title": "Deny by Default \u2014 Allow by Exception" + "title": "Deny by Default — Allow by Exception" + }, + { + "control_id": "si-10", + "title": "Information Input Validation" + }, + { + "control_id": "si-4.11", + "title": "Analyze Communications Traffic Anomalies" + }, + { + "control_id": "si-4.18", + "title": "Analyze Traffic and Covert Exfiltration" + }, + { + "control_id": "si-4.4", + "title": "Inbound and Outbound Communications Traffic" }, { "control_id": "si-8", @@ -535,10 +684,18 @@ "moderate": true }, "controls": [ + { + "control_id": "ir-4.2", + "title": "Dynamic Reconfiguration" + }, { "control_id": "sc-5", "title": "Denial-of-service Protection" }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, { "control_id": "si-8", "title": "Spam Protection" @@ -566,10 +723,22 @@ "control_id": "ac-17.3", "title": "Managed Access Control Points" }, + { + "control_id": "ac-4.21", + "title": "Physical or Logical Separation of Information Flows" + }, { "control_id": "ca-9", "title": "Internal System Connections" }, + { + "control_id": "cm-11", + "title": "User-installed Software" + }, + { + "control_id": "sc-10", + "title": "Network Disconnect" + }, { "control_id": "sc-4", "title": "Information in Shared System Resources" @@ -578,6 +747,14 @@ "control_id": "sc-7", "title": "Boundary Protection" }, + { + "control_id": "sc-7.20", + "title": "Dynamic Isolation and Segregation" + }, + { + "control_id": "sc-7.21", + "title": "Isolation of System Components" + }, { "control_id": "sc-7.7", "title": "Split Tunneling for Remote Devices" @@ -585,10 +762,6 @@ { "control_id": "sc-8", "title": "Transmission Confidentiality and Integrity" - }, - { - "control_id": "sc-10", - "title": "Network Disconnect" } ] } @@ -607,6 +780,10 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-2.13", + "title": "Disable Accounts for High-risk Individuals" + }, { "control_id": "ac-2.2", "title": "Automated Temporary and Emergency Account Management" @@ -615,18 +792,10 @@ "control_id": "ac-2.3", "title": "Disable Accounts" }, - { - "control_id": "ac-2.13", - "title": "Disable Accounts for High-risk Individuals" - }, { "control_id": "ac-6.7", "title": "Review of User Privileges" }, - { - "control_id": "ia-4.4", - "title": "Identify User Status" - }, { "control_id": "ia-12", "title": "Identity Proofing" @@ -642,6 +811,14 @@ { "control_id": "ia-12.5", "title": "Address Confirmation" + }, + { + "control_id": "ia-4.4", + "title": "Identify User Status" + }, + { + "control_id": "ia-8.4", + "title": "Use of Defined Profiles" } ] }, @@ -654,54 +831,70 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-2", + "title": "Account Management" + }, { "control_id": "ac-3", "title": "Access Enforcement" }, { - "control_id": "ia-5.1", - "title": "Password-based Authentication" + "control_id": "ia-2", + "title": "Identification and Authentication (Organizational Users)" }, { - "control_id": "ia-5.2", - "title": "Public Key-based Authentication" + "control_id": "ia-2.1", + "title": "Multi-factor Authentication to Privileged Accounts" }, { - "control_id": "ia-5.6", - "title": "Protection of Authenticators" + "control_id": "ia-2.2", + "title": "Multi-factor Authentication to Non-privileged Accounts" }, { - "control_id": "ia-6", - "title": "Authentication Feedback" + "control_id": "ia-2.6", + "title": "Access to Accounts —separate Device" }, { - "control_id": "ac-2", - "title": "Account Management" + "control_id": "ia-2.8", + "title": "Access to Accounts — Replay Resistant" }, { - "control_id": "ia-2", - "title": "Identification and Authentication (Organizational Users)" + "control_id": "ia-5", + "title": "Authenticator Management" }, { - "control_id": "ia-2.1", - "title": "Multi-factor Authentication to Privileged Accounts" + "control_id": "ia-5.1", + "title": "Password-based Authentication" }, { - "control_id": "ia-2.2", - "title": "Multi-factor Authentication to Non-privileged Accounts" + "control_id": "ia-5.2", + "title": "Public Key-based Authentication" }, { - "control_id": "ia-2.8", - "title": "Access to Accounts \u2014 Replay Resistant" + "control_id": "ia-5.6", + "title": "Protection of Authenticators" }, { - "control_id": "ia-5", - "title": "Authenticator Management" + "control_id": "ia-5.8", + "title": "Multiple System Accounts" + }, + { + "control_id": "ia-6", + "title": "Authentication Feedback" }, { "control_id": "ia-8", "title": "Identification and Authentication (Non-organizational Users)" }, + { + "control_id": "ia-8.2", + "title": "Acceptance of External Authenticators" + }, + { + "control_id": "ia-8.4", + "title": "Use of Defined Profiles" + }, { "control_id": "sc-23", "title": "Session Authenticity" @@ -717,26 +910,6 @@ "moderate": true }, "controls": [ - { - "control_id": "ac-2.5", - "title": "Inactivity Logout" - }, - { - "control_id": "ac-2.6", - "title": "Dynamic Privilege Management" - }, - { - "control_id": "ac-3", - "title": "Access Enforcement" - }, - { - "control_id": "ac-4", - "title": "Information Flow Enforcement" - }, - { - "control_id": "ac-6", - "title": "Least Privilege" - }, { "control_id": "ac-12", "title": "Session Termination" @@ -761,6 +934,30 @@ "control_id": "ac-17.3", "title": "Managed Access Control Points" }, + { + "control_id": "ac-18.4", + "title": "Restrict Configurations by Users" + }, + { + "control_id": "ac-2.11", + "title": "Usage Conditions" + }, + { + "control_id": "ac-2.5", + "title": "Inactivity Logout" + }, + { + "control_id": "ac-2.6", + "title": "Dynamic Privilege Management" + }, + { + "control_id": "ac-2.7", + "title": "Privileged User Accounts" + }, + { + "control_id": "ac-2.9", + "title": "Restrictions on Use of Shared and Group Accounts" + }, { "control_id": "ac-20", "title": "Use of External Systems" @@ -769,14 +966,62 @@ "control_id": "ac-20.1", "title": "Limits on Authorized Use" }, + { + "control_id": "ac-21", + "title": "Information Sharing" + }, + { + "control_id": "ac-3", + "title": "Access Enforcement" + }, + { + "control_id": "ac-4", + "title": "Information Flow Enforcement" + }, + { + "control_id": "ac-6", + "title": "Least Privilege" + }, + { + "control_id": "ac-6.3", + "title": "Network Access to Privileged Commands" + }, + { + "control_id": "ac-6.8", + "title": "Privilege Levels for Code Execution" + }, + { + "control_id": "au-12.3", + "title": "Changes by Authorized Individuals" + }, + { + "control_id": "au-6.7", + "title": "Permitted Actions" + }, { "control_id": "cm-2.7", "title": "Configure Systems and Components for High-risk Areas" }, + { + "control_id": "cm-5.1", + "title": "Automated Access Enforcement and Audit Records" + }, + { + "control_id": "cm-5.5", + "title": "Privilege Limitation for Production and Operation" + }, + { + "control_id": "cm-7.2", + "title": "Prevent Program Execution" + }, { "control_id": "cm-9", "title": "Configuration Management Plan" }, + { + "control_id": "ia-11", + "title": "Re-authentication" + }, { "control_id": "ia-2", "title": "Identification and Authentication (Organizational Users)" @@ -802,8 +1047,12 @@ "title": "Protection of Authenticators" }, { - "control_id": "ia-11", - "title": "Re-authentication" + "control_id": "ir-4.6", + "title": "Insider Threats" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" }, { "control_id": "ps-2", @@ -826,8 +1075,12 @@ "title": "Access Agreements" }, { - "control_id": "sc-4", - "title": "Information in Shared System Resources" + "control_id": "ra-5.5", + "title": "Privileged Access" + }, + { + "control_id": "sc-2", + "title": "Separation of System and User Functionality" }, { "control_id": "sc-20", @@ -845,13 +1098,25 @@ "control_id": "sc-23", "title": "Session Authenticity" }, + { + "control_id": "sc-3", + "title": "Security Function Isolation" + }, { "control_id": "sc-39", "title": "Process Isolation" }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, { "control_id": "si-3", "title": "Malicious Code Protection" + }, + { + "control_id": "si-4.19", + "title": "Risk for Individuals" } ] }, @@ -864,6 +1129,14 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-17", + "title": "Remote Access" + }, + { + "control_id": "ac-17.4", + "title": "Privileged Commands and Access" + }, { "control_id": "ac-2", "title": "Account Management" @@ -872,6 +1145,10 @@ "control_id": "ac-2.1", "title": "Automated System Account Management" }, + { + "control_id": "ac-2.11", + "title": "Usage Conditions" + }, { "control_id": "ac-2.2", "title": "Automated Temporary and Emergency Account Management" @@ -888,6 +1165,18 @@ "control_id": "ac-2.6", "title": "Dynamic Privilege Management" }, + { + "control_id": "ac-2.7", + "title": "Privileged User Accounts" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "ac-21", + "title": "Information Sharing" + }, { "control_id": "ac-3", "title": "Access Enforcement" @@ -908,10 +1197,18 @@ "control_id": "ac-6.1", "title": "Authorize Access to Security Functions" }, + { + "control_id": "ac-6.10", + "title": "Prohibit Non-privileged Users from Executing Privileged Functions" + }, { "control_id": "ac-6.2", "title": "Non-privileged Access for Nonsecurity Functions" }, + { + "control_id": "ac-6.3", + "title": "Network Access to Privileged Commands" + }, { "control_id": "ac-6.5", "title": "Privileged Accounts" @@ -921,33 +1218,45 @@ "title": "Review of User Privileges" }, { - "control_id": "ac-6.9", - "title": "Log Use of Privileged Functions" + "control_id": "ac-6.8", + "title": "Privilege Levels for Code Execution" }, { - "control_id": "ac-6.10", - "title": "Prohibit Non-privileged Users from Executing Privileged Functions" + "control_id": "ac-6.9", + "title": "Log Use of Privileged Functions" }, { "control_id": "ac-7", "title": "Unsuccessful Logon Attempts" }, { - "control_id": "ac-20.1", - "title": "Limits on Authorized Use" + "control_id": "au-10", + "title": "Non-repudiation" }, { - "control_id": "ac-17", - "title": "Remote Access" + "control_id": "au-12.3", + "title": "Changes by Authorized Individuals" }, { "control_id": "au-9.4", "title": "Access by Subset of Privileged Users" }, + { + "control_id": "ca-3.6", + "title": "Transfer Authorizations" + }, { "control_id": "cm-5", "title": "Access Restrictions for Change" }, + { + "control_id": "cm-5.1", + "title": "Automated Access Enforcement and Audit Records" + }, + { + "control_id": "cm-5.5", + "title": "Privilege Limitation for Production and Operation" + }, { "control_id": "cm-7", "title": "Least Functionality" @@ -958,7 +1267,7 @@ }, { "control_id": "cm-7.5", - "title": "Authorized Software \u2014 Allow-by-exception" + "title": "Authorized Software — Allow-by-exception" }, { "control_id": "cm-9", @@ -976,6 +1285,10 @@ "control_id": "ia-7", "title": "Cryptographic Module Authentication" }, + { + "control_id": "ir-4.6", + "title": "Insider Threats" + }, { "control_id": "ps-2", "title": "Position Risk Designation" @@ -1012,6 +1325,10 @@ "control_id": "sc-23", "title": "Session Authenticity" }, + { + "control_id": "sc-3", + "title": "Security Function Isolation" + }, { "control_id": "sc-39", "title": "Process Isolation" @@ -1035,6 +1352,10 @@ "control_id": "ac-2.2", "title": "Automated Temporary and Emergency Account Management" }, + { + "control_id": "ac-2.9", + "title": "Restrictions on Use of Shared and Group Accounts" + }, { "control_id": "ac-4", "title": "Information Flow Enforcement" @@ -1043,6 +1364,14 @@ "control_id": "ac-6.5", "title": "Privileged Accounts" }, + { + "control_id": "au-10", + "title": "Non-repudiation" + }, + { + "control_id": "ia-2.5", + "title": "Individual Authentication with Group Authentication" + }, { "control_id": "ia-3", "title": "Device Identification and Authentication" @@ -1075,17 +1404,45 @@ "title": "Automated System Account Management" }, { - "control_id": "ac-2.3", - "title": "Disable Accounts" + "control_id": "ac-2.11", + "title": "Usage Conditions" + }, + { + "control_id": "ac-2.12", + "title": "Account Monitoring for Atypical Usage" }, { "control_id": "ac-2.13", "title": "Disable Accounts for High-risk Individuals" }, + { + "control_id": "ac-2.3", + "title": "Disable Accounts" + }, { "control_id": "ac-7", "title": "Unsuccessful Logon Attempts" }, + { + "control_id": "au-6.5", + "title": "Integrated Analysis of Audit Records" + }, + { + "control_id": "cm-5.1", + "title": "Automated Access Enforcement and Audit Records" + }, + { + "control_id": "cm-6.2", + "title": "Respond to Unauthorized Changes" + }, + { + "control_id": "ir-4.2", + "title": "Dynamic Reconfiguration" + }, + { + "control_id": "ir-4.6", + "title": "Insider Threats" + }, { "control_id": "ps-4", "title": "Personnel Termination" @@ -1093,6 +1450,30 @@ { "control_id": "ps-8", "title": "Personnel Sanctions" + }, + { + "control_id": "si-4", + "title": "System Monitoring" + }, + { + "control_id": "si-4.1", + "title": "System-wide Intrusion Detection System" + }, + { + "control_id": "si-4.19", + "title": "Risk for Individuals" + }, + { + "control_id": "si-4.20", + "title": "Privileged Users" + }, + { + "control_id": "si-4.22", + "title": "Unauthorized Network Services" + }, + { + "control_id": "si-4.4", + "title": "Inbound and Outbound Communications Traffic" } ] } @@ -1123,9 +1504,17 @@ "control_id": "ir-4.1", "title": "Automated Incident Handling Processes" }, + { + "control_id": "ir-5.1", + "title": "Automated Tracking, Data Collection, and Analysis" + }, { "control_id": "ir-8", "title": "Incident Response Plan" + }, + { + "control_id": "ir-9.3", + "title": "Post-spill Operations" } ] }, @@ -1146,6 +1535,10 @@ "control_id": "ir-4.1", "title": "Automated Incident Handling Processes" }, + { + "control_id": "ir-4.11", + "title": "Integrated Incident Response Team" + }, { "control_id": "ir-6", "title": "Incident Reporting" @@ -1174,6 +1567,10 @@ "control_id": "ir-8.1", "title": "Breaches" }, + { + "control_id": "ir-9.3", + "title": "Post-spill Operations" + }, { "control_id": "si-4.5", "title": "System-generated Alerts" @@ -1201,13 +1598,29 @@ "control_id": "ir-4.1", "title": "Automated Incident Handling Processes" }, + { + "control_id": "ir-4.11", + "title": "Integrated Incident Response Team" + }, + { + "control_id": "ir-4.4", + "title": "Information Correlation" + }, { "control_id": "ir-5", "title": "Incident Monitoring" }, + { + "control_id": "ir-5.1", + "title": "Automated Tracking, Data Collection, and Analysis" + }, { "control_id": "ir-8", "title": "Incident Response Plan" + }, + { + "control_id": "ra-5.8", + "title": "Review Historic Audit Logs" } ] } @@ -1226,6 +1639,14 @@ "moderate": true }, "controls": [ + { + "control_id": "au-12.3", + "title": "Changes by Authorized Individuals" + }, + { + "control_id": "au-6.7", + "title": "Permitted Actions" + }, { "control_id": "si-11", "title": "Error Handling" @@ -1241,6 +1662,10 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, { "control_id": "ca-7", "title": "Continuous Monitoring" @@ -1253,6 +1678,14 @@ "control_id": "cm-6", "title": "Configuration Settings" }, + { + "control_id": "cm-6.1", + "title": "Automated Management, Application, and Verification" + }, + { + "control_id": "ra-3", + "title": "Risk Assessment" + }, { "control_id": "si-7.7", "title": "Integration of Detection and Response" @@ -1268,33 +1701,57 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-17.1", + "title": "Monitoring and Control" + }, { "control_id": "ac-2.4", "title": "Automated Audit Actions" }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, { "control_id": "ac-6.9", "title": "Log Use of Privileged Functions" }, { - "control_id": "ac-17.1", - "title": "Monitoring and Control" + "control_id": "au-10", + "title": "Non-repudiation" + }, + { + "control_id": "au-12", + "title": "Audit Record Generation" + }, + { + "control_id": "au-2", + "title": "Event Logging" + }, + { + "control_id": "au-7", + "title": "Audit Record Reduction and Report Generation" + }, + { + "control_id": "au-7.1", + "title": "Automatic Processing" }, { - "control_id": "ac-20.1", - "title": "Limits on Authorized Use" + "control_id": "cm-5.1", + "title": "Automated Access Enforcement and Audit Records" }, { - "control_id": "au-2", - "title": "Event Logging" + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" }, { - "control_id": "au-7.1", - "title": "Automatic Processing" + "control_id": "si-4.19", + "title": "Risk for Individuals" }, { - "control_id": "au-12", - "title": "Audit Record Generation" + "control_id": "si-4.20", + "title": "Privileged Users" }, { "control_id": "si-4.4", @@ -1327,6 +1784,14 @@ "control_id": "ac-20.1", "title": "Limits on Authorized Use" }, + { + "control_id": "au-11", + "title": "Audit Record Retention" + }, + { + "control_id": "au-12.1", + "title": "System-wide and Time-correlated Audit Trail" + }, { "control_id": "au-2", "title": "Event Logging" @@ -1347,6 +1812,10 @@ "control_id": "au-5", "title": "Response to Audit Logging Process Failures" }, + { + "control_id": "au-5.1", + "title": "Storage Capacity Warning" + }, { "control_id": "au-6.1", "title": "Automated Process Integration" @@ -1355,6 +1824,14 @@ "control_id": "au-6.3", "title": "Correlate Audit Record Repositories" }, + { + "control_id": "au-6.4", + "title": "Central Review and Analysis" + }, + { + "control_id": "au-6.5", + "title": "Integrated Analysis of Audit Records" + }, { "control_id": "au-7", "title": "Audit Record Reduction and Report Generation" @@ -1371,14 +1848,14 @@ "control_id": "au-9", "title": "Protection of Audit Information" }, - { - "control_id": "au-11", - "title": "Audit Record Retention" - }, { "control_id": "ir-4.1", "title": "Automated Incident Handling Processes" }, + { + "control_id": "si-4.16", + "title": "Correlate Monitoring Information" + }, { "control_id": "si-4.2", "title": "Automated Tools and Mechanisms for Real-time Analysis" @@ -1386,10 +1863,6 @@ { "control_id": "si-4.4", "title": "Inbound and Outbound Communications Traffic" - }, - { - "control_id": "si-7.7", - "title": "Integration of Detection and Response" } ] }, @@ -1422,10 +1895,22 @@ "control_id": "au-6.1", "title": "Automated Process Integration" }, + { + "control_id": "au-7", + "title": "Audit Record Reduction and Report Generation" + }, + { + "control_id": "ra-5.8", + "title": "Review Historic Audit Logs" + }, { "control_id": "si-4", "title": "System Monitoring" }, + { + "control_id": "si-4.19", + "title": "Risk for Individuals" + }, { "control_id": "si-4.4", "title": "Inbound and Outbound Communications Traffic" @@ -1447,13 +1932,21 @@ "moderate": true }, "controls": [ + { + "control_id": "cm-12", + "title": "Information Location" + }, + { + "control_id": "cm-12.1", + "title": "Automated Tools to Support Information Location" + }, { "control_id": "cm-2.2", "title": "Automation Support for Accuracy and Currency" }, { "control_id": "cm-7.5", - "title": "Authorized Software \u2014 Allow-by-exception" + "title": "Authorized Software — Allow-by-exception" }, { "control_id": "cm-8", @@ -1464,12 +1957,12 @@ "title": "Updates During Installation and Removal" }, { - "control_id": "cm-12", - "title": "Information Location" + "control_id": "cm-8.2", + "title": "Automated Maintenance" }, { - "control_id": "cm-12.1", - "title": "Automated Tools to Support Information Location" + "control_id": "cm-8.4", + "title": "Accountability Information" }, { "control_id": "cp-2.8", @@ -1504,6 +1997,10 @@ "control_id": "ca-2", "title": "Control Assessments" }, + { + "control_id": "ca-2.2", + "title": "Specialized Assessments" + }, { "control_id": "cp-2.1", "title": "Coordinate with Related Plans" @@ -1516,6 +2013,10 @@ "control_id": "ir-3.2", "title": "Coordination with Related Plans" }, + { + "control_id": "ir-4.11", + "title": "Integrated Incident Response Team" + }, { "control_id": "pm-3", "title": "Information Security and Privacy Resources" @@ -1555,6 +2056,10 @@ "control_id": "cm-3.4", "title": "Security and Privacy Representatives" }, + { + "control_id": "ia-5.7", + "title": "No Embedded Unencrypted Static Authenticators" + }, { "control_id": "pl-8", "title": "Security and Privacy Architectures" @@ -1563,6 +2068,10 @@ "control_id": "pm-7", "title": "Enterprise Architecture" }, + { + "control_id": "ra-9", + "title": "Criticality Analysis" + }, { "control_id": "sa-3", "title": "System Development Life Cycle" @@ -1571,14 +2080,14 @@ "control_id": "sa-8", "title": "Security and Privacy Engineering Principles" }, - { - "control_id": "sc-4", - "title": "Information in Shared System Resources" - }, { "control_id": "sc-18", "title": "Mobile Code" }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, { "control_id": "si-10", "title": "Information Input Validation" @@ -1642,10 +2151,6 @@ { "control_id": "cp-10.2", "title": "Transaction Recovery" - }, - { - "control_id": "si-12", - "title": "Information Management and Retention" } ] }, @@ -1752,6 +2257,10 @@ "moderate": true }, "controls": [ + { + "control_id": "cp-10", + "title": "System Recovery and Reconstitution" + }, { "control_id": "cp-2.1", "title": "Coordinate with Related Plans" @@ -1780,10 +2289,6 @@ "control_id": "cp-9.1", "title": "Testing for Reliability and Integrity" }, - { - "control_id": "cp-10", - "title": "System Recovery and Reconstitution" - }, { "control_id": "ir-3", "title": "Incident Response Testing" @@ -1791,6 +2296,14 @@ { "control_id": "ir-3.2", "title": "Coordination with Related Plans" + }, + { + "control_id": "ir-9.3", + "title": "Post-spill Operations" + }, + { + "control_id": "sc-12.1", + "title": "Availability" } ] } @@ -1803,23 +2316,31 @@ { "id": "KSI-SCR-MIT", "name": "Mitigating Supply Chain Risk", - "statement": "Persistently identify, review, and mitigate potential supply chain risks.", + "statement": "Potential supply chain risks are persistently identified, reviewed, and mitigated.", "impact": { "low": true, "moderate": true }, "controls": [ + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, { "control_id": "ac-20", "title": "Use of External Systems" }, { - "control_id": "ra-3.1", - "title": "Supply Chain Risk Assessment" + "control_id": "ca-7.4", + "title": "Risk Monitoring" }, { - "control_id": "sa-9", - "title": "External System Services" + "control_id": "ra-3", + "title": "Risk Assessment" + }, + { + "control_id": "ra-3.1", + "title": "Supply Chain Risk Assessment" }, { "control_id": "sa-10", @@ -1829,33 +2350,101 @@ "control_id": "sa-11", "title": "Developer Testing and Evaluation" }, + { + "control_id": "sa-11.1", + "title": "Static Code Analysis" + }, + { + "control_id": "sa-11.2", + "title": "Threat Modeling and Vulnerability Analyses" + }, + { + "control_id": "sa-15", + "title": "Development Process, Standards, and Tools" + }, { "control_id": "sa-15.3", "title": "Criticality Analysis" }, + { + "control_id": "sa-16", + "title": "Developer-provided Training" + }, + { + "control_id": "sa-17", + "title": "Developer Security and Privacy Architecture and Design" + }, + { + "control_id": "sa-21", + "title": "Developer Screening" + }, { "control_id": "sa-22", "title": "Unsupported System Components" }, { - "control_id": "si-7.1", - "title": "Integrity Checks" + "control_id": "sa-4", + "title": "Acquisition Process" }, { - "control_id": "sr-5", - "title": "Acquisition Strategies, Tools, and Methods" + "control_id": "sa-4.1", + "title": "Functional Properties of Controls" }, { - "control_id": "sr-6", - "title": "Supplier Assessments and Reviews" + "control_id": "sa-4.2", + "title": "Design and Implementation Information for Controls" }, { - "control_id": "ca-7.4", - "title": "Risk Monitoring" + "control_id": "sa-4.5", + "title": "System, Component, and Service Configurations" + }, + { + "control_id": "sa-4.9", + "title": "Functions, Ports, Protocols, and Services in Use" + }, + { + "control_id": "sa-9", + "title": "External System Services" + }, + { + "control_id": "sa-9.1", + "title": "Risk Assessments and Organizational Approvals" + }, + { + "control_id": "sa-9.2", + "title": "Identification of Functions, Ports, Protocols, and Services" + }, + { + "control_id": "sa-9.5", + "title": "Processing, Storage, and Service Location" }, { "control_id": "sc-18", "title": "Mobile Code" + }, + { + "control_id": "si-7.1", + "title": "Integrity Checks" + }, + { + "control_id": "si-7.15", + "title": "Code Authentication" + }, + { + "control_id": "sr-2", + "title": "Supply Chain Risk Management Plan" + }, + { + "control_id": "sr-3", + "title": "Supply Chain Controls and Processes" + }, + { + "control_id": "sr-5", + "title": "Acquisition Strategies, Tools, and Methods" + }, + { + "control_id": "sr-6", + "title": "Supplier Assessments and Reviews" } ] }, @@ -1868,10 +2457,18 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, { "control_id": "ac-20", "title": "Use of External Systems" }, + { + "control_id": "ca-2.3", + "title": "Leveraging Results from External Organizations" + }, { "control_id": "ca-3", "title": "Information Exchange" @@ -1884,6 +2481,10 @@ "control_id": "ps-7", "title": "External Personnel Security" }, + { + "control_id": "ra-3", + "title": "Risk Assessment" + }, { "control_id": "ra-5", "title": "Vulnerability Monitoring and Scanning" @@ -1896,6 +2497,10 @@ "control_id": "si-5", "title": "Security Alerts, Advisories, and Directives" }, + { + "control_id": "sr-3", + "title": "Supply Chain Controls and Processes" + }, { "control_id": "sr-5", "title": "Acquisition Strategies, Tools, and Methods" @@ -1929,6 +2534,10 @@ "control_id": "ac-2.4", "title": "Automated Audit Actions" }, + { + "control_id": "ac-6.8", + "title": "Privilege Levels for Code Execution" + }, { "control_id": "cm-2", "title": "Baseline Configuration" @@ -1949,18 +2558,30 @@ "control_id": "cm-7.1", "title": "Periodic Review" }, - { - "control_id": "pl-9", - "title": "Central Management" - }, { "control_id": "pl-10", "title": "Baseline Selection" }, + { + "control_id": "pl-9", + "title": "Central Management" + }, { "control_id": "sa-5", "title": "System Documentation" }, + { + "control_id": "sc-45", + "title": "System Time Synchronization" + }, + { + "control_id": "sc-45.1", + "title": "Synchronization with Authoritative Time Source" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, { "control_id": "si-5", "title": "Security Alerts, Advisories, and Directives" @@ -1996,6 +2617,10 @@ "control_id": "sc-12", "title": "Cryptographic Key Establishment and Management" }, + { + "control_id": "sc-12.1", + "title": "Availability" + }, { "control_id": "sc-17", "title": "Public Key Infrastructure Certificates" @@ -2012,29 +2637,41 @@ }, "controls": [ { - "control_id": "cm-7.1", - "title": "Periodic Review" + "control_id": "ca-7.4", + "title": "Risk Monitoring" }, { "control_id": "cm-12.1", "title": "Automated Tools to Support Information Location" }, { - "control_id": "ma-2", - "title": "Controlled Maintenance" + "control_id": "cm-5.5", + "title": "Privilege Limitation for Production and Operation" + }, + { + "control_id": "cm-7.1", + "title": "Periodic Review" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" }, { "control_id": "pl-8", "title": "Security and Privacy Architectures" }, { - "control_id": "sc-7", - "title": "Boundary Protection" + "control_id": "ra-3", + "title": "Risk Assessment" }, { "control_id": "sc-39", "title": "Process Isolation" }, + { + "control_id": "sc-7", + "title": "Boundary Protection" + }, { "control_id": "si-2.2", "title": "Automated Flaw Remediation Status" @@ -2058,9 +2695,25 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, + { + "control_id": "sc-12.1", + "title": "Availability" + }, { "control_id": "sc-4", "title": "Information in Shared System Resources" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" } ] }, @@ -2073,6 +2726,10 @@ "moderate": true }, "controls": [ + { + "control_id": "ir-9", + "title": "Information Spillage Response" + }, { "control_id": "si-12.3", "title": "Information Disposal" @@ -2080,6 +2737,14 @@ { "control_id": "si-18.4", "title": "Individual Requests" + }, + { + "control_id": "si-8", + "title": "Spam Protection" + }, + { + "control_id": "si-8.2", + "title": "Automatic Updates" } ] }, @@ -2093,25 +2758,33 @@ }, "controls": [ { - "control_id": "ac-1", - "title": "Policy and Procedures" + "control_id": "ac-11", + "title": "Device Lock" + }, + { + "control_id": "ac-11.1", + "title": "Pattern-hiding Displays" }, { "control_id": "ac-17.2", "title": "Protection of Confidentiality and Integrity Using Encryption" }, { - "control_id": "cp-9.8", - "title": "Cryptographic Protection" + "control_id": "ac-19.5", + "title": "Full Device or Container-based Encryption" }, { - "control_id": "sc-8", - "title": "Transmission Confidentiality and Integrity" + "control_id": "ac-21", + "title": "Information Sharing" }, { - "control_id": "sc-8.1", + "control_id": "cp-9.8", "title": "Cryptographic Protection" }, + { + "control_id": "ir-9.4", + "title": "Exposure to Unauthorized Personnel" + }, { "control_id": "sc-13", "title": "Cryptographic Protection" @@ -2139,6 +2812,26 @@ { "control_id": "sc-28.1", "title": "Cryptographic Protection" + }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, + { + "control_id": "sc-7.18", + "title": "Fail Secure" + }, + { + "control_id": "sc-8", + "title": "Transmission Confidentiality and Integrity" + }, + { + "control_id": "sc-8.1", + "title": "Cryptographic Protection" + }, + { + "control_id": "si-4.18", + "title": "Analyze Traffic and Covert Exfiltration" } ] }, @@ -2151,10 +2844,30 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-10", + "title": "Concurrent Session Control" + }, + { + "control_id": "ac-17.4", + "title": "Privileged Commands and Access" + }, + { + "control_id": "ac-18", + "title": "Wireless Access" + }, + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, { "control_id": "sc-23", "title": "Session Authenticity" }, + { + "control_id": "si-4.22", + "title": "Unauthorized Network Services" + }, { "control_id": "si-7.1", "title": "Integrity Checks" @@ -2170,6 +2883,26 @@ "moderate": true }, "controls": [ + { + "control_id": "ac-17.4", + "title": "Privileged Commands and Access" + }, + { + "control_id": "ac-18", + "title": "Wireless Access" + }, + { + "control_id": "ac-19", + "title": "Access Control for Mobile Devices" + }, + { + "control_id": "au-9.3", + "title": "Cryptographic Protection" + }, + { + "control_id": "cm-14", + "title": "Signed Components" + }, { "control_id": "cm-2.2", "title": "Automation Support for Accuracy and Currency" @@ -2194,9 +2927,17 @@ "control_id": "si-7.1", "title": "Integrity Checks" }, + { + "control_id": "si-7.15", + "title": "Code Authentication" + }, { "control_id": "sr-10", "title": "Inspection of Systems or Components" + }, + { + "control_id": "sr-11", + "title": "Component Authenticity" } ] } diff --git a/scripts/_assessor.py b/scripts/_assessor.py index 60a4d720..07967498 100644 --- a/scripts/_assessor.py +++ b/scripts/_assessor.py @@ -17,11 +17,23 @@ With no records there is nothing to verify and no identity is needed; the SDR states "no assessor record". + +Keyless set (load_assessment): an assessor that signs with Sigstore instead of a +key it holds signs one set file holding all its records. The pinned identity +then names the signing workflow's certificate identity and OIDC issuer +(algorithm SIGSTORE_KEYLESS). The set is accepted only when cosign verifies its +bundle against exactly that identity, and each record in it is accepted only +when it names the pinned assessor and its signature value is the sha256 of its +canonical form (algorithm SIGSTORE_KEYLESS_SET), so a record is bound to the +signed set and cannot be altered alone. The set and its bundle are published, +so anyone can repeat the check. This is how the simulated assessor +(tools/simulated-assessor/, .github/workflows/simulated-assessor.yml) signs. """ import base64 import copy import hashlib import json +import subprocess # nosec B404: runs cosign with a fixed argument list import sys from pathlib import Path @@ -30,6 +42,9 @@ IDENTITY_PATH = REPO / "infrastructure" / "keys" / "assessor-identity.json" ALGORITHM = "ECDSA_P256_SHA256" +KEYLESS = "SIGSTORE_KEYLESS" # the pinned identity of a keyless assessor +SET_ALGORITHM = "SIGSTORE_KEYLESS_SET" # a record bound to a keyless-signed set +SET_TYPE = "simulated-independent-assessment" KINDS = ("finding", "summary", "comment") REQUIRED = ("record_type", "schema_version", "record_id", "assessor", "issued_at", "kind", "text", "signature") # What an output carries for each record: the signed fields, verbatim, plus the signature. @@ -60,8 +75,8 @@ def _shape(rec, name): a, s = rec["assessor"], rec["signature"] if not isinstance(a, dict) or not a.get("organization") or not a.get("key_id"): _fail(f"{name} does not name its assessor (organization and key_id)") - if not isinstance(s, dict) or s.get("algorithm") != ALGORITHM or not s.get("value"): - _fail(f"{name} carries no {ALGORITHM} signature") + if not isinstance(s, dict) or s.get("algorithm") not in (ALGORITHM, SET_ALGORITHM) or not s.get("value"): + _fail(f"{name} carries no {ALGORITHM} or {SET_ALGORITHM} signature") for k in ("record_id", "issued_at", "text"): if not isinstance(rec[k], str) or not rec[k].strip(): _fail(f"{name} has an empty {k}") @@ -75,6 +90,9 @@ def _load_identity(path): _fail(f"records are present but no assessor identity is pinned at {p}") try: ident = json.loads(p.read_text()) + if ident.get("algorithm") == KEYLESS: + _fail(f"the pinned identity {p} is keyless: its records arrive only as a signed set " + "(load_assessment), never as loose files") pem = ident["public_key_pem"].encode("ascii") except (json.JSONDecodeError, KeyError, AttributeError, UnicodeEncodeError) as exc: _fail(f"pinned identity {p} is unreadable ({type(exc).__name__})") @@ -86,6 +104,8 @@ def _load_identity(path): def _verify(rec, name, ident, pem): + if rec["signature"]["algorithm"] != ALGORITHM: + _fail(f"{name} is not signed with {ALGORITHM}") try: from cryptography.exceptions import InvalidSignature from cryptography.hazmat.primitives import hashes, serialization @@ -127,6 +147,83 @@ def load_records(records_dir=RECORDS_DIR, identity_path=IDENTITY_PATH): return records +# --- keyless set ------------------------------------------------------------------------ + +def load_keyless_identity(path=IDENTITY_PATH): + p = Path(path) + try: + ident = json.loads(p.read_text()) + except (OSError, json.JSONDecodeError) as exc: + _fail(f"no readable keyless assessor identity at {p} ({type(exc).__name__})") + if not isinstance(ident, dict) or ident.get("algorithm") != KEYLESS: + _fail(f"the identity pinned at {p} is not a {KEYLESS} identity") + for k in ("assessor", "key_id", "certificate_identity", "certificate_oidc_issuer"): + if not isinstance(ident.get(k), str) or not ident[k]: + _fail(f"the identity pinned at {p} does not name its {k}") + return ident + + +def cosign_verify(set_path, bundle_path, ident): + """True when cosign verifies the bundle over the set file against exactly the + pinned certificate identity and issuer (no regular expression).""" + r = subprocess.run(["cosign", "verify-blob", "--bundle", str(bundle_path), + "--certificate-identity", ident["certificate_identity"], + "--certificate-oidc-issuer", ident["certificate_oidc_issuer"], str(set_path)], + capture_output=True, text=True, check=False) # nosec B603: fixed argv + return r.returncode == 0 + + +def load_assessment(set_path, bundle_path, identity_path=IDENTITY_PATH, verifier=cosign_verify): + """Every record in a keyless-signed assessment set, verified. Fails closed when + the set or its bundle is missing: the deploy depends on the assessment.""" + sp, bp = Path(set_path), Path(bundle_path) + for f, what in ((sp, "assessment set"), (bp, "assessment bundle")): + if not f.is_file() or f.stat().st_size == 0: + _fail(f"the {what} {f} is missing: the deploy depends on the assessor's signed record") + ident = load_keyless_identity(identity_path) + if not verifier(sp, bp, ident): + _fail(f"{sp.name} signature does not verify against the pinned assessor identity") + try: + doc = json.loads(sp.read_text()) + except json.JSONDecodeError: + _fail(f"{sp.name} is not valid JSON") + if not isinstance(doc, dict) or doc.get("assessment_type") != SET_TYPE or doc.get("schema_version") != "1": + _fail(f"{sp.name} is not a {SET_TYPE} set, schema version 1") + a = doc.get("assessor") or {} + if a.get("organization") != ident["assessor"] or a.get("key_id") != ident["key_id"]: + _fail(f"{sp.name} names {a.get('organization')!r}, not the pinned assessor identity") + recs = doc.get("records") + if not isinstance(recs, list) or not recs: + _fail(f"{sp.name} holds no records") + seen, out = set(), [] + for i, rec in enumerate(recs): + name = f"{sp.name} record {i}" + _shape(rec, name) + ra, sig = rec["assessor"], rec["signature"] + if ra["organization"] != ident["assessor"] or ra["key_id"] != ident["key_id"]: + _fail(f"{name} names {ra['organization']!r} / {ra['key_id']!r}, not the pinned assessor identity") + if sig["algorithm"] != SET_ALGORITHM or sig.get("signed_set") != sp.name: + _fail(f"{name} is not bound to the signed set {sp.name}") + if sig["value"] != hashlib.sha256(canonical(rec)).hexdigest(): + _fail(f"{name} ({rec['record_id']}) differs from the record the assessor signed") + if rec["record_id"] in seen: + _fail(f"record_id {rec['record_id']} appears twice") + seen.add(rec["record_id"]) + out.append(rec) + if not any(r["kind"] == "summary" and "rule_id" not in r for r in out): + _fail(f"{sp.name} has no overall summary (IVV-IAS-OSA)") + return out + + +def overall_summary(records): + """The assessor's overall summary record (IVV-IAS-OSA), carried verbatim, or + None. The CPO quotes it (CPO-CSO-OSA).""" + sums = [r for r in records if r["kind"] == "summary" and "rule_id" not in r] + if len(sums) > 1: + _fail("more than one overall summary record") + return _carried(sums[0]) if sums else None + + def _carried(rec): return {k: copy.deepcopy(rec[k]) for k in CARRIED} @@ -155,6 +252,12 @@ def verify_output(sdr, records): signed record is carried. Fails the build otherwise.""" signed = {r["record_id"]: _carried(r) for r in records} carried = [] + pe = sdr.get("providerExtensions") + if isinstance(pe, dict): + # The SDR in FedRAMP's schema keeps them under providerExtensions. + for entries in (pe.get("assessorCommentResponses") or {}).values(): + carried += entries or [] + carried += (pe.get("assessorRecords") or {}).get("records", []) or [] for rr in sdr.get("rule_records", []): carried += rr.get("assessor_comment_responses", []) or [] carried += (sdr.get("assessor_records") or {}).get("records", []) or [] @@ -177,8 +280,13 @@ def main(argv=None): ap.add_argument("--records", default=str(RECORDS_DIR)) ap.add_argument("--identity", default=str(IDENTITY_PATH)) ap.add_argument("--sdr", default=None, help="a built security-decision-record.json to check") + ap.add_argument("--assessment", default=None, help="a keyless-signed assessment set") + ap.add_argument("--assessment-bundle", default=None) a = ap.parse_args(argv) - records = load_records(a.records, a.identity) + if a.assessment: + records = load_assessment(a.assessment, a.assessment_bundle or a.assessment[:-5] + ".bundle", a.identity) + else: + records = load_records(a.records, a.identity) if a.sdr: verify_output(json.loads(Path(a.sdr).read_text()), records) print(f"assessor records: {len(records)} verified" + ("; SDR carries them verbatim" if a.sdr else "")) diff --git a/scripts/_ccm.py b/scripts/_ccm.py new file mode 100644 index 00000000..ad813f04 --- /dev/null +++ b/scripts/_ccm.py @@ -0,0 +1,243 @@ +"""The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). + +infrastructure/schemas/ccm-calendar.json fixes the Ongoing Certification Report +issue dates and how many business days after each issue the Quarterly Review +falls. Everything that publishes a next-report or next-review date (the OCR, the +CPO, the review calendar file) reads it here, so the dates are the same +everywhere and stay put between issues (CCM-OCR-NRD, CCM-QTR-NRD). + +Fails closed, stdlib only. The calendar must: +- list issue dates in order, each a business day, 84 to 98 days after the one + before (a regular 3-month cycle); +- place every issue date away from the beginning, middle and end of its quarter + (more than 14 days from either end, more than 7 from the middle); +- put each review 3 to 10 business days after its issue; +- cover every date it computes with its holiday list; +- keep at least two issue dates ahead of `today`, so it cannot quietly run out. +""" + +import json +import re +from datetime import date, datetime, timedelta, timezone +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent +CALENDAR_PATH = REPO / "infrastructure" / "schemas" / "ccm-calendar.json" +SITE = "https://samaydlette.com" +REPO_URL = "https://github.com/sam-aydlette/samaydlette.com" +ICS_URL = f"{SITE}/.well-known/quarterly-review.ics" +ISSUES_INDEX_URL = f"{SITE}/.well-known/ocr-issues.json" +FEEDBACK_FORM = "ocr-feedback.yml" +REGISTRATION_FORM = "quarterly-review-registration.yml" +REGISTRATION_URL = f"{REPO_URL}/issues/new?template={REGISTRATION_FORM}" +MIN_GAP_DAYS, MAX_GAP_DAYS = 84, 98 +EDGE_DAYS, MID_DAYS = 14, 7 +MIN_FUTURE_ISSUES = 2 +_HHMM = re.compile(r"^([01]\d|2[0-3]):[0-5]\d$") + + +def _fail(msg): + raise SystemExit(f"::error::CCM calendar: {msg} (fail-closed)") + + +def _date(v, what): + try: + return date.fromisoformat(v) + except (TypeError, ValueError): + _fail(f"{what} {v!r} is not a YYYY-MM-DD date") + + +def quarter_bounds(d): + q0 = (d.month - 1) // 3 * 3 + 1 + start = date(d.year, q0, 1) + end = date(d.year + (q0 + 3 > 12), (q0 + 2) % 12 + 1, 1) - timedelta(days=1) + return start, end + + +class Calendar: + def __init__(self, doc): + self.doc = doc + self.issues = [_date(d, "issue date") for d in doc["ocr_issue_dates"]] + self.holidays = {_date(d, "holiday") for d in doc["holidays"]["dates"]} + self.covers_through = _date(doc["holidays"]["covers_through"], "holidays.covers_through") + self.offset = doc["review_business_days_after_issue"] + self.start_utc = doc["review_start_utc"] + self.duration = doc["review_duration_minutes"] + + def is_business_day(self, d): + if d > self.covers_through: + _fail(f"{d} is past the holiday list (covers through {self.covers_through})") + return d.weekday() < 5 and d not in self.holidays + + def add_business_days(self, d, n): + while n > 0: + d += timedelta(days=1) + if self.is_business_day(d): + n -= 1 + return d + + def review_date(self, issue): + return self.add_business_days(issue, self.offset) + + def issued(self, today): + """Issue dates on or before `today`.""" + return [d for d in self.issues if d <= today] + + def next_issue(self, today): + """The next issue date strictly after `today`: stable from one issue to the next.""" + return next(d for d in self.issues if d > today) + + def next_review(self, today): + """The next review on or after `today` (the one following the latest + issue, until it has happened).""" + return next(r for r in (self.review_date(d) for d in self.issues) if r >= today) + + def period(self, issue): + """(from, to) an issue covers: the previous issue to this one. The first + issue covers the 3 months before it.""" + i = self.issues.index(issue) + start = self.issues[i - 1] if i else issue - timedelta(days=91) + return start, issue + + def current_period(self, today): + """(from, to) of the report as it stands today: since the latest issue.""" + done = self.issued(today) + return (done[-1] if done else self.issues[0] - timedelta(days=91)), today + + def review_start(self, issue): + h, m = (int(x) for x in self.start_utc.split(":")) + r = self.review_date(issue) + return datetime(r.year, r.month, r.day, h, m, tzinfo=timezone.utc) + + +def validate(doc, today): + if not isinstance(doc, dict) or doc.get("schema") != "ccm-calendar/1": + _fail("not a ccm-calendar/1 document") + for k in ("decided_by", "decided_on", "review_by", "rationale"): + if not isinstance(doc.get(k), str) or not doc[k].strip(): + _fail(f"{k} is missing") + if _date(doc["review_by"], "review_by") < today: + _fail(f"review_by {doc['review_by']} has passed: the calendar needs a fresh decision") + off = doc.get("review_business_days_after_issue") + if not isinstance(off, int) or isinstance(off, bool) or not 3 <= off <= 10: + _fail("review_business_days_after_issue must be 3 to 10 (CCM-QTR-SAR)") + if not _HHMM.match(str(doc.get("review_start_utc", ""))): + _fail("review_start_utc must be HH:MM") + dur = doc.get("review_duration_minutes") + if not isinstance(dur, int) or isinstance(dur, bool) or not 15 <= dur <= 240: + _fail("review_duration_minutes must be 15 to 240") + if not isinstance(doc.get("ocr_issue_dates"), list) or len(doc["ocr_issue_dates"]) < 2: + _fail("ocr_issue_dates must list at least two dates") + if not isinstance(doc.get("holidays"), dict) or not isinstance(doc["holidays"].get("dates"), list): + _fail("holidays.dates must be a list") + cal = Calendar(doc) + prev = None + for d in cal.issues: + if prev is not None and not MIN_GAP_DAYS <= (d - prev).days <= MAX_GAP_DAYS: + _fail(f"{d} is {(d - prev).days} days after {prev}: not a regular 3-month cycle") + if not cal.is_business_day(d): + _fail(f"issue date {d} is not a business day") + qs, qe = quarter_bounds(d) + mid = qs + (qe - qs) / 2 + if (d - qs).days < EDGE_DAYS or (qe - d).days < EDGE_DAYS or abs((d - mid).days) <= MID_DAYS: + _fail(f"issue date {d} is at the beginning, middle or end of its quarter (CCM-OCR-SOR)") + cal.review_date(d) # inside the holiday coverage + prev = d + if sum(1 for d in cal.issues if d > today) < MIN_FUTURE_ISSUES: + _fail(f"fewer than {MIN_FUTURE_ISSUES} issue dates after {today}: extend the calendar") + return cal + + +def load(path=CALENDAR_PATH, today=None): + today = today or datetime.now(timezone.utc).date() + try: + doc = json.loads(Path(path).read_text()) + except (OSError, ValueError) as exc: + _fail(f"cannot read {path}: {exc}") + return validate(doc, today) + + +def feedback_url(issue): + """The asynchronous feedback channel for one OCR issue (CCM-OCR-FBM): a + GitHub issue form, prefilled with the issue's date.""" + return f"{REPO_URL}/issues/new?template={FEEDBACK_FORM}&ocr={issue.isoformat()}" + + +# --- the review calendar file (CCM-QTR-REG) ----------------------------------------- + +def _ics_escape(s): + return s.replace("\\", "\\\\").replace(";", "\\;").replace(",", "\\,").replace("\n", "\\n") + + +def _fold(line): + """RFC 5545 3.1: lines longer than 75 octets continue with a leading space.""" + raw = line.encode("utf-8") + if len(raw) <= 75: + return line + out, cur = [], b"" + for ch in line: + b = ch.encode("utf-8") + if len(cur) + len(b) > (75 if not out else 74): + out.append(cur.decode("utf-8")) + cur = b"" + cur += b + out.append(cur.decode("utf-8")) + return "\r\n ".join(out) + + +def ics(cal, today): + """One VEVENT per Quarterly Review from the latest issued report on. + Deterministic: DTSTAMP is the calendar's decision date.""" + stamp = cal.doc["decided_on"].replace("-", "") + "T000000Z" + done = cal.issued(today) + first = done[-1] if done else cal.issues[0] + lines = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//samaydlette.com//CCM quarterly review//EN", + "CALSCALE:GREGORIAN", "METHOD:PUBLISH", "X-WR-CALNAME:samaydlette.com Quarterly Review"] + for issue in cal.issues: + if issue < first: + continue + start = cal.review_start(issue) + end = start + timedelta(minutes=cal.duration) + desc = (f"Quarterly Review (CCM-QTR-MTG) of the Ongoing Certification Report issued {issue}. " + f"Report: {SITE}/.well-known/ocr-issue-{issue}.json (published on the issue date). " + f"Register: {REGISTRATION_URL} . The operator hosts the review by video call and sends " + f"the join link to registered parties. Questions about the report: {feedback_url(issue)}") + lines += ["BEGIN:VEVENT", f"UID:qtr-review-{issue}@samaydlette.com", f"DTSTAMP:{stamp}", + f"DTSTART:{start.strftime('%Y%m%dT%H%M%SZ')}", f"DTEND:{end.strftime('%Y%m%dT%H%M%SZ')}", + f"SUMMARY:{_ics_escape(f'samaydlette.com Quarterly Review (OCR {issue})')}", + f"DESCRIPTION:{_ics_escape(desc)}", f"URL:{REGISTRATION_URL}", + "LOCATION:Video call (link sent on registration)", "END:VEVENT"] + lines.append("END:VCALENDAR") + return "\r\n".join(_fold(x) for x in lines) + "\r\n" + + +def dates_summary(cal, today): + """What the CPO and the OCR publish about the cycle.""" + nxt = cal.next_issue(today) + return {"nextOngoingCertificationReportDate": nxt.isoformat(), + "nextQuarterlyReviewDate": cal.next_review(today).isoformat(), + "quarterlyReviewCalendar": ICS_URL, + "quarterlyReviewRegistration": REGISTRATION_URL, + "ongoingCertificationReportIssues": ISSUES_INDEX_URL, + "issueDates": [d.isoformat() for d in cal.issues], + "reviewBusinessDaysAfterIssue": cal.offset} + + +def main(argv=None): + import argparse + ap = argparse.ArgumentParser(description="Validate the CCM calendar and write the review .ics.") + ap.add_argument("--calendar", default=str(CALENDAR_PATH)) + ap.add_argument("--ics", default=None, help="write the Quarterly Review calendar file here") + a = ap.parse_args(argv) + today = datetime.now(timezone.utc).date() + cal = load(a.calendar, today) + if a.ics: + Path(a.ics).write_text(ics(cal, today), newline="") + s = dates_summary(cal, today) + print(f"CCM calendar: next report {s['nextOngoingCertificationReportDate']}, " + f"next review {s['nextQuarterlyReviewDate']}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/_offering.py b/scripts/_offering.py new file mode 100644 index 00000000..742e4bbb --- /dev/null +++ b/scripts/_offering.py @@ -0,0 +1,82 @@ +"""The offering's declared identity (data/cds/offering.json), shared by every report. + +CDS-CSO-FID: every FedRAMP report this repository publishes carries the same +FedRAMP ID, read here and nowhere else, under providerExtensions.fedRampId +(FedRAMP's report schemas other than the CPO have no field for it; the CPO +carries it in serviceIdentification.fedRampPackageId). No ID has been +assigned, so the value is FedRAMP's own fallback, the provider name and +acronym, marked as not real; scripts/check-fedramp-id.py fails the deploy if a +report it publishes carries none or another. + +Also the semver content-hash version the CPO and OCR share with the SDR. +""" + +import hashlib +import json +import re +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent +OFFERING_PATH = REPO / "data" / "cds" / "offering.json" +SEMVER = re.compile(r"^(\d+)\.(\d+)\.(\d+)$") +NOT_REAL = "NOT-A-REAL" + + +def _fail(msg): + raise SystemExit(f"::error::offering: {msg} (fail-closed)") + + +def load(path=OFFERING_PATH): + try: + off = json.loads(Path(path).read_text()) + except (OSError, ValueError) as exc: + _fail(f"cannot read {path}: {exc}") + for k in ("provider_name", "service_acronym", "fedramp_id"): + if not isinstance(off.get(k), str) or not off[k].strip(): + _fail(f"{k} is missing") + fid = off["fedramp_id"] + # Until FedRAMP assigns one, FedRAMP's fallback: the provider's name and acronym. + if off["provider_name"] not in fid or off["service_acronym"] not in fid: + _fail("fedramp_id must carry the provider name and acronym (FedRAMP's fallback) until one is assigned") + if NOT_REAL in fid and not off.get("fedramp_id_simulated"): + _fail("a placeholder FedRAMP ID must say why (fedramp_id_simulated)") + return off + + +def fedramp_id(path=OFFERING_PATH): + return load(path)["fedramp_id"] + + +# --- versioning (CPO-CSO-MTD, and the OCR alike) -------------------------------------- + +def content_hash(doc, volatile=("metadata",), volatile_ext=("contentSha256",)): + """sha256 of what the version tracks: the document without its version, + timestamp and update source, the hash itself, and any providerExtensions field named volatile.""" + body = {k: v for k, v in doc.items() if k not in (*volatile, "providerExtensions")} + body["metadata"] = {k: v for k, v in (doc.get("metadata") or {}).items() + if k not in ("version", "lastUpdated", "updateSource")} + pe = {k: v for k, v in (doc.get("providerExtensions") or {}).items() if k not in volatile_ext} + raw = json.dumps({"body": body, "pe": pe}, sort_keys=True, separators=(",", ":")).encode() + return hashlib.sha256(raw).hexdigest() + + +def next_version(prev, digest): + """Unchanged content keeps the previous version, changed content bumps the + patch, and a previous document without a semver starts at 1.0.0.""" + v = ((prev or {}).get("metadata") or {}).get("version", "") + m = SEMVER.match(v or "") + if not m: + return "1.0.0" + if ((prev or {}).get("providerExtensions") or {}).get("contentSha256") == digest: + return v + return f"{m.group(1)}.{m.group(2)}.{int(m.group(3)) + 1}" + + +def stamp_version(doc, prev, now, source, volatile_ext=("contentSha256",)): + """Set providerExtensions.contentSha256 and metadata {version, lastUpdated, updateSource}.""" + digest = content_hash(doc, volatile_ext=volatile_ext) + doc.setdefault("providerExtensions", {})["contentSha256"] = digest + doc["metadata"] = {"version": next_version(prev, digest), "lastUpdated": now.isoformat(), + "updateSource": source, **{k: v for k, v in (doc.get("metadata") or {}).items() + if k not in ("version", "lastUpdated", "updateSource")}} + return doc diff --git a/scripts/_sensitivity.py b/scripts/_sensitivity.py new file mode 100644 index 00000000..4cea2fbf --- /dev/null +++ b/scripts/_sensitivity.py @@ -0,0 +1,71 @@ +"""Sensitivity screen for the Ongoing Certification Report (CCM-OCR-LSI, CCM-QTR-NID). + +The OCR and the content prepared for a Quarterly Review are public. Before +either is written, every string in it is screened for what would help an +attacker or identify a person, and the build fails closed on any hit: + + account-id a standalone twelve-digit number (an AWS account ID; _redact) + email an email address outside the system's domain and FedRAMP's + ipv4 an IPv4 address + aws-key an AWS access key ID (AKIA/ASIA...) + token a GitHub token or a private key block + handle a GitHub @handle (feedback summaries are anonymized: no names) + +What it reports never repeats the matched text. The operator's judgment of +anything the screen cannot see is recorded per report as the public-release +determination (CCM-OCR-RPS), a decision record. +""" + +import re +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _redact # noqa: E402 + +ALLOWED_EMAIL_DOMAINS = ("samaydlette.com", "fedramp.gov", "gsa.gov") +PATTERNS = { + "email": re.compile(r"[A-Za-z0-9._%+-]+@([A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+)"), + "ipv4": re.compile(r"(?= 0 else -1 + while n: + d += timedelta(days=step) + if is_business_day(d): + n -= step + return d + + +# --- the register ------------------------------------------------------------------------------ + +def _date(v, where): + try: + return date.fromisoformat(v) + except (TypeError, ValueError): + _fail(f"{where} is not a YYYY-MM-DD date: {v!r}") + + +def validate(doc, where): + if not isinstance(doc, dict) or doc.get("schema") != "agency-access/1" or not isinstance(doc.get("requests"), list): + _fail(f"{where} is not an agency-access/1 document") + seen = {} + for r in doc["requests"]: + rid = r.get("id") if isinstance(r, dict) else None + if not isinstance(rid, str) or not ID_RE.match(rid) or rid in seen: + _fail(f"{where}: request id {rid!r} is not a unique AAR-XXX") + if set(r) - RECORD_KEYS: + _fail(f"{rid}: unknown field(s) {sorted(set(r) - RECORD_KEYS)}") + for k in ("agency", "channel"): + if not isinstance(r.get(k), str) or not r[k].strip(): + _fail(f"{rid}: {k} must be a non-empty string") + # The register records agencies and systems, never people. + if any(isinstance(v, str) and EMAIL_RE.search(v) for v in r.values()): + _fail(f"{rid}: carries an email address; the register names agencies and systems, not people") + if r.get("kind") not in KINDS: + _fail(f"{rid}: kind must be one of {list(KINDS)}") + received = _date(r.get("received_on"), f"{rid} received_on") + if r["kind"] == "withdrawal": + if r.get("withdraws") not in seen or seen[r["withdraws"]].get("decision") != "granted": + _fail(f"{rid}: withdraws must name an earlier granted request") + if r.get("decision") is not None: + if r["decision"] not in DECISIONS or r["kind"] != "access": + _fail(f"{rid}: only an access request is decided, granted or denied") + if _date(r.get("decided_on"), f"{rid} decided_on") < received: + _fail(f"{rid}: decided before it was received") + if not isinstance(r.get("decided_by"), str) or not r["decided_by"].strip(): + _fail(f"{rid}: a decision names who made it (decided_by)") + if r["decision"] == "denied" and not (isinstance(r.get("reason"), str) and r["reason"].strip()): + _fail(f"{rid}: a denial states its reason") + if r.get("fedramp_notified_on") is not None: + if r.get("decision") != "denied": + _fail(f"{rid}: only a denial is notified to FedRAMP") + if _date(r["fedramp_notified_on"], f"{rid} fedramp_notified_on") < date.fromisoformat(r["decided_on"]): + _fail(f"{rid}: FedRAMP notified before the denial") + seen[rid] = r + return doc + + +def process(doc, today): + reqs = sorted(doc["requests"], key=lambda r: (r["received_on"], r["id"])) + withdrawn = {r["withdraws"]: r for r in reqs if r["kind"] == "withdrawal"} + inventory, history, notices = [], [], [] + for r in reqs: + history.append({"date": r["received_on"], "request": r["id"], "event": f"{r['kind']} received", + "agency": r["agency"], "system": r.get("system")}) + if r.get("decision"): + history.append({"date": r["decided_on"], "request": r["id"], "event": r["decision"], + "agency": r["agency"], "system": r.get("system")}) + if r.get("decision") == "granted": + w = withdrawn.get(r["id"]) + if w is None: + inventory.append({"request": r["id"], "agency": r["agency"], "system": r.get("system"), + "since": r["decided_on"]}) + else: + history.append({"date": w["received_on"], "request": r["id"], "event": "access withdrawn", + "agency": r["agency"], "system": r.get("system")}) + if r.get("decision") == "denied": + decided = date.fromisoformat(r["decided_on"]) + deadline = add_business_days(decided, NOTICE_DAYS) + sent = r.get("fedramp_notified_on") + if sent: + state = "on time" if date.fromisoformat(sent) <= deadline else "late" + history.append({"date": sent, "request": r["id"], "event": "denial notified to FedRAMP", + "agency": r["agency"], "system": r.get("system")}) + else: + state = "pending" if today <= deadline else "overdue" + notices.append({"request": r["id"], "agency": r["agency"], "denied_on": r["decided_on"], + "reason": r["reason"], "deadline": deadline.isoformat(), "notified_on": sent, + "state": state, + "to": "FedRAMP (simulated recipient: nothing is sent; this entry is the notice)"}) + history.sort(key=lambda h: (h["date"], h["request"])) + problems = [f"{n['request']}: FedRAMP denial notice {n['state']} (deadline {n['deadline']})" + for n in notices if n["state"] in ("late", "overdue")] + return {"as_of": today.isoformat(), "inventory": inventory, "history": history, "denial_notices": notices, + "inventory_requests": [r["id"] for r in reqs if r["kind"] == "inventory-request"], + "problems": problems} + + +def load(path): + p = Path(path) + try: + return validate(json.loads(p.read_text()), str(p)) + except (OSError, json.JSONDecodeError) as exc: + _fail(f"cannot read {p}: {exc}") + + +# --- the exercise --------------------------------------------------------------------------------- + +def materialize(scenario, today): + """Turn the scenario's business-day offsets (relative to today) into dates.""" + out = [] + for r in scenario["requests"]: + r = dict(r) + for k in ("received_on", "decided_on", "fedramp_notified_on"): + off = r.pop(f"{k}_offset", None) + if off is not None: + r[k] = add_business_days(today, off).isoformat() + out.append(r) + return {"schema": "agency-access/1", "requests": out} + + +def observe(result): + obs = {f"{i['request']}": "in inventory" for i in result["inventory"]} + for h in result["history"]: + if h["event"] == "access withdrawn": + obs[h["request"]] = "withdrawn" + for n in result["denial_notices"]: + obs[n["request"]] = f"denial notice {n['state']}" + for rid in result["inventory_requests"]: + obs[rid] = "inventory supplied" + return obs + + +def exercise(scenario, today): + doc = validate(materialize(scenario, today), "exercise scenario") + result = process(doc, today) + observed = observe(result) + expected = scenario["expected"] + mismatches = [f"{k}: expected {v!r}, observed {observed.get(k)!r}" for k, v in sorted(expected.items()) + if observed.get(k) != v] + mismatches += [f"{k}: observed {v!r} with no expectation" for k, v in sorted(observed.items()) + if k not in expected] + return doc, result, mismatches + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + sub = ap.add_subparsers(dest="cmd", required=True) + v = sub.add_parser("validate") + v.add_argument("--register", default=str(REGISTER)) + i = sub.add_parser("inventory") + i.add_argument("--register", default=str(REGISTER)) + e = sub.add_parser("exercise") + e.add_argument("--scenario", default=str(SCENARIO)) + e.add_argument("--output", default="agency-access-exercise.json") + e.add_argument("--md-output", default="agency-access-exercise.md") + for p in (v, i, e): + p.add_argument("--today", default=None, help="YYYY-MM-DD (default: today, UTC)") + a = ap.parse_args(argv) + today = date.fromisoformat(a.today) if a.today else datetime.now(timezone.utc).date() + + if a.cmd in ("validate", "inventory"): + result = process(load(a.register), today) + if a.cmd == "inventory": + print(json.dumps({"as_of": result["as_of"], "inventory": result["inventory"], + "history": result["history"]}, indent=2)) + return 0 + for p in result["problems"]: + print(f"::error::{p}") + if result["problems"]: + _fail(f"{len(result['problems'])} denial notice(s) to FedRAMP late or overdue") + print(f"agency access: {len(result['inventory'])} on record; {len(result['denial_notices'])} denial " + f"notice(s), none late or overdue") + return 0 + + scenario = json.loads(Path(a.scenario).read_text()) + doc, result, mismatches = exercise(scenario, today) + for m in mismatches: + print(f"::error::agency access exercise: {m}") + if mismatches: + _fail("the exercise did not produce the expected outcomes") + log = {"log_type": "agency-access-exercise", "fedRampId": _offering.fedramp_id(), "simulated": True, "counterparty": "agency", + "generated_at": datetime.now(timezone.utc).isoformat(), "as_of": today.isoformat(), + "disclaimer": scenario["disclaimer"], "procedure": "docs/procedures/agency-access.md", + "notice_window_business_days": NOTICE_DAYS, + "outcome": "every expected outcome observed", "expected": scenario["expected"], + "requests": doc["requests"], **{k: result[k] for k in ("inventory", "history", "denial_notices")}} + Path(a.output).write_text(json.dumps(log, indent=2) + "\n") + if a.md_output: + Path(a.md_output).write_text(render_markdown(log) + "\n") + print(f"agency access exercise: {len(scenario['expected'])} expected outcomes observed") + return 0 + + +def render_markdown(log): + out = ["# Agency access exercise (simulated)", "", f"_{log['disclaimer']}_", "", + f"- **As of:** {log['as_of']} | **Generated:** {log['generated_at']}", + f"- **Procedure:** `{log['procedure']}` | **Denial notice window:** " + f"{log['notice_window_business_days']} business days", f"- **Outcome:** {log['outcome']}", "", + "## Expected and observed", "", "| Request | Outcome |", "|---|---|"] + out += [f"| {k} | {v} |" for k, v in sorted(log["expected"].items())] + out += ["", "## Inventory on record", "", "| Request | Agency | System | Since |", "|---|---|---|---|"] + out += [f"| {i['request']} | {i['agency']} | {i.get('system') or '—'} | {i['since']} |" for i in log["inventory"]] + out += ["", "## Denial notices to FedRAMP (simulated; nothing is sent)", "", + "| Request | Agency | Denied | Deadline | Notified | State |", "|---|---|---|---|---|---|"] + out += [f"| {n['request']} | {n['agency']} | {n['denied_on']} | {n['deadline']} | {n['notified_on'] or '—'} | " + f"{n['state']} |" for n in log["denial_notices"]] + out += ["", "## History", "", "| Date | Request | Event | Agency |", "|---|---|---|---|"] + out += [f"| {h['date']} | {h['request']} | {h['event']} | {h['agency']} |" for h in log["history"]] + out += ["", "## Requests", "", "```json", json.dumps(log["requests"], indent=2), "```", + "", "---", "_Source of truth: the signed `agency-access-exercise.json`._"] + return "\n".join(out) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/availability-probe.py b/scripts/availability-probe.py new file mode 100644 index 00000000..a1e601e8 --- /dev/null +++ b/scripts/availability-probe.py @@ -0,0 +1,252 @@ +#!/usr/bin/env python3 +"""Independent availability monitor (CDS-CSO-AVR, CDS-TRC-USH). + +Runs on GitHub Actions (.github/workflows/availability-probe.yml), outside AWS, +so it keeps reporting when the offering is down. Each run probes the core +services once over HTTPS, appends the result to the rolling history carried in +the previous feed, derives availability incidents, and writes: + + availability-status.json machine-readable: current status, 30-day + availability per service, incidents, samples + availability-status.md the same for people + +The workflow publishes both to the repository's `availability-status` branch, +served by GitHub (raw.githubusercontent.com and the github.com file view), not +by the offering's own CloudFront or S3. + +An incident is a service failing on INCIDENT_MIN_SAMPLES or more consecutive +probes; it starts at the first failing probe and ends at the next passing one. +A single failed probe is counted as transient, not an incident, since one probe +from one runner can fail for reasons on the runner's side. + + availability-probe.py --previous prev.json --out-dir status (probe) + availability-probe.py --check-fresh feed.json --max-age-hours 2 (deploy guard) +""" +import argparse +import json +import sys +import time +import urllib.error +import urllib.request +from datetime import datetime, timedelta, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _offering # noqa: E402 + +SITE = "https://samaydlette.com" +COGNITO_UI = "https://samaydlette-com-silk-reeling.auth.us-east-2.amazoncognito.com/" +# (key, service, url, statuses that mean "up") +TARGETS = ( + ("site", "Website", f"{SITE}/", (200,)), + ("trust-center", "Trust center", f"{SITE}/trust/", (200,)), + ("certification-data", "Certification data (/.well-known/)", f"{SITE}/.well-known/ksi-signal.json", (200,)), + ("silk-reeling", "Silk Reeling application", f"{SITE}/silk-reeling/", (200,)), + ("silk-reeling-sign-in", "Silk Reeling sign-in (Cognito hosted UI)", COGNITO_UI, (200,)), +) +HISTORY_DAYS = 35 +WINDOW_DAYS = 30 +INCIDENT_MIN_SAMPLES = 2 +TIMEOUT_S = 20 +FEED_URL = ("https://raw.githubusercontent.com/sam-aydlette/samaydlette.com/" + "availability-status/availability-status.json") +PAGE_URL = ("https://github.com/sam-aydlette/samaydlette.com/blob/" + "availability-status/availability-status.md") + + +def _iso(dt): + return dt.astimezone(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z") + + +def _parse(s): + return datetime.fromisoformat(str(s).replace("Z", "+00:00")) + + +def fetch(url): + """(up-or-status reason, HTTP status or None). No redirects followed.""" + class NoRedirect(urllib.request.HTTPRedirectHandler): + def redirect_request(self, *a, **k): + return None + opener = urllib.request.build_opener(NoRedirect) + req = urllib.request.Request(url, headers={"User-Agent": "samaydlette-availability-probe"}) + try: + with opener.open(req, timeout=TIMEOUT_S) as resp: # nosec B310: fixed https URLs + resp.read(4096) + return resp.status + except urllib.error.HTTPError as exc: + return exc.code + except (urllib.error.URLError, OSError) as exc: + return f"no response ({type(getattr(exc, 'reason', exc)).__name__})" + + +def probe_once(fetcher, now): + sample = {"t": _iso(now), "probed": [k for k, *_ in TARGETS], "fail": {}} + for key, _service, url, ok in TARGETS: + got = fetcher(url) + if got not in ok: + sample["fail"][key] = f"HTTP {got}" if isinstance(got, int) else str(got) + return sample + + +def incidents(samples): + """Incidents (>= INCIDENT_MIN_SAMPLES consecutive failures) and transient counts per service.""" + out, transient = [], {} + services = {k: s for k, s, *_ in TARGETS} + for key in services: + run = [] + seq = [s for s in samples if key in s.get("probed", [])] + for i, s in enumerate(seq + [None]): + failed = s is not None and key in s.get("fail", {}) + if failed: + run.append(s) + continue + if len(run) >= INCIDENT_MIN_SAMPLES: + out.append({"service": key, "service_name": services[key], "start": run[0]["t"], + "end": s["t"] if s is not None else None, "failed_probes": len(run), + "failing_check": run[-1]["fail"][key]}) + elif run: + transient[key] = transient.get(key, 0) + len(run) + run = [] + return sorted(out, key=lambda x: (x["start"], x["service"])), transient + + +def availability(samples, now): + since = now - timedelta(days=WINDOW_DAYS) + out = {} + for key, service, url, _ok in TARGETS: + seq = [s for s in samples if key in s.get("probed", []) and _parse(s["t"]) >= since] + up = sum(1 for s in seq if key not in s.get("fail", {})) + out[key] = {"service": service, "url": url, "probes": len(seq), "up": up, + "availability_percent": round(100.0 * up / len(seq), 3) if seq else None} + return out + + +def build(previous, sample, now): + prev_samples = [s for s in (previous or {}).get("samples", []) if isinstance(s, dict) and "t" in s] + cutoff = now - timedelta(days=HISTORY_DAYS) + samples = [s for s in prev_samples if _parse(s["t"]) >= cutoff] + [sample] + began = (previous or {}).get("history_began") or sample["t"] + incs, transient = incidents(samples) + window_start = _iso(now - timedelta(days=WINDOW_DAYS)) + return { + "feed_type": "availability-status", + "fedRampId": _offering.fedramp_id(), + "rules": ["CDS-CSO-AVR", "CDS-TRC-USH"], + "generated_at": sample["t"], + "monitor": "GitHub Actions (.github/workflows/availability-probe.yml), outside AWS: it keeps " + "reporting when the offering is unavailable.", + "published_at": {"json": FEED_URL, "human": PAGE_URL}, + "history_began": began, + "history_note": "History begins at the monitor's first run; before that no independent " + "measurement exists. Scheduled runs are every 15 minutes, and GitHub may delay one.", + "incident_rule": f"{INCIDENT_MIN_SAMPLES} or more consecutive failed probes of one service; a single " + "failed probe is counted as transient.", + "current": {k: ("down" if k in sample["fail"] else "up") for k, *_ in TARGETS}, + "current_failures": sample["fail"], + "window_days": WINDOW_DAYS, + "availability": availability(samples, now), + "incidents": [i for i in incs if (i["end"] or "9999") >= window_start], + "transient_failures": transient, + "samples": samples, + } + + +def render_markdown(doc): + cur = doc["current"] + out = ["# Service availability (independent monitor)", "", + f"_{doc['monitor']}_", "", + f"- **Last probe:** {doc['generated_at']}", + f"- **History began:** {doc['history_began']}. {doc['history_note']}", + f"- **Incident rule:** {doc['incident_rule']}", + f"- **Machine-readable:** {doc['published_at']['json']}", "", + "## Now and over the past 30 days", "", + "| Service | Now | Availability (30 days) | Probes |", "|---|---|---|---|"] + for key, a in doc["availability"].items(): + pct = "n/a" if a["availability_percent"] is None else f"{a['availability_percent']}%" + out.append(f"| {a['service']} | {cur.get(key, 'n/a')} | {pct} | {a['probes']} |") + out += ["", "## Availability incidents (past 30 days)", ""] + if not doc["incidents"]: + out.append("None.") + else: + out += ["| Service | Start | End | Failed probes | Failing check |", "|---|---|---|---|---|"] + for i in reversed(doc["incidents"]): + out.append(f"| {i['service_name']} | {i['start']} | {i['end'] or 'ongoing'} | " + f"{i['failed_probes']} | {i['failing_check']} |") + if doc["transient_failures"]: + out += ["", "Transient (single) failed probes: " + + ", ".join(f"{k} {v}" for k, v in sorted(doc["transient_failures"].items()))] + out += ["", "---", "_Source of truth: `availability-status.json` on this branch._"] + return "\n".join(out) + + +def ongoing_incidents(doc): + return [i for i in doc.get("incidents", []) if i.get("end") is None] + + +def check_fresh(path, max_age_hours, now=None): + """Problems with a fetched feed: [] when it is ours, well formed and fresh.""" + now = now or datetime.now(timezone.utc) + try: + doc = json.loads(Path(path).read_text()) + except (OSError, json.JSONDecodeError): + return ["the independent availability feed is missing or not JSON"] + if doc.get("feed_type") != "availability-status": + return ["the independent availability feed is not an availability-status document"] + try: + age = now - _parse(doc["generated_at"]) + except (KeyError, ValueError): + return ["the independent availability feed has no generated_at"] + if age > timedelta(hours=max_age_hours): + return [f"the independent availability feed is {age} old (limit {max_age_hours} h): the monitor " + "on GitHub Actions is not running"] + if not doc.get("samples"): + return ["the independent availability feed carries no probes"] + return [] + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--previous", default=None) + ap.add_argument("--out-dir", default=".") + ap.add_argument("--check-fresh", default=None, metavar="FEED") + ap.add_argument("--max-age-hours", type=float, default=2.0) + ap.add_argument("--fail-on-incident", default=None, metavar="FEED", + help="exit 1 when FEED shows an ongoing incident (the workflow's alert)") + a = ap.parse_args(argv) + if a.fail_on_incident: + doc = json.loads(Path(a.fail_on_incident).read_text()) + ongoing = ongoing_incidents(doc) + for i in ongoing: + print(f"::error::availability incident: {i['service_name']} down since {i['start']} " + f"({i['failing_check']})", file=sys.stderr) + return 1 if ongoing else 0 + if a.check_fresh: + why = check_fresh(a.check_fresh, a.max_age_hours) + for w in why: + print(f"::error::availability: {w}", file=sys.stderr) + if not why: + print("ok: the independent availability feed is present and fresh") + return 1 if why else 0 + previous = {} + if a.previous and Path(a.previous).exists(): + try: + previous = json.loads(Path(a.previous).read_text()) + except json.JSONDecodeError: + previous = {} + if previous.get("feed_type") != "availability-status": + previous = {} + started = time.monotonic() + now = datetime.now(timezone.utc) + doc = build(previous, probe_once(fetch, now), now) + out = Path(a.out_dir) + out.mkdir(parents=True, exist_ok=True) + (out / "availability-status.json").write_text(json.dumps(doc, indent=1) + "\n") + (out / "availability-status.md").write_text(render_markdown(doc) + "\n") + down = sorted(doc["current_failures"]) + print(f"probed {len(TARGETS)} services in {time.monotonic() - started:.1f}s; down: {down or 'none'}; " + f"{len(doc['samples'])} samples kept") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-access-summary.py b/scripts/build-access-summary.py new file mode 100644 index 00000000..581b4b70 --- /dev/null +++ b/scripts/build-access-summary.py @@ -0,0 +1,203 @@ +#!/usr/bin/env python3 +"""Monthly access summaries for the certification data (CDS-TRC-ACL). + +Reads the CloudFront access records the deploy synced from the log bucket (JSON +lines, gzipped or plain, one object per request with the fields the delivery +keeps: see scripts/check-edge-access-logging.py ALLOWED_FIELDS) and writes +access-summary.json (+ .md): per month, how many requests reached each +certification artifact under /.well-known/ and the trust center under /trust/, +by response class and by country. Nothing else. + +Privacy (operator's condition, 2026-11-05): +- Only /.well-known/ and /trust/ requests are counted; every other record is + discarded unread beyond its path. CloudFront cannot limit logging by path, so + this is where the limit is applied. +- A path is published by name only when it served an object (2xx or 304). + Requests for anything else (probes for files that do not exist, errors) are + counted under "other", so a requester cannot write a string into this file. +- No IP, user agent, referrer, cookie or query string exists in the records; + the summary carries counts only. + +Retention: raw records expire after 90 days (infrastructure/logging.tf). Each +month's summary is carried forward from the previously published file, so +summaries are kept for MONTHS_KEPT months (FedRAMP asks for at least six). A +month is recomputed from the records only when they cover at least as much of it +as the published summary did, so a month whose early days have expired keeps its +fuller earlier count. +""" +import argparse +import gzip +import json +import re +import sys +from collections import Counter +from datetime import date, datetime, timezone +from pathlib import Path + +MONTHS_KEPT = 13 +MIN_MONTHS_KEPT = 6 +PREFIXES = ("/.well-known/", "/trust/") +SAFE_PATH = re.compile(r"^/[A-Za-z0-9._/-]{0,200}$") +SERVED = re.compile(r"^(2\d\d|304)$") +COUNTRY = re.compile(r"^[A-Z]{2}$") +OTHER = "other (not found, error, or not an object)" + + +def _fail(msg): + raise SystemExit(f"::error::access summary: {msg} (fail-closed)") + + +def read_records(root): + """Yield one dict per access record under root (*.gz or plain JSON lines).""" + for p in sorted(Path(root).rglob("*")) if Path(root).is_dir() else []: + if not p.is_file(): + continue + opener = gzip.open if p.suffix == ".gz" else open + try: + with opener(p, "rt", encoding="utf-8") as fh: + for line in fh: + line = line.strip() + if not line: + continue + try: + rec = json.loads(line) + except json.JSONDecodeError: + _fail(f"{p.name} holds a line that is not JSON") + if isinstance(rec, dict): + yield rec + except (OSError, EOFError) as exc: + _fail(f"{p.name} could not be read ({type(exc).__name__})") + + +def _artifact(stem, status): + if not SERVED.match(str(status)) or not SAFE_PATH.match(stem or ""): + return OTHER + if stem.startswith("/trust/"): + return "/trust/" if stem in ("/trust/", "/trust/index.html") else stem + return stem + + +def summarize(records): + """{month: {"requests", "artifacts", "countries", "status_classes", "first", "last"}}""" + months = {} + for r in records: + stem = r.get("cs-uri-stem") or "" + if not stem.startswith(PREFIXES): + continue + day = str(r.get("date") or "") + try: + d = date.fromisoformat(day) + except ValueError: + continue + m = months.setdefault(d.strftime("%Y-%m"), {"requests": 0, "artifacts": Counter(), "countries": Counter(), + "status_classes": Counter(), "first": day, "last": day}) + status = str(r.get("sc-status") or "") + m["requests"] += 1 + m["artifacts"][_artifact(stem, status)] += 1 + cc = str(r.get("c-country") or "") + m["countries"][cc if COUNTRY.match(cc) else "unknown"] += 1 + m["status_classes"][(status[:1] + "xx") if status[:1].isdigit() else "unknown"] += 1 + m["first"], m["last"] = min(m["first"], day), max(m["last"], day) + return months + + +def _month_entry(month, m, now): + return {"month": month, "coverage_from": m["first"], "coverage_to": m["last"], + "requests": m["requests"], + "artifacts": dict(sorted(m["artifacts"].items())), + "countries": dict(sorted(m["countries"].items())), + "status_classes": dict(sorted(m["status_classes"].items())), + "computed_at": now.isoformat()} + + +def merge(previous, computed, now): + """Carry earlier months forward; recompute a month only when the records cover + at least as much of it as the published entry did.""" + by_month = {e["month"]: e for e in (previous or {}).get("months", []) if isinstance(e, dict) and "month" in e} + for month, m in computed.items(): + old = by_month.get(month) + if old is None or m["first"] <= old.get("coverage_from", "9999"): + by_month[month] = _month_entry(month, m, now) + kept = sorted(by_month.values(), key=lambda e: e["month"])[-MONTHS_KEPT:] + return kept + + +def build(previous, records, now): + months = merge(previous, summarize(records), now) + started = (previous or {}).get("logging_records_since") + firsts = [e["coverage_from"] for e in months] + if firsts: + started = min([started] + firsts) if started else min(firsts) + return { + "artifact": "access-summary", + "rule": "CDS-TRC-ACL", + "emitted_at": now.isoformat(), + "scope": "Requests to the certification data under /.well-known/ and to the trust center under /trust/.", + "logged_fields": "date, time, edge location, country, method, path, status, bytes, cache result. " + "No IP address, user agent, referrer, cookie or query string is logged.", + "raw_record_retention_days": 90, + "summary_retention_months": MONTHS_KEPT, + "logging_records_since": started, + "party_records": "A party can ask for the summaries and for the records of its own requests, " + "identified by the times and paths it gives (no requester identity is logged); " + "see the trust center's privacy notice and DEC-160.", + "months": months, + } + + +def render_markdown(doc): + out = ["# Trust center access summary", "", + f"_{doc['scope']}_", "", + f"- **Emitted:** {doc['emitted_at']}", + f"- **Logged fields:** {doc['logged_fields']}", + f"- **Raw records kept:** {doc['raw_record_retention_days']} days; " + f"**summaries kept:** {doc['summary_retention_months']} months", + f"- **Records since:** {doc['logging_records_since'] or 'none yet'}", + f"- **Your own records:** {doc['party_records']}", ""] + if not doc["months"]: + out += ["No access records yet.", ""] + for m in reversed(doc["months"]): + out += [f"## {m['month']}", "", + f"{m['requests']} requests, {m['coverage_from']} to {m['coverage_to']}. " + f"By status: {', '.join(f'{k} {v}' for k, v in m['status_classes'].items())}. " + f"By country: {', '.join(f'{k} {v}' for k, v in m['countries'].items())}.", "", + "| Artifact | Requests |", "|---|---|"] + for path, n in sorted(m["artifacts"].items(), key=lambda kv: (-kv[1], kv[0])): + out.append(f"| `{path}` | {n} |") + out.append("") + out += ["---", "_Source of truth: the signed `access-summary.json` (CDS-TRC-ACL)._"] + return "\n".join(out) + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--records", required=True, help="directory of synced CloudFront access records") + ap.add_argument("--previous", default=None, help="the previously published access-summary.json") + ap.add_argument("--output", default="access-summary.json") + ap.add_argument("--md-output", default="access-summary.md") + a = ap.parse_args(argv) + previous = {} + if a.previous and Path(a.previous).exists(): + try: + previous = json.loads(Path(a.previous).read_text()) + except json.JSONDecodeError: + previous = {} + if previous and previous.get("artifact") != "access-summary": + previous = {} + now = datetime.now(timezone.utc) + doc = build(previous, read_records(a.records), now) + prev_months = {e["month"] for e in previous.get("months", [])} if previous else set() + # Never drop a month younger than the six FedRAMP requires. + newest = sorted(prev_months | {e["month"] for e in doc["months"]})[-MIN_MONTHS_KEPT:] + lost = sorted(set(newest) - {e["month"] for e in doc["months"]}) + if lost: + _fail(f"would drop month(s) {lost} younger than {MIN_MONTHS_KEPT} months") + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") + if a.md_output: + Path(a.md_output).write_text(render_markdown(doc) + "\n") + print(f"access-summary: {len(doc['months'])} month(s); records since {doc['logging_records_since']}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-assessor-guide.py b/scripts/build-assessor-guide.py new file mode 100644 index 00000000..47b8e056 --- /dev/null +++ b/scripts/build-assessor-guide.py @@ -0,0 +1,169 @@ +#!/usr/bin/env python3 +"""The assessor guide: how to verify and validate each FedRAMP rule and KSI +here, by hand or by machine (IVV-CSO-STE, IVV-CSO-DUS). + +Generated from the rule records (data/frr-records.json) and the KSI catalog, so +it cannot describe a mechanism the records do not cite. For every rule it gives +the provider's explanation and, for every piece of evidence, the command that +reproduces the check and a machine-readable form of the same check. The +simulated assessor (tools/simulated-assessor/assess.py) executes exactly those +machine-readable checks on every deploy: the guide is the demonstration. + +It also states the sampling position (IVV-CSO-DUS): no check here uses a +representative sample. + + python3 scripts/build-assessor-guide.py --output assessor-guide.json --md-output assessor-guide.md +""" + +import argparse +import json +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _freshness # noqa: E402 +import _frr # noqa: E402 +import _offering # noqa: E402 +import _rules # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +SITE = "https://samaydlette.com" +REPO_URL = "https://github.com/sam-aydlette/samaydlette.com" +ISSUER = "https://token.actions.githubusercontent.com" +WF = f"{REPO_URL}/.github/workflows" +IDENTITIES = { + "deploy": f"{WF}/deploy-with-opa.yml@refs/heads/main", + "nightly": f"{WF}/evidence-nightly.yml@refs/heads/main", + # The simulated assessor signs its own record under its own workflow identity. + "assessor": f"{WF}/simulated-assessor.yml@refs/heads/main", +} +SCHEMA = "assessor-guide/1" +SAMPLING = ("No representative samples are used in verification or validation (IVV-CSO-DUS). Every check runs " + "over its full population: the OPA gate and the KSI signal evaluate every inventoried component; the " + "reconciliation gate compares every live in-boundary resource with the inventory; the vulnerability " + "scan covers every SBOM; every FedRAMP rule record is validated and every test it cites runs on every " + "build; and the simulated assessor re-checks every rule and every KSI rather than a selection.") +HOW_TO_USE = ("Read each rule's explanation, then run the command beside each piece of evidence. Tests run from a " + "clone of the repository after `make dev-setup`; published artifacts are fetched from the site and " + "their signatures verified with cosign against the publishing workflow's identity; workflow steps " + "are read in the workflow file and their run logs in the repository's Actions tab; decision records " + "are in data/decisions.json. The `check` beside each command is the same check in machine-readable " + "form. For a walkthrough of any mechanism, ask through the security contact in the Certification " + "Package Overview.") + + +def _artifact_check(ref, fresh): + entry = fresh.get(ref) + if entry is None: + raise SystemExit(f"::error::assessor guide: {ref} is not in the freshness config, so an assessor could " + "not tell how fresh it must be (fail-closed)") + name = ref.split("/", 1)[1] + sig = entry.get("signature") + return {"url": f"{SITE}/{ref}", "bundle_url": f"{SITE}/{sig}" if sig else None, + "identities": (["assessor"] if name.startswith("simulated-assessment") + else ["deploy", "nightly"] if name.startswith("vdr-") else ["deploy"]), + "timestamp": entry["timestamp"], "max_age_hours": entry["max_age_hours"]} + + +def reproduce(ev, fresh): + kind, ref = ev["kind"], ev["ref"] + if kind == "test": + return f"python3 -m pytest '{ref}'", {"pytest": ref} + if kind == "step": + wf, step = ref.split("#", 1) + return (f"Read the step named {step!r} in .github/workflows/{wf}, and its log in the latest run of that " + "workflow on main", {"workflow": wf, "step": step}) + if kind == "artifact": + chk = _artifact_check(ref, fresh) + cmd = f"curl -fsSLO {chk['url']}" + if chk["bundle_url"]: + cmd += (f" && curl -fsSLO {chk['bundle_url']} && cosign verify-blob --bundle {chk['bundle_url'].rsplit('/', 1)[1]} " + f"--certificate-identity {IDENTITIES[chk['identities'][0]]} --certificate-oidc-issuer {ISSUER} " + f"{ref.rsplit('/', 1)[1]}") + return cmd, {"artifact": chk} + if kind == "decision": + return f"jq '.decisions[] | select(.id == \"{ref}\")' data/decisions.json", {"decision": ref} + raise SystemExit(f"::error::assessor guide: unknown evidence kind {kind!r}") + + +def build(records, applicable, catalog, fresh, now, commit=None): + rules = [] + for r in records["records"]: + rid = r["frr_id"] + evidence = [] + for ev in r.get("evidence", []): + cmd, chk = reproduce(ev, fresh) + evidence.append({"kind": ev["kind"], "ref": ev["ref"], "how_to_reproduce": cmd, "check": chk}) + entry = {"rule_id": rid, "name": applicable[rid]["name"], "force": applicable[rid]["force"], + "statement": applicable[rid]["statement"], "status": r["status"], + "explanation": r["implementation"], "evidence": evidence} + for k in ("not_applicable", "may_rationale", "simulated"): + if k in r: + entry[k] = r[k] + rules.append(entry) + ksis = [{"ksi_id": i["id"], "name": i.get("name", ""), + "how_to_reproduce": (f"curl -fsSL {SITE}/.well-known/ksi-signal.json | jq '.ksis[] | " + f"select(.id == \"{i['id']}\")' after verifying ksi-signal.bundle against the " + "deploy identity; the SDR's keySecurityIndicators entry gives its measures"), + "check": {"ksi_in_signal": i["id"]}} + for f in catalog["KSI"].values() for i in f["indicators"]] + return {"schema": SCHEMA, "fedRampId": _offering.fedramp_id(), "generated_at": now.isoformat(), "commit": commit, "site": SITE, + "repository": REPO_URL, "how_to_use": HOW_TO_USE, "sampling": SAMPLING, + "identities": {**IDENTITIES, "oidc_issuer": ISSUER}, + "summary": {"rules": len(rules), "ksis": len(ksis), + "evidence_items": sum(len(r["evidence"]) for r in rules)}, + "rules": rules, "ksis": sorted(ksis, key=lambda k: k["ksi_id"])} + + +def render_markdown(g): + out = ["# Assessor guide", "", + "_How to verify and validate each FedRAMP rule and Key Security Indicator for this offering. Generated " + "from the rule records on every deploy; the simulated assessor runs these exact checks._", "", + f"- **Generated:** {g['generated_at']} | **Commit:** `{g['commit'] or 'local build'}`", + f"- **Rules:** {g['summary']['rules']} | **KSIs:** {g['summary']['ksis']} | " + f"**Evidence items:** {g['summary']['evidence_items']}", "", + "## How to use this guide", "", g["how_to_use"], "", + "## Sampling (IVV-CSO-DUS)", "", g["sampling"], "", + "## Signing identities", ""] + out += [f"- {k}: `{v}`" for k, v in g["identities"].items()] + out += ["", "## FedRAMP rules", ""] + for r in g["rules"]: + out += [f"### {r['rule_id']}: {r['name']} ({r['force']}, {r['status']})", "", r["explanation"], ""] + for k, label in (("not_applicable", "Not applicable"), ("may_rationale", "Use of this permission")): + if k in r: + out += [f"{label}: {r[k]}", ""] + if "simulated" in r: + out += [f"Simulated counterparty ({r['simulated']['counterparty']}): {r['simulated']['how']}", ""] + for ev in r["evidence"]: + out.append(f"- {ev['kind']} `{ev['ref']}`: `{ev['how_to_reproduce']}`") + if r["evidence"]: + out.append("") + out += ["## Key Security Indicators", ""] + out += [f"- `{k['ksi_id']}` {k['name']}: `{k['how_to_reproduce']}`" for k in g["ksis"]] + out += ["", "---", "_Source of truth: the signed `assessor-guide.json`._"] + return "\n".join(out) + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--records", default=str(_frr.DEFAULT_PATH)) + ap.add_argument("--catalog", default=str(REPO / "infrastructure" / "schemas" / "ksi-catalog.json")) + ap.add_argument("--freshness", default=str(REPO / "infrastructure" / "schemas" / "freshness-config.json")) + ap.add_argument("--commit", default=None) + ap.add_argument("--output", default="assessor-guide.json") + ap.add_argument("--md-output", default="assessor-guide.md") + a = ap.parse_args(argv) + records = _frr.load(a.records) + fresh = {x["path"]: x for x in _freshness.load_freshness_config(a.freshness)["artifacts"]} + guide = build(records, _rules.applicable_provider_rules(), json.loads(Path(a.catalog).read_text()), fresh, + datetime.now(timezone.utc), a.commit) + Path(a.output).write_text(json.dumps(guide, indent=2) + "\n") + if a.md_output: + Path(a.md_output).write_text(render_markdown(guide) + "\n") + print(f"assessor-guide: {guide['summary']}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-availability.py b/scripts/build-availability.py index d020e9c8..e7f090a0 100644 --- a/scripts/build-availability.py +++ b/scripts/build-availability.py @@ -1,89 +1,147 @@ #!/usr/bin/env python3 # ============================================================================= -# AVAILABILITY FEED BUILDER (CR26 CDS-CSO-AVR) +# AVAILABILITY FEED BUILDER (CR26 CDS-CSO-AVR, CDS-TRC-USH) # ============================================================================= -# CR26 CDS-CSO-AVR (Class C MUST) requires a web service indicating current and -# historical availability of core services over at least the past 30 days, in -# both human-readable and machine-readable formats, available even if the primary -# offering is unavailable. This builds the machine + human feed as an append-only -# history: each deploy appends a datapoint to the previous published feed and -# trims to a rolling window. A deploy that produces this feed is, by definition, -# a successful one, so the current datapoint is "available". +# CDS-CSO-AVR (Class C MUST): a web service showing current and historical +# availability of core services over at least the past 30 days, including +# availability incidents, human- and machine-readable, and available even when +# the offering is not. # -# HONEST RESIDUAL: this feed is served from the same CloudFront/S3 path as the -# offering, so the "available even if the primary offering is unavailable" clause -# is only partially met — full conformance needs an independent monitor on -# separate infrastructure. That gap is stated in the feed itself, not hidden. +# The measurement is made outside AWS: scripts/availability-probe.py runs on +# GitHub Actions every 15 minutes and publishes its feed on GitHub (the +# repository's availability-status branch), which stays reachable when the +# offering's CloudFront or S3 is down. That is the service the rule asks for. # -# build-availability.py --previous previous-availability.json +# This builder republishes the same measurements on the site, signed with the +# rest of the certification data, so the package carries them: the deploy reads +# the independent feed (and fails when it is missing or stale), and this writes +# availability.json + availability.md from it: current status, 30-day +# availability and incidents per service, and a daily roll-up. It never records +# a deploy as availability. +# +# build-availability.py --probe-feed availability-probe.json --ksi-signal ksi-signal.json # ============================================================================= import argparse +import importlib.util import json import sys -from datetime import datetime, timezone +from collections import defaultdict +from datetime import datetime, timedelta, timezone from pathlib import Path -WINDOW_DAYS = 45 # keep >= 30 days of history per CDS-CSO-AVR +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _offering # noqa: E402 + +_spec = importlib.util.spec_from_file_location( + "availability_probe", Path(__file__).resolve().parent / "availability-probe.py") +assert _spec is not None and _spec.loader is not None +probe = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(probe) + +MAX_FEED_AGE_HOURS = 2.0 + + +def _fail(msg): + raise SystemExit(f"::error::availability: {msg} (fail-closed)") + +def daily(samples, now, days=probe.WINDOW_DAYS): + """[{date, services: {key: {probes, up}}}] for the past `days` days.""" + since = (now - timedelta(days=days)).date() + by_day = defaultdict(lambda: defaultdict(lambda: {"probes": 0, "up": 0})) + for s in samples: + d = probe._parse(s["t"]).date() + if d < since: + continue + for key in s.get("probed", []): + cell = by_day[d.isoformat()][key] + cell["probes"] += 1 + cell["up"] += 0 if key in s.get("fail", {}) else 1 + return [{"date": d, "services": {k: dict(v) for k, v in sorted(svcs.items())}} + for d, svcs in sorted(by_day.items())] -def main(): + +def build(feed, signal_id, now): + return { + "feed_type": "availability", + "fedRampId": _offering.fedramp_id(), + "rules": ["CDS-CSO-AVR", "CDS-TRC-USH"], + "emitted_at": now.isoformat(), + "ksi_signal_id": signal_id, + "measured_by": feed["monitor"], + "independent_service": feed["published_at"], + "independent_note": "This file is a signed copy carried in the certification package. The service " + "that stays available when the offering is down is the independent one above, " + "served by GitHub.", + "measured_at": feed["generated_at"], + "history_began": feed["history_began"], + "history_note": feed["history_note"], + "incident_rule": feed["incident_rule"], + "current": feed["current"], + "current_failures": feed["current_failures"], + "window_days": feed["window_days"], + "availability": feed["availability"], + "incidents": feed["incidents"], + "transient_failures": feed["transient_failures"], + "daily": daily(feed["samples"], now), + } + + +def render_markdown(doc): + out = ["# Service availability", "", + f"_Measured independently: {doc['measured_by']}_", "", + f"- **Last probe:** {doc['measured_at']} | **Emitted:** {doc['emitted_at']}", + f"- **Independent status page (available when this site is not):** {doc['independent_service']['human']}", + f"- **History began:** {doc['history_began']}. {doc['history_note']}", + f"- **Incident rule:** {doc['incident_rule']}", "", + "| Service | Now | Availability (30 days) | Probes |", "|---|---|---|---|"] + for key, a in doc["availability"].items(): + pct = "n/a" if a["availability_percent"] is None else f"{a['availability_percent']}%" + out.append(f"| {a['service']} | {doc['current'].get(key, 'n/a')} | {pct} | {a['probes']} |") + out += ["", "## Availability incidents (past 30 days)", ""] + if not doc["incidents"]: + out.append("None.") + else: + out += ["| Service | Start | End | Failed probes | Failing check |", "|---|---|---|---|---|"] + for i in reversed(doc["incidents"]): + out.append(f"| {i['service_name']} | {i['start']} | {i['end'] or 'ongoing'} | " + f"{i['failed_probes']} | {i['failing_check']} |") + out += ["", "## Daily (passing probes / probes)", "", "| Date | " + " | ".join(doc["availability"]) + " |", + "|---|" + "---|" * len(doc["availability"])] + for day in reversed(doc["daily"]): + cells = [] + for key in doc["availability"]: + c = day["services"].get(key) + cells.append(f"{c['up']}/{c['probes']}" if c else "—") + out.append(f"| {day['date']} | " + " | ".join(cells) + " |") + out += ["", "---", "_Source of truth: the signed `availability.json` (CDS-CSO-AVR)._"] + return "\n".join(out) + + +def main(argv=None): ap = argparse.ArgumentParser() - ap.add_argument("--previous", default=None, help="Previous published availability.json (for history)") + ap.add_argument("--probe-feed", required=True, + help="the independent monitor's availability-status.json, fetched from GitHub") ap.add_argument("--ksi-signal", default="ksi-signal.json") ap.add_argument("--output", default="availability.json") ap.add_argument("--md-output", default="availability.md") - a = ap.parse_args() + a = ap.parse_args(argv) now = datetime.now(timezone.utc) - today = now.date().isoformat() - - history = [] - if a.previous and Path(a.previous).exists(): - try: - history = json.loads(Path(a.previous).read_text()).get("history", []) or [] - except Exception: - history = [] - # Append today (idempotent: one datapoint per day). - history = [h for h in history if h.get("date") != today] - history.append({"date": today, "status": "available", - "detail": "deploy succeeded; core services served via CloudFront"}) - # Trim to the rolling window (keep the most recent WINDOW_DAYS dated points). - history = sorted(history, key=lambda h: h.get("date", ""))[-WINDOW_DAYS:] - + why = probe.check_fresh(a.probe_feed, MAX_FEED_AGE_HOURS, now) + if why: + _fail("; ".join(why)) + feed = json.loads(Path(a.probe_feed).read_text()) signal_id = None if Path(a.ksi_signal).exists(): signal_id = json.loads(Path(a.ksi_signal).read_text()).get("signal_id") - - up = sum(1 for h in history if h.get("status") == "available") - feed = { - "feed_type": "availability", - "rule": "CDS-CSO-AVR", - "emitted_at": now.isoformat(), - "ksi_signal_id": signal_id, - "current_status": "available", - "window_days": WINDOW_DAYS, - "history_points": len(history), - "uptime_observed": f"{up}/{len(history)} observed days available", - "residual": ("This feed is served from the same CloudFront/S3 path as the offering; " - "the CDS-CSO-AVR clause requiring availability reporting even when the " - "primary offering is unavailable is only partially met. Full conformance " - "requires an independent monitor on separate infrastructure."), - "history": history, - } - Path(a.output).write_text(json.dumps(feed, indent=2) + "\n") + doc = build(feed, signal_id, now) + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") if a.md_output: - out = ["# Service Availability", "", - f"- **Current status:** {feed['current_status']}", - f"- **Observed window:** {feed['uptime_observed']} (rolling {WINDOW_DAYS} days)", - f"- **Emitted:** {feed['emitted_at']}", "", - f"> {feed['residual']}", "", - "| Date | Status |", "|---|---|"] - for h in reversed(history): - out.append(f"| {h['date']} | {h['status']} |") - out += ["", "---", "_Source of truth: the machine-readable `availability.json` (CDS-CSO-AVR)._"] - Path(a.md_output).write_text("\n".join(out) + "\n") - print(f"availability: {len(history)} day(s) of history; current=available") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + down = sorted(k for k, v in doc["current"].items() if v != "up") + print(f"availability: {len(doc['incidents'])} incident(s) in {doc['window_days']} days; down now: {down or 'none'}") return 0 diff --git a/scripts/build-cds-overview.py b/scripts/build-cds-overview.py deleted file mode 100644 index 2adbc99e..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('email')})") - 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 732986d3..3bcac4b2 100644 --- a/scripts/build-cpo.py +++ b/scripts/build-cpo.py @@ -1,22 +1,37 @@ #!/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 offering, in both JSON and human-readable +# form, with what CPO-CSO-MTD, CDS-CSO-PUB and CDS-CSO-SVC require. It folds in +# what scripts/build-cds-overview.py used to publish separately (the CDS +# certification-overview package), so the public information has one source. # -# This is an overview/manifest: it points at the constituent artifacts the -# pipeline already publishes and summarizes scope, crypto, and assessment status. +# serviceIdentification provider, service, FedRAMP ID (FedRAMP's fallback: +# the provider name and acronym, marked as not real), +# a simulated UEI, website, logo (CDS-CSO-PUB, FID) +# serviceProperties service and deployment model, business category, +# the package's repositories, and the next report date +# from the fixed CCM calendar (CCM-OCR-NRD) +# contactInformation security, sales and accountable official; never an +# email address (they point to security.txt) +# certifiedServices each service, with its own security category +# under providerExtensions.services (CDS-CSO-SVC) +# metadata version (semver on a content hash), lastUpdated, +# updateSource, accountable official (CPO-CSO-MTD) +# +# serviceProperties.trustCenter / .secureConfigurationGuidance, the +# thirdPartyInformationResources and the assessor's overall summary under +# providerExtensions.independentAssessment: one small function each (group 5: +# CDS-CSO-PUB/UTC, SCG-CSO-AUP, MAS-CSO-TPR, CPO-CSO-OSA). +# +# Simulated values are flagged under providerExtensions.simulated, naming the +# outside party they stand in for. Each top-level section is one small function, +# so a field can be added without touching the others. Validated against the +# vendored schema before it is written; nothing that fails is written. # # 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 --previous-cpo previous-cpo.json # ============================================================================= import argparse @@ -25,121 +40,352 @@ 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 _assessor # noqa: E402 +import _ccm # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 +import _tpr # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +BOUNDARY = REPO / "docs" / "boundary" / "boundary-classification.json" BASE = "https://samaydlette.com/.well-known/" +LEVELS = ("low", "moderate", "high") + +# The certification package (FRC-CSO-PKG) as the deploy publishes it. +# (file, repository types, description) +PACKAGE = [ + ("security-decision-record.json", ["Security Decision Record"], + "Every applicable FedRAMP rule, KSI and Rev5 Moderate control, with implementation, validation and " + "assessment (SDR-CSO-FRR; replaces the SSP)."), + ("ongoing-certification-report.json", ["Ongoing Certification Report"], + "The Ongoing Certification Report as it stands since the latest issue (CCM-OCR-AVL)."), + ("ocr-issues.json", ["Ongoing Certification Report", "Historical Certification Data"], + "Every issued Ongoing Certification Report, frozen and signed, with the snapshot of the certification " + "data taken at each issue (CDS-CSO-HAD)."), + ("quarterly-review.ics", ["Quarterly Review"], "Calendar file for the Quarterly Reviews (CCM-QTR-REG)."), + ("vdr-detail-report.json", ["Vulnerability Detail Report"], "Vulnerability detail (VER-RPT-VDT)."), + ("vdr-accepted-vulnerabilities.json", ["Accepted Vulnerability Info"], "Accepted vulnerabilities (VER-RPT-AVI)."), + ("vdr-history.json", ["Historical Vulnerability Activity"], "Vulnerability history (VER-TFR-MRH)."), + ("ksi-signal.json", ["Key Security Indicators"], "The canonical inventory and per-KSI results (MAS-CSO-IIR)."), + ("boundary-map.json", ["Minimum Assessment Scope"], "The generated authorization boundary map and data flows."), + ("policy-index.json", ["Policies and Procedures"], "Policy and procedure index (CDS-CSO-IRP)."), + ("availability.json", ["Availability"], "Availability feed."), + ("fedramp-certification-reports.json", ["FedRAMP Certification Reports"], + "FedRAMP Certification Reports received, published unmodified (CDS-CSO-FRC). Simulated: see the file."), + ("package-submission-log.json", ["Package Submission"], + "Log of each submission of this package to FedRAMP (FRC-CSO-PKG). Simulated: nothing is sent."), +] + + +def _fail(msg): + raise SystemExit(f"::error::CPO: {msg} (fail-closed)") + + +# --- sections ------------------------------------------------------------------------ + +def service_identification(off): + return {"providerName": off["provider_name"], "serviceName": off["service_name"], + "serviceAcronym": off["service_acronym"], "serviceDescription": off["service_description"], + "certificationType": "20x", # FRC-CSO-POP: one program, 20x + "fedRampPackageId": off["fedramp_id"], "ueiNumber": off["uei"], + "website": off["product_website"], "logo": off["logo_url"]} + + +def repositories(): + return [{"repositoryType": types, "url": BASE + f, "repositoryDescription": desc, + "authenticationRequired": False} for f, types, desc in PACKAGE] + + +# --- group 5's fields: one small function each --------------------------------------- + +TRUST_CENTER = "https://samaydlette.com/trust/index.html" + + +def trust_center(): + """serviceProperties.trustCenter (CDS-CSO-PUB, CDS-CSO-UTC): the landing + page, with how to access what it holds.""" + return {"repositoryType": ["Trust Center", "Assessment Reports", "Policies and Procedures"], + "url": TRUST_CENTER, + "repositoryDescription": "The FedRAMP-compatible trust center: every piece of certification data, " + "indexed by the signed trust manifest (" + BASE + "trust-manifest.json).", + "authenticationRequired": False, + "accessRequestInstructions": "No access request is needed: everything is public. Fetch any artifact " + "with an HTTPS GET; the trust manifest lists each one with its signature " + "and signer. An agency that wants to be on record files the agency access " + "form linked from the trust center (Request access)."} + + +def secure_configuration_guidance(): + """serviceProperties.secureConfigurationGuidance (SCG-CSO-RSC/AUP).""" + return {"repositoryType": ["Secure Configuration Guidance"], + "url": BASE + "secure-configuration-guide.md", + "repositoryDescription": "The Secure Configuration Guide: how to obtain, use and change the " + "security-relevant settings, with recommended defaults. Machine-readable and " + "signed: " + BASE + "secure-configuration-guide.json.", + "authenticationRequired": False} + + +def third_party_information_resources(): + """thirdPartyInformationResources (MAS-CSO-TPR), from the decided records.""" + return _tpr.cpo_third_party_information_resources() + + +def independent_assessment(off, assessment): + """providerExtensions.independentAssessment (CPO-CSO-OSA, CDS-CSO-PUB): the + current service, and the assessor's overall summary (IVV-IAS-OSA) carried + verbatim from its signed set. The schema's `assessor` object needs a + FedRAMP assessor ID; the simulated assessor has none, so it is left out + rather than given an ID-shaped value.""" + summary = _assessor.overall_summary(assessment) + if summary is None: + _fail("the assessment carries no overall summary (CPO-CSO-OSA)") + return {"currentService": off.get("current_independent_assessment_service"), + "overallSummary": summary, + "assessmentSet": BASE + "simulated-assessment.json", + "simulated": True} + + +ASSESSMENT_REPOSITORIES = [ + ("simulated-assessment.json", ["Assessment Reports"], + "The simulated assessor's signed results for every rule and KSI, with its overall summary (IVV-CSO-ICP). " + "Simulated: not a FedRAMP independent assessment."), + ("assessor-guide.json", ["Assessment Reports"], "How to verify and validate each rule and KSI (IVV-CSO-STE)."), + ("minimum-assessment-scope.json", ["Minimum Assessment Scope"], + "Information resources, flows and third parties in scope (MAS-CSO-IIR/FLO/TPR)."), + ("trust-manifest.json", ["Trust Center"], "Signed index of all certification data (CDS-TRC-PAC)."), +] + + +def service_properties(off, dates): + return {"serviceType": off["service_model"], "deploymentModel": off["deployment_model"], + "businessCategory": off["business_category"], + "trustCenter": trust_center(), + "secureConfigurationGuidance": secure_configuration_guidance(), + "additionalRepositories": repositories() + [ + {"repositoryType": t, "url": BASE + f, "repositoryDescription": d, "authenticationRequired": False} + for f, t, d in ASSESSMENT_REPOSITORIES], + "nextOngoingCertificationReportDate": dates["nextOngoingCertificationReportDate"]} -def main(): +def contacts(off): + """Security and Sales (the schema requires both), the accountable official, + and the FedRAMP Security Inbox when the offering declares one. A contact + that is not an email address is never put in the email field.""" + ao = off["accountable_official"] + out = [{"contactType": "Security", "contactName": off["security_contact"]["name"]}, + {"contactType": "Sales", "contactName": off["sales_contact"]["name"]}, + {"contactType": "Accountable Official", + "contactName": f"{ao['name']}, {ao['title']} (contact: {ao['contact']})"}] + fsi = off.get("fedramp_security_inbox") + if isinstance(fsi, dict): + entry = {"contactType": "FedRAMP Security Inbox"} + addr = fsi.get("address") + if isinstance(addr, str) and fs._EMAIL_RE.match(addr) and "/" not in addr: + entry["contactName"] = "FedRAMP Security Inbox" + entry["contactEmail"] = addr + else: + entry["contactName"] = fsi.get("contact") or "FedRAMP Security Inbox" + out.append(entry) + return out + + +def certified_services(off): + return [{"serviceName": s["name"], "serviceDescription": s["description"], + **({"dateAvailable": s["date_available"]} if s.get("date_available") else {})} + for s in off["services"]] + + +def services_detail(off, prof, groups): + """CDS-CSO-SVC: each service's own FIPS 199 category (never above the + system's), the boundary groups it is made of, and what is not included.""" + sysfips = prof.get("fips_199") or {} + out = [] + for s in off["services"]: + cat = s.get("security_category") + if not isinstance(cat, dict): + _fail(f"service {s.get('name')!r} has no per-service security category") + for obj in ("confidentiality", "integrity", "availability"): + v = cat.get(obj) + if v not in LEVELS: + _fail(f"service {s['name']!r}: {obj} {v!r} is not one of {LEVELS}") + if sysfips.get(obj) in LEVELS and LEVELS.index(v) > LEVELS.index(sysfips[obj]): + _fail(f"service {s['name']!r}: {obj} {v} exceeds the system's {sysfips[obj]}") + unknown = sorted(set(s.get("boundary_groups") or []) - groups) + if not s.get("boundary_groups") or unknown: + _fail(f"service {s['name']!r}: boundary groups {unknown or 'none'} are not in the boundary classification") + hw = max((cat[o] for o in ("confidentiality", "integrity", "availability")), key=LEVELS.index) + out.append({"serviceName": s["name"], "securityCategory": { + "confidentiality": cat["confidentiality"], "integrity": cat["integrity"], + "availability": cat["availability"], "highWaterMark": hw, "rationale": cat.get("rationale", "")}, + "boundaryGroups": s["boundary_groups"], "inMinimumAssessmentScope": bool(s.get("in_mas_scope"))}) + return out + + +def simulated(off): + """The values that stand in for an outside party, and which party.""" + return [{"field": "serviceIdentification.fedRampPackageId", "counterparty": "fedramp", + "how": off["fedramp_id_simulated"]}, + {"field": "serviceIdentification.ueiNumber", "counterparty": "sam-gov", "how": off["uei_simulated"]}, + {"field": "providerExtensions.independentAssessment.overallSummary", "counterparty": "assessor", + "how": "Written and signed on every deploy by Totally Real Assessment Services, LLC (simulated), a " + "workflow in this repository; not a FedRAMP Recognized assessment service."}] + + +def provider_extensions(off, prof, signal, dates, groups, assessment): + components = signal.get("components", []) if signal else [] + return { + "fedRampId": off["fedramp_id"], + "certification": "FedRAMP 20x, Program path, Class C", + "class": prof.get("fedramp_class"), + "impact_level": prof.get("impact_level"), + "fips_199": prof.get("fips_199"), + "ksi_signal_id": signal.get("signal_id"), + "simulated": simulated(off), + "services": services_detail(off, prof, groups), + "notIncluded": off.get("not_included", []), + "continuousMonitoring": dates, + "minimumAssessmentScope": { + "componentCount": len(components), + "boundaryMap": BASE + "boundary-map.json", + "authorizationBoundary": "https://samaydlette.com/research/authorization-boundary.html"}, + "cryptographicModules": off.get("cryptographic_modules", []), + "independentAssessment": independent_assessment(off, assessment), + "documentationOverview": off.get("documentation_overview_url"), + } + + +def build(off, prof, signal, cal, prev, now, groups, assessment): + dates = _ccm.dates_summary(cal, now.date()) + ao = off["accountable_official"] + doc = { + "$schema": fs.stamp("cpo"), + "serviceIdentification": service_identification(off), + "serviceProperties": service_properties(off, dates), + "contactInformation": contacts(off), + "certifiedServices": certified_services(off), + "thirdPartyInformationResources": third_party_information_resources(), + "metadata": {"accountableOfficial": {"name": ao["name"], "title": ao["title"], "contact": ao["contact"]}}, + "providerExtensions": provider_extensions(off, prof, signal, dates, groups, assessment), + } + return _offering.stamp_version(doc, prev, now, "Automated: scripts/build-cpo.py, from data/cds/offering.json, " + "the system profile, the CCM calendar and the KSI signal") + + +def boundary_groups(path=BOUNDARY): + return {g["key"] for g in json.loads(Path(path).read_text()).get("groups", [])} + + +def main(argv=None): ap = argparse.ArgumentParser() - ap.add_argument("--offering", default="../data/cds/offering.json") + ap.add_argument("--offering", default=str(_offering.OFFERING_PATH)) 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("--calendar", default=str(_ccm.CALENDAR_PATH)) + ap.add_argument("--previous-cpo", default=None) ap.add_argument("--output", default="certification-package-overview.json") ap.add_argument("--md-output", default="certification-package-overview.md") - a = ap.parse_args() + # The simulated assessor's keyless-signed set, verified against the pinned + # assessor identity before its summary is quoted (CPO-CSO-OSA). Required. + ap.add_argument("--assessment", required=True) + ap.add_argument("--assessment-bundle", default=None) + ap.add_argument("--assessor-identity", default=str(_assessor.IDENTITY_PATH)) + a = ap.parse_args(argv) now = datetime.now(timezone.utc) - off = json.loads(Path(a.offering).read_text()) + off = _offering.load(a.offering) 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": "N/A — no FedRAMP Recognized independent assessment service engaged " - "(self-attested PoC). Provider-side verification and validation are in " - "the Security Decision Record; the independent half is unmet by design.", - "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") + signal = json.loads(Path(a.ksi_signal).read_text()) + prev = {} + if a.previous_cpo and Path(a.previous_cpo).exists(): + try: + prev = json.loads(Path(a.previous_cpo).read_text()) + except json.JSONDecodeError: + prev = {} + assessment = _assessor.load_assessment(a.assessment, a.assessment_bundle or a.assessment[:-5] + ".bundle", + a.assessor_identity) + doc = build(off, prof, signal, _ccm.load(a.calendar, now.date()), prev, now, boundary_groups(), assessment) + fs.write_validated(doc, "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; " - f"{cpo['minimum_assessment_scope']['component_count']} components in scope") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + print(f"certification-package-overview {doc['metadata']['version']}: " + f"{len(doc['certifiedServices'])} services; next report " + f"{doc['serviceProperties']['nextOngoingCertificationReportDate']}") return 0 +# --- human-readable view (CDS-CSO-CBF: same data as the JSON) ------------------------- + +def _cell(text): + return str(text).replace("|", "\\|").replace("\n", " ") + + def render_markdown(c): - ao = c["accountable_official"] or {} + si, sp, m, pe = c["serviceIdentification"], c["serviceProperties"], c["metadata"], c["providerExtensions"] + ao = m["accountableOfficial"] + ccm = pe["continuousMonitoring"] 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']}`", ""] - mas = c["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)", "", - "| 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")) - out += ["", "---", "_Source of truth: the signed `certification-package-overview.json` (CPO-CSO-OVR)._"] + f"_{pe['certification']}. With the Security Decision Record, the CR26 replacement for the System " + "Security Plan._", "", + f"- **Provider:** {si['providerName']} | **Service:** {si['serviceName']} ({si['serviceAcronym']})", + f"- **FedRAMP ID:** {si['fedRampPackageId']} (simulated: no FedRAMP ID has been assigned)", + f"- **UEI:** {si['ueiNumber']} (simulated: no SAM.gov registration)", + f"- **Certification type:** {si['certificationType']} | **Class:** {pe['class']} | " + f"**Impact:** {pe['impact_level']} (FIPS 199 high-water mark)", + f"- **Service model:** {', '.join(sp['serviceType'])} | **Deployment model:** {sp['deploymentModel']}", + f"- **Business category:** {', '.join(sp['businessCategory'])}", + f"- **Website:** {si['website']} | **Logo:** {si['logo']}", + f"- **Accountable official:** {ao['name']}, {ao['title']} ({ao['contact']})", + f"- **Version:** {m['version']} | **Last updated:** {m['lastUpdated']}", + f"- **Source:** {m['updateSource']}", + f"- **Bound to inventory signal:** `{pe['ksi_signal_id']}`", "", + "## Service description", "", si["serviceDescription"], "", + "## Contacts", "", "| Type | Contact |", "|---|---|"] + for ct in c["contactInformation"]: + out.append(f"| {ct['contactType']} | {_cell(ct.get('contactEmail') or ct.get('contactName', ''))} |") + out += ["", "## Continuous monitoring", "", + f"- **Next Ongoing Certification Report:** {ccm['nextOngoingCertificationReportDate']}", + f"- **Next Quarterly Review:** {ccm['nextQuarterlyReviewDate']} " + f"({ccm['reviewBusinessDaysAfterIssue']} business days after the report)", + f"- **Review calendar:** {ccm['quarterlyReviewCalendar']} | " + f"**Registration:** {ccm['quarterlyReviewRegistration']}", + f"- **Issued reports and snapshots:** {ccm['ongoingCertificationReportIssues']}", + f"- **Issue dates:** {', '.join(ccm['issueDates'])}", "", + "## Services (CDS-CSO-SVC)", "", + "| Service | C / I / A | In scope | Description |", "|---|---|---|---|"] + desc = {s["serviceName"]: s["serviceDescription"] for s in c["certifiedServices"]} + for s in pe["services"]: + cat = s["securityCategory"] + out.append(f"| {_cell(s['serviceName'])} | {cat['confidentiality']} / {cat['integrity']} / " + f"{cat['availability']} | {'yes' if s['inMinimumAssessmentScope'] else 'no'} | " + f"{_cell(desc[s['serviceName']])} |") + out += ["", "**Not included:**", ""] + [f"- {n['name']}: {n['why']}" for n in pe["notIncluded"]] + out += ["", "## Simulated values", "", + "This is a proof of concept. These values stand in for an outside party that does not exist here:", ""] + out += [f"- `{s['field']}` ({s['counterparty']}): {s['how']}" for s in pe["simulated"]] + out += ["", "## Package contents", "", "| Artifact | Type | Description |", "|---|---|---|"] + for r in sp["additionalRepositories"]: + out.append(f"| [{r['url'].rsplit('/', 1)[-1]}]({r['url']}) | {', '.join(r['repositoryType'])} | " + f"{_cell(r['repositoryDescription'])} |") + out += ["", "## Cryptographic modules (CMU-CSO-CMD)", "", "| Module | Validation | Role |", "|---|---|---|"] + for mod in pe["cryptographicModules"]: + out.append(f"| {_cell(mod.get('module', ''))} | {_cell(mod.get('validation', ''))} | " + f"{_cell(mod.get('role', ''))} |") + ia = pe["independentAssessment"] + out += ["", "## Trust center and secure configuration", "", + f"- **Trust center:** {sp['trustCenter']['url']} ({sp['trustCenter']['accessRequestInstructions']})", + f"- **Secure configuration guidance:** {sp['secureConfigurationGuidance']['url']}", "", + "## Third-party information resources (MAS-CSO-TPR)", "", + "None is FedRAMP certified.", "", "| Resource | Provider | Use |", "|---|---|---|"] + for r in c["thirdPartyInformationResources"]["nonCertified"]: + out.append(f"| {_cell(r['name'])} | {_cell(r['provider'])} | {_cell(r['useCase'])} |") + out += ["", "## Independent assessment", "", f"- **Current service:** {ia['currentService']}", + f"- **Signed results:** {ia['assessmentSet']}", "", + "**Overall summary (IVV-IAS-OSA), quoted verbatim from the assessor's signed record " + f"`{ia['overallSummary']['record_id']}`:**", "", "> " + _cell(ia["overallSummary"]["text"]), "", + "---", "_Source of truth: the signed `certification-package-overview.json` (CPO-CSO-OVR)._"] return "\n".join(out) diff --git a/scripts/build-human-views.py b/scripts/build-human-views.py new file mode 100644 index 00000000..812dc282 --- /dev/null +++ b/scripts/build-human-views.py @@ -0,0 +1,215 @@ +#!/usr/bin/env python3 +"""Complete human-readable views of the published certification data, checked +for consistency with the machine-readable originals (CDS-TRC-HMR, CDS-CSO-CBF). + +For each JSON (or CSV) artifact it writes `.view.md`: every value in the +original, under its JSON Pointer path, grouped by top-level field. Each value +cell is the value's JSON encoding, so the view is lossless. Then it parses +every view back and fails unless it reproduces the original exactly. That +round trip is the automation that keeps the two formats consistent: a view +that dropped, changed or added a value would not reproduce its JSON, and the +build stops before anything is signed or published. + +The curated Markdown twins the generators write (`.md`) are summaries +from the same in-memory data in the same run; the `.view.md` is the complete +one. Both are listed per artifact in the trust manifest. + + python3 scripts/build-human-views.py ksi-signal.json boundary-map.json iiw.csv ... +""" + +import csv +import json +import sys +from pathlib import Path + +SUFFIX = ".view.md" +HEADER = "| Path | Value |" +RULE = "|---|---|" + + +def _fail(msg): + raise SystemExit(f"::error::human views: {msg} (fail-closed)") + + +# --- JSON Pointer (RFC 6901) ------------------------------------------------------------ + +def _esc(seg): + return str(seg).replace("~", "~0").replace("/", "~1") + + +def _unesc(seg): + return seg.replace("~1", "/").replace("~0", "~") + + +def leaves(obj, path=""): + """(pointer, value) for every scalar, and for every empty list or object.""" + if isinstance(obj, dict) and obj: + for k, v in obj.items(): + yield from leaves(v, f"{path}/{_esc(k)}") + elif isinstance(obj, list) and obj: + for i, v in enumerate(obj): + yield from leaves(v, f"{path}/{i}") + else: + yield path, obj + + +def _cell(v): + return json.dumps(v, ensure_ascii=False).replace("\\", "\\\\").replace("|", "\\|") + + +def _uncell(s): + out, i = [], 0 + while i < len(s): + if s[i] == "\\" and i + 1 < len(s) and s[i + 1] in "\\|": + out.append(s[i + 1]) + i += 2 + else: + out.append(s[i]) + i += 1 + return json.loads("".join(out)) + + +# --- render and parse ----------------------------------------------------------------------- + +def render(name, data, kind="json"): + out = [f"# {name}: complete human-readable view", "", + f"_Every value in `{name}`, under its JSON Pointer path; each value is shown in its JSON encoding. " + "Generated from the signed original by scripts/build-human-views.py, and checked on every build to " + "reproduce it exactly._", "", f"- **Format:** {kind}", ""] + if kind == "csv": + data = {"rows": data} + groups = {} + for ptr, v in leaves(data): + top = ptr.split("/")[1] if ptr else "" + groups.setdefault(top, []).append((ptr, v)) + for top, rows in groups.items(): + out += [f"## {_unesc(top) or '(document)'}", "", HEADER, RULE] + out += [f"| `{ptr or '/'}` | {_cell(v)} |" for ptr, v in rows] + out.append("") + return "\n".join(out) + "\n" + + +def _split_row(line): + """('ptr', 'cell') from '| `ptr` | cell |', honouring escaped pipes in the cell.""" + if not line.startswith("| `"): + return None + end = line.index("` | ", 3) + return line[3:end], line[end + 4:-2] + + +def parse(text): + """The value a view describes. A container whose keys are exactly 0..n-1 is + read as a list; an object that happened to have such keys would not round + trip, and build() fails closed on it rather than publish a wrong view.""" + kind = "csv" if "- **Format:** csv" in text else "json" + root, whole = {}, None + for line in text.splitlines(): + row = _split_row(line) + if row is None: + continue + ptr, cell = row + value = _uncell(cell) + if ptr == "/": + whole = value + continue + segs = [_unesc(x) for x in ptr.split("/")[1:]] + node = root + for seg in segs[:-1]: + node = node.setdefault(seg, {}) + node[segs[-1]] = _Leaf(value) + if whole is not None: + return whole + data = _thaw(root) + return data.get("rows", []) if kind == "csv" else data + + +class _Leaf: + __slots__ = ("value",) + + def __init__(self, value): + self.value = value + + +def _thaw(node): + if isinstance(node, _Leaf): + return node.value + if node and set(node) == {str(i) for i in range(len(node))}: + return [_thaw(node[str(i)]) for i in range(len(node))] + return {k: _thaw(v) for k, v in node.items()} + + +def load(path): + p = Path(path) + if p.suffix == ".csv": + with p.open(newline="") as f: + return list(csv.reader(f)), "csv" + try: + return json.loads(p.read_text()), "json" + except json.JSONDecodeError as exc: + _fail(f"{p} is not valid JSON: {exc}") + + +def build(path): + p = Path(path) + data, kind = load(p) + text = render(p.name, data, kind) + back = parse(text) + if back != data: + _fail(f"{p.name}: the human-readable view does not reproduce the machine-readable original") + view = p.with_name(p.stem + SUFFIX) + view.write_text(text) + return view + + +def check(path, view): + """Re-read a written view and compare it with its original (used after the + views are written, and by verifiers on the published pair).""" + data, _ = load(path) + if parse(Path(view).read_text()) != data: + _fail(f"{Path(view).name} does not match {Path(path).name}") + + +# Published by something other than the deploy (the runtime Lambda, the nightly +# beacon): the deploy never publishes them, so it writes no view of them; the +# trust page renders them from the live JSON. +NOT_DEPLOY_PUBLISHED = ("ksi-signal-runtime.json", "vdr-status.json") + + +def sources(freshness, d): + """The JSON and CSV artifacts in the governed freshness config that this + build has in directory d (absent optional ones are skipped).""" + out = [] + for a in json.loads(Path(freshness).read_text())["artifacts"]: + name = a["path"].rsplit("/", 1)[1] + if name.endswith((".json", ".csv")) and name not in NOT_DEPLOY_PUBLISHED and (Path(d) / name).is_file(): + out.append(Path(d) / name) + return out + + +def main(argv=None): + import argparse + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("paths", nargs="*") + ap.add_argument("--freshness", default=None, help="take every JSON/CSV artifact it lists that is in --dir") + ap.add_argument("--dir", default=".") + ap.add_argument("--list", default=None, help="append each written view's name to this file") + a = ap.parse_args(argv) + paths = [Path(p) for p in a.paths] + (sources(a.freshness, a.dir) if a.freshness else []) + if not paths: + _fail("no artifacts named") + written = [] + for p in paths: + if not p.is_file(): + _fail(f"{p} not found") + view = build(p) + check(p, view) + written.append(view.name) + print(f"human view: {view.name} reproduces {p.name}") + if a.list: + with open(a.list, "a") as f: + f.writelines(w + "\n" for w in written) + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-ksi-signal.py b/scripts/build-ksi-signal.py index 1d570b1c..841672d2 100755 --- a/scripts/build-ksi-signal.py +++ b/scripts/build-ksi-signal.py @@ -393,7 +393,7 @@ "function": "Public TLS certificate for the CDN", "diagram_label": "ACM TLS certificate", "public": False, - "baseline_configuration": "AWS ACM-managed; auto-renewing; FIPS-validated cipher suites via CloudFront", + "baseline_configuration": "AWS ACM-managed; auto-renewing; TLS 1.2+ via CloudFront (TLSv1.2_2021)", "iiw_asset_type": "TLS Certificate (ACM)", }, "event_schedule": { @@ -1326,6 +1326,9 @@ def build_sbom_components(sbom_path, existing_components=None): THIRD_PARTY_PATH = Path(__file__).resolve().parent.parent / "data" / "third-party-components.json" NOT_RECORDED = "not recorded" TPR_FIELDS = ("upstream_offering", "upstream_component_id", "responsibility_split") +# MAS-CSO-TPR: what FedRAMP requires documented about each third-party +# information resource. A decided record must carry every one. +MAS_TPR_FIELDS = ("usage_and_configuration", "justification", "mitigations", "compensating_controls") def load_third_party_records(path, known_ids): @@ -1347,18 +1350,24 @@ def load_third_party_records(path, known_ids): split = rec.get("responsibility_split") if split is not None and not (isinstance(split, dict) and split.get("upstream_runs") and split.get("provider_configures")): raise SystemExit(f"::error::third-party record for {cid}: responsibility_split needs upstream_runs and provider_configures") + if rec.get("decided_by") and rec.get("decided_on"): + missing = [f for f in MAS_TPR_FIELDS if not (isinstance(rec.get(f), str) and rec[f].strip())] + if missing: + raise SystemExit(f"::error::third-party record for {cid} is decided but lacks {', '.join(missing)} " + "(MAS-CSO-TPR)") return recs def third_party_attributes(rec): """The TPR-1 fields for one component. A record without a decision (decided_by and decided_on) publishes every field as "not recorded".""" + fields = (*TPR_FIELDS, *MAS_TPR_FIELDS) if rec is None: - return {**{f: NOT_RECORDED for f in TPR_FIELDS}, "third_party_record": {"status": "no record"}} + return {**{f: NOT_RECORDED for f in fields}, "third_party_record": {"status": "no record"}} if not (rec.get("decided_by") and rec.get("decided_on")): - return {**{f: NOT_RECORDED for f in TPR_FIELDS}, + return {**{f: NOT_RECORDED for f in fields}, "third_party_record": {"status": "drafted; no decision recorded"}} - out = {f: rec.get(f) or NOT_RECORDED for f in TPR_FIELDS} + out = {f: rec.get(f) or NOT_RECORDED for f in fields} out["third_party_record"] = {"status": "decided", "decided_by": rec["decided_by"], "decided_on": rec["decided_on"]} return out @@ -1437,6 +1446,47 @@ def build_external_components(third_party_path=THIRD_PARTY_PATH): "verification": "U.S. federal government source", "fedramp_status": "external; U.S. federal government source", }, + # MAS-CSO-IIR: the vulnerability-data feeds the VDR build also reads + # (scripts/fetch-detection-feeds.sh, evidence-nightly.yml's grype scan). + { + "id": "ext::first-epss", + "native_id": "https://epss.cyentia.com/epss_scores-current.csv.gz", + "name": "FIRST Exploit Prediction Scoring System (EPSS) scores", + "purpose": "Daily exploit-likelihood scores the VDR uses to rate findings", + "cia_impact": "VDR ingest accuracy", + "verification": "Public feed; a failed fetch fails the detection gate (G7) rather than scoring with no data", + "fedramp_status": "external; no separate FedRAMP authorization", + }, + { + "id": "ext::anchore-grype-db", + "native_id": "https://grype.anchore.io/databases", + "name": "Grype vulnerability database (Anchore)", + "purpose": "The vulnerability database Grype matches the SBOMs against on every deploy and nightly scan", + "cia_impact": "VDR ingest accuracy", + "verification": "Grype verifies the database checksum on download; findings are corroborated against Dependabot and CISA KEV", + "fedramp_status": "external; no separate FedRAMP authorization", + }, + # MAS-CSO-IIR: origins the Silk Reeling app loads code or data from in the + # user's browser, next to the camera feed (the app's CSP in + # infrastructure/bootstrap/cloudfront.tf allows exactly these). + { + "id": "ext::jsdelivr", + "native_id": "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision/", + "name": "jsDelivr CDN (MediaPipe Tasks Vision runtime)", + "purpose": "Serves the MediaPipe pose-estimation JavaScript and WebAssembly the app runs in the browser", + "cia_impact": "code executed next to the camera feed in the user's browser", + "verification": "Version pinned in the app bundle and in the CSP script-src path; the CSP allows no other jsDelivr path", + "fedramp_status": "external; no separate FedRAMP authorization", + }, + { + "id": "ext::google-cloud-storage", + "native_id": "https://storage.googleapis.com/mediapipe-models/", + "name": "Google Cloud Storage (MediaPipe model bucket)", + "purpose": "Serves the pose-landmarker model file the MediaPipe runtime loads in the browser", + "cia_impact": "model integrity for the pose scores the app computes", + "verification": "CSP connect-src limited to the mediapipe-models path; the model runs in the browser and returns landmarks only", + "fedramp_status": "external; no separate FedRAMP authorization", + }, ] tpr = load_third_party_records(third_party_path, {s["id"] for s in services}) components = [] @@ -1595,7 +1645,8 @@ def build_validations(validations_doc, components): "dns_zone", "tls_certificate", "secrets_manager", "identity_provider", "kms_key"}, "IAM": {"iam_role", "iam_policy", "iam_group", "oidc_provider", "identity_provider", "secrets_manager"}, "INR": {"log_group", "function", "notification_topic", "metric_alarm"}, - "MLA": {"log_group", "function", "cdn_distribution", "notification_topic", "metric_alarm", "message_queue"}, + "MLA": {"log_group", "function", "cdn_distribution", "notification_topic", "metric_alarm", "message_queue", + "audit_log_trail"}, "PIY": None, # policy & inventory — whole inventory is the evidence "RPL": {"object_store"}, "SCR": {"npm_package", "pypi_package", "external_service"}, diff --git a/scripts/build-mas.py b/scripts/build-mas.py new file mode 100644 index 00000000..b18f6b87 --- /dev/null +++ b/scripts/build-mas.py @@ -0,0 +1,424 @@ +#!/usr/bin/env python3 +"""The Minimum Assessment Scope, generated: /.well-known/minimum-assessment-scope.json. + +One machine-readable view of the cloud service offering's scope, joined from +what the pipeline already holds, so it cannot drift from it: + + MAS-CSO-IIR the information resources: the canonical inventory (ksi-signal.json), + plus every off-origin host the site's and app's Content Security + Policies allow (infrastructure/bootstrap/cloudfront.tf), each placed + on an inventoried component or put out of scope with a reason. + MAS-CSO-FLO the information flows (docs/boundary/boundary-classification.json) + resolved against the inventory, each with a security category + derived from its endpoints (the high-water mark of their FIPS 199 + categories); every external service and every data store is in at + least one flow. + MAS-CSO-MDI the metadata inventory: every data store and log in the inventory, + what it holds, which personal data, retention and location + (data/minimum-assessment-scope.json supplies the meaning). + MAS-CSO-TPR each third-party information resource with the four fields FedRAMP + requires (data/third-party-components.json, decided records only). + FRC-CSX-MAS how every KSI applies to the scope: per component through the KSI's + evidence domain, or over the whole set. + +Fails closed: any gap above stops the build, and so the deploy, before the SDR +is built. No ARN, account ID or address is published: components are named by +their inventory IDs. +""" + +import argparse +import fnmatch +import json +import re +import sys +from datetime import datetime, timezone +from pathlib import Path + +REPO = Path(__file__).resolve().parent.parent +INPUTS = REPO / "data" / "minimum-assessment-scope.json" +THIRD_PARTY = REPO / "data" / "third-party-components.json" +CLASSIFICATION = REPO / "docs" / "boundary" / "boundary-classification.json" +CLOUDFRONT_TF = REPO / "infrastructure" / "bootstrap" / "cloudfront.tf" +BOOTSTRAP_DIR = REPO / "infrastructure" / "bootstrap" +SCHEMA = "minimum-assessment-scope/1" +LEVELS = ("low", "moderate", "high") +OBJECTIVES = ("confidentiality", "integrity", "availability") +TPR_FIELDS = ("usage_and_configuration", "justification", "mitigations", "compensating_controls") +PACKAGE_TYPES = ("npm_package", "pypi_package") +CODE = { + "builder": "scripts/build-mas.py", + "inventory": "scripts/build-ksi-signal.py", + "inputs": "data/minimum-assessment-scope.json", + "flows": "docs/boundary/boundary-classification.json", + "third_party": "data/third-party-components.json", + "csp": "infrastructure/bootstrap/cloudfront.tf", +} +DERIVATION = ( + "Generated on every deploy by scripts/build-mas.py from this build's canonical inventory " + "(ksi-signal.json, itself derived from Terraform state, the SBOMs, the site's HTML and the declared " + "external services), the boundary classification's data-flow table, the operator's metadata and " + "off-origin placements (data/minimum-assessment-scope.json) and the third-party records " + "(data/third-party-components.json). Information resources are the inventory's components; the " + "Content Security Policies the edge serves are parsed for every off-origin host, and each must be an " + "inventoried component or out of scope with a stated reason. Each flow is resolved against the inventory " + "and given the high-water mark of its endpoints' security categories. Every data store and log in the " + "inventory must have a metadata entry, every external service and data store must be in a flow, every " + "third-party resource must carry a decided record with the four MAS-CSO-TPR fields, and every component " + "type must fall in at least one KSI's evidence domain or carry a whole-set reason. Any gap fails the " + "build, so the deploy never publishes a scope with one." +) + + +def _fail(msg): + raise SystemExit(f"::error::MAS: {msg} (fail-closed)") + + +# --- MAS-CSO-IIR: off-origin hosts from the CSPs --------------------------------------- + +_URL = re.compile(r"https://([A-Za-z0-9.${}_-]+)") +_LOCAL = re.compile(r"\$\{local\.([A-Za-z0-9_]+)\}") +_VAR = re.compile(r"\$\{var\.([A-Za-z0-9_]+)\}") + + +def _locals(text): + """{name: definition text} for every `name = ...` in a locals block (to the + next blank line, enough for this repository's style).""" + out = {} + for block in re.finditer(r"locals\s*\{(.*?)\n\}", text, re.S): + body = block.group(1) + for m in re.finditer(r"^\s*([A-Za-z0-9_]+)\s*=\s*(.*?)(?=^\s*[A-Za-z0-9_]+\s*=|\Z)", body, re.S | re.M): + v = m.group(2).strip() + q = re.match(r'^"([^"\n]*)"', v) # a plain string local: its content, without the quotes + out[m.group(1)] = q.group(1) if q else v + return out + + +def _var_defaults(text): + return {m.group(1): m.group(2) for m in re.finditer( + r'variable\s+"([A-Za-z0-9_]+)"\s*\{[^}]*?default\s*=\s*"([^"]*)"', text, re.S)} + + +def _expand(s, locals_, vars_, depth=0): + if depth > 5: + _fail("CSP expansion does not terminate") + s = _VAR.sub(lambda m: vars_.get(m.group(1), m.group(0)), s) + if "domain_name" in vars_: + s = s.replace("${local.domain_dashed}", vars_["domain_name"].replace(".", "-")) + return _LOCAL.sub(lambda m: _expand(locals_.get(m.group(1), m.group(0)), locals_, vars_, depth + 1), s) + + +def csp_hosts(tf_text, context_text=""): + """Every host an https:// source in a content_security_policy names, with + ${local.*} and ${var.*} references expanded from the same configuration.""" + whole = tf_text + "\n" + context_text + locals_, vars_ = _locals(whole), _var_defaults(whole) + hosts = set() + for m in re.finditer(r"content_security_policy\s*=\s*join\(\s*\"; \",\s*\[(.*?)\]\s*\)", tf_text, re.S): + expanded = _expand(m.group(1), locals_, vars_) + # Every https:// source must yield a host: one that does not would be a + # host this check silently missed. + if expanded.count("https://") != len(_URL.findall(expanded)): + _fail("a CSP https:// source does not resolve to a host") + for h in _URL.findall(expanded): + if "$" in h or "{" in h or "}" in h: + _fail(f"cannot resolve the CSP source host {h!r}") + hosts.add(h.lower()) + return sorted(hosts) + + +def place_hosts(hosts, placements, component_ids): + """[(host, placement)] for every host; fails on a host placed nowhere, on a + placement naming a component the inventory lacks, or with no reason.""" + out, problems = [], [] + for h in hosts: + p = placements.get(h) + if not isinstance(p, dict): + problems.append(f"the CSP allows {h}, which is neither an inventoried information resource nor " + "out of scope with a reason (data/minimum-assessment-scope.json off_origin_hosts)") + continue + if p.get("component"): + if p["component"] not in component_ids: + problems.append(f"{h} is placed on {p['component']}, which is not in the inventory") + out.append({"host": h, "component": p["component"]}) + elif isinstance(p.get("out_of_scope"), str) and p["out_of_scope"].strip(): + out.append({"host": h, "out_of_scope": p["out_of_scope"]}) + else: + problems.append(f"{h} has neither a component nor an out_of_scope reason") + return out, problems + + +# --- MAS-CSO-FLO ------------------------------------------------------------------------- + +def _match(pattern, ids): + return sorted(i for i in ids if fnmatch.fnmatchcase(i, pattern)) + + +def _high_water(categories): + out = {} + for o in OBJECTIVES: + vals = [c.get(o) for c in categories if c.get(o) in LEVELS] + if vals: + out[o] = max(vals, key=LEVELS.index) + return out + + +def flows(classification, components, data_store_types): + by_id = {c["component_id"]: c for c in components} + ids = sorted(by_id) + declared = {d["key"] for d in classification.get("declared", [])} + out, problems, covered = [], [], set() + for f in classification.get("flows", []): + endpoints = [] + for ref in f["path"]: + if "declared" in ref: + if ref["declared"] not in declared: + problems.append(f"flow {f['id']} names an undeclared actor {ref['declared']}") + endpoints.append({"declared": ref["declared"]}) + continue + hit = _match(ref["component"], ids) + if not hit: + problems.append(f"flow {f['id']} endpoint {ref['component']} matches no inventoried component") + covered.update(hit) + endpoints.append({"components": hit}) + cats = [by_id[i].get("security_category") or {} for e in endpoints for i in e.get("components", [])] + category = _high_water(cats) + if len(category) != len(OBJECTIVES): + problems.append(f"flow {f['id']} has no endpoint with a security category") + out.append({"id": f["id"], "label": f["label"], "endpoints": endpoints, "security_category": category, + **{k: f[k] for k in ("protocol", "auth", "encryption", "data", "note") if f.get(k)}}) + must = sorted(i for i, c in by_id.items() if c.get("type") == "external_service" or c.get("type") in data_store_types) + for i in must: + if i not in covered: + problems.append(f"{i} ({by_id[i].get('type')}) is in no information flow") + return out, problems + + +# --- MAS-CSO-MDI ------------------------------------------------------------------------- + +def metadata_inventory(components, metadata, data_store_types): + out, problems = [], [] + keys = list(metadata) + for c in sorted(components, key=lambda c: c["component_id"]): + cid, ctype = c["component_id"], c.get("type") + third_party_observed = cid in metadata and ctype == "external_service" + if ctype not in data_store_types and not third_party_observed: + continue + key = cid if cid in metadata else next((k for k in keys if fnmatch.fnmatchcase(cid, k)), None) + if key is None: + problems.append(f"{cid} ({ctype}) holds data or logs but has no metadata entry " + "(data/minimum-assessment-scope.json metadata)") + continue + m = metadata[key] + if not (isinstance(m.get("holds"), str) and isinstance(m.get("personal_data"), list) + and isinstance(m.get("retention"), str)): + problems.append(f"metadata entry {key} needs holds, personal_data and retention") + continue + attrs = c.get("attributes") or {} + entry = {"component": cid, "type": ctype, "holds": m["holds"], "personal_data": m["personal_data"], + "retention": m["retention"], + "location": attrs.get("region") or ("third party" if ctype == "external_service" else "not recorded"), + "controlled_by": "third party" if ctype == "external_service" else "provider"} + if "retention_days" in m: + entry["retention_days"] = m["retention_days"] + out.append(entry) + return out, problems + + +# --- MAS-CSO-TPR ------------------------------------------------------------------------- + +def third_party(components, tpr_doc): + recs = (tpr_doc or {}).get("components") or {} + out, problems = [], [] + for c in sorted(components, key=lambda c: c["component_id"]): + if c.get("type") != "external_service": + continue + cid, rec = c["component_id"], recs.get(c["component_id"]) + if not rec: + problems.append(f"{cid} has no third-party record (data/third-party-components.json)") + continue + if not (rec.get("decided_by") and rec.get("decided_on")): + problems.append(f"{cid}'s third-party record has no decision (decided_by, decided_on)") + continue + missing = [f for f in TPR_FIELDS if not (isinstance(rec.get(f), str) and rec[f].strip())] + if missing: + problems.append(f"{cid}'s third-party record lacks {', '.join(missing)}") + continue + attrs = c.get("attributes") or {} + out.append({"component": cid, "name": attrs.get("name") or cid, "provider": rec.get("provider"), + "website": rec.get("website"), "upstream_offering": rec.get("upstream_offering"), + **{f: rec[f] for f in TPR_FIELDS}, + "decided_by": rec["decided_by"], "decided_on": rec["decided_on"]}) + return out, problems + + +# --- FRC-CSX-MAS ------------------------------------------------------------------------- + +def ksi_application(signal, whole_set_types): + """Per KSI: the components its evidence domain covers, or the whole set. + A KSI whose evidence is every component (or none, a documentation KSI) + applies over the whole set; the rest apply per component.""" + comps = [c for c in signal.get("components", [])] + all_ids = {c["component_id"] for c in comps} + type_of = {c["component_id"]: c.get("type") for c in comps} + out, domain_types = [], set() + for k in signal.get("ksis", []): + refs = set((k.get("evidence") or {}).get("component_refs") or []) + whole = not refs or refs >= all_ids + if not whole: + domain_types.update(type_of[r] for r in refs if r in type_of) + out.append({"ksi": k["id"], "method": k.get("method"), "status": k.get("status"), + "applies_to": "whole set" if whole else "per component", + "components": len(all_ids) if whole else len(refs & all_ids), + "component_types": sorted({type_of[r] for r in (all_ids if whole else refs & all_ids)})}) + problems = [] + if not out: + problems.append("the inventory carries no KSIs") + for t in sorted({type_of[i] for i in all_ids}): + if t not in domain_types and not (isinstance(whole_set_types.get(t), str) and whole_set_types[t].strip()): + problems.append(f"component type {t} is in no KSI's per-component evidence domain and has no whole-set " + "reason (data/minimum-assessment-scope.json whole_set_types)") + per_type = {t: ("per component" if t in domain_types else f"whole set only: {whole_set_types[t]}") + for t in sorted({type_of[i] for i in all_ids}) if t in domain_types or t in whole_set_types} + return out, per_type, problems + + +# --- build ------------------------------------------------------------------------------- + +def build(signal, inputs, classification, tpr_doc, cloudfront_tf, bootstrap_context, commit, now): + comps = signal.get("components", []) + ids = {c["component_id"] for c in comps} + dst = set(inputs.get("data_store_types") or []) + hosts, p1 = place_hosts(csp_hosts(cloudfront_tf, bootstrap_context), inputs.get("off_origin_hosts") or {}, ids) + fl, p2 = flows(classification, comps, dst) + md, p3 = metadata_inventory(comps, inputs.get("metadata") or {}, dst) + tp, p4 = third_party(comps, tpr_doc) + ka, per_type, p5 = ksi_application(signal, inputs.get("whole_set_types") or {}) + problems = p1 + p2 + p3 + p4 + p5 + by_type = {} + for c in comps: + by_type[c.get("type")] = by_type.get(c.get("type"), 0) + 1 + resources = [{"component": c["component_id"], "type": c.get("type"), + "security_category": c.get("security_category"), + "function": (c.get("attributes") or {}).get("function")} + for c in sorted(comps, key=lambda c: c["component_id"]) if c.get("type") not in PACKAGE_TYPES] + doc = { + "schema": SCHEMA, + "generated_at": now, + "commit": commit, + "ksi_signal_id": signal.get("signal_id"), + "derivation": DERIVATION, + "code": CODE, + "information_resources": { + "total": len(comps), + "by_type": dict(sorted(by_type.items())), + "software_packages": sum(by_type.get(t, 0) for t in PACKAGE_TYPES), + "resources": resources, + "off_origin_hosts": hosts, + }, + "flows": fl, + "metadata_inventory": md, + "third_party_information_resources": tp, + "ksi_application": {"ksis": ka, "component_types": per_type}, + "checks": { + "off_origin_hosts_placed": not p1, + "every_external_service_and_data_store_in_a_flow": not p2, + "every_data_store_and_log_has_metadata": not p3, + "every_third_party_resource_decided_with_all_fields": not p4, + "every_component_type_in_a_ksi_domain": not p5, + }, + } + return doc, problems + + +def render_markdown(d): + ir = d["information_resources"] + out = ["# Minimum Assessment Scope", "", + f"_Generated {d['generated_at']} from inventory `{d['ksi_signal_id']}` at commit `{(d['commit'] or '')[:12]}`._", + "", "## How this is derived", "", d["derivation"], "", + "Code: " + ", ".join(f"`{v}`" for v in d["code"].values()), "", + "## Information resources (MAS-CSO-IIR)", "", + f"{ir['total']} inventoried components, {ir['software_packages']} of them software packages.", "", + "| Type | Count |", "|---|---|", *[f"| {t} | {n} |" for t, n in ir["by_type"].items()], "", + "| Component | Type | C/I/A | Function |", "|---|---|---|---|"] + for r in ir["resources"]: + sc = r.get("security_category") or {} + out.append(f"| `{r['component']}` | {r['type']} | {'/'.join(sc.get(o, '?') for o in OBJECTIVES)} | " + f"{(r.get('function') or '').replace('|', '/')} |") + out += ["", "Off-origin hosts the Content Security Policies allow:", "", + "| Host | Placement |", "|---|---|"] + for h in ir["off_origin_hosts"]: + out.append(f"| {h['host']} | " + (f"`{h['component']}`" if h.get("component") else f"Out of scope: {h['out_of_scope']}") + " |") + out += ["", "## Information flows and security categories (MAS-CSO-FLO)", "", + "| Flow | Endpoints | C/I/A | Protocol | Auth | Encryption | Data |", "|---|---|---|---|---|---|---|"] + for f in d["flows"]: + ends = " → ".join(e.get("declared") or ", ".join(e["components"]) or "(none)" for e in f["endpoints"]) + sc = f["security_category"] + out.append(f"| {f['id']}: {f['label']} | {ends} | {'/'.join(sc.get(o, '?') for o in OBJECTIVES)} | " + f"{f.get('protocol', '')} | {f.get('auth', '')} | {f.get('encryption', '')} | {f.get('data', '')} |") + out += ["", "## Metadata inventory (MAS-CSO-MDI)", "", + "| Component | Holds | Personal data | Retention | Location |", "|---|---|---|---|---|"] + for m in d["metadata_inventory"]: + out.append(f"| `{m['component']}` | {m['holds']} | {', '.join(m['personal_data']) or 'none'} | " + f"{m['retention']} | {m['location']} ({m['controlled_by']}) |") + out += ["", "## Third-party information resources (MAS-CSO-TPR)", ""] + for t in d["third_party_information_resources"]: + out += [f"### {t['name']} (`{t['component']}`)", "", + f"- **Provider:** {t['provider']} ({t['website']})", + f"- **General usage and configuration:** {t['usage_and_configuration']}", + f"- **Justification for use:** {t['justification']}", + f"- **Mitigation measures:** {t['mitigations']}", + f"- **Compensating controls:** {t['compensating_controls']}", + f"- **Decided by:** {t['decided_by']}, {t['decided_on']}", ""] + out += ["## Key Security Indicators applied to the scope (FRC-CSX-MAS)", "", + "| KSI | Method | Applies | Components | Types |", "|---|---|---|---|---|"] + for k in d["ksi_application"]["ksis"]: + out.append(f"| {k['ksi']} | {k['method']} | {k['applies_to']} | {k['components']} | {', '.join(k['component_types'])} |") + out += ["", "| Component type | Coverage |", "|---|---|", + *[f"| {t} | {v} |" for t, v in d["ksi_application"]["component_types"].items()], + "", "## Checks", "", *[f"- {k}: {'pass' if v else 'FAIL'}" for k, v in d["checks"].items()], + "", "---", "_Source of truth: the signed `minimum-assessment-scope.json`._"] + return "\n".join(out) + + +def _read_json(path, what): + try: + return json.loads(Path(path).read_text()) + except (OSError, json.JSONDecodeError) as exc: + _fail(f"cannot read {what} {path} ({type(exc).__name__})") + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--ksi-signal", default="ksi-signal.json") + ap.add_argument("--inputs", default=str(INPUTS)) + ap.add_argument("--classification", default=str(CLASSIFICATION)) + ap.add_argument("--third-party", default=str(THIRD_PARTY)) + ap.add_argument("--cloudfront-tf", default=str(CLOUDFRONT_TF)) + ap.add_argument("--commit", default="") + ap.add_argument("--output", default="minimum-assessment-scope.json") + ap.add_argument("--md-output", default="minimum-assessment-scope.md") + a = ap.parse_args(argv) + signal = _read_json(a.ksi_signal, "the KSI signal") + inputs = _read_json(a.inputs, "the MAS inputs") + if inputs.get("schema") != "mas-inputs/1": + _fail(f"{a.inputs} is not a mas-inputs/1 document") + tf = Path(a.cloudfront_tf).read_text() + context = "\n".join(p.read_text() for p in sorted(Path(a.cloudfront_tf).parent.glob("*.tf"))) + doc, problems = build(signal, inputs, _read_json(a.classification, "the classification"), + _read_json(a.third_party, "the third-party records"), tf, context, a.commit, + datetime.now(timezone.utc).isoformat()) + if problems: + for p in problems: + print(f"::error::MAS: {p}") + _fail(f"{len(problems)} gap(s) in the Minimum Assessment Scope") + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") + if a.md_output: + Path(a.md_output).write_text(render_markdown(doc) + "\n") + print(f"minimum-assessment-scope: {doc['information_resources']['total']} components, {len(doc['flows'])} flows, " + f"{len(doc['metadata_inventory'])} metadata entries, {len(doc['third_party_information_resources'])} " + f"third-party records, {len(doc['ksi_application']['ksis'])} KSIs applied") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-ocr.py b/scripts/build-ocr.py index cad56d46..46470686 100644 --- a/scripts/build-ocr.py +++ b/scripts/build-ocr.py @@ -1,43 +1,76 @@ #!/usr/bin/env python3 # ============================================================================= -# ONGOING CERTIFICATION REPORT BUILDER (CR26 CCM) +# ONGOING CERTIFICATION REPORT BUILDER (CR26 CCM, FedRAMP's 2026-06-24 schema) # ============================================================================= -# CR26 Collaborative Continuous Monitoring is a quarterly cycle, not a stream. -# CCM-OCR-AVL requires a human-readable Ongoing Certification Report (OCR) every -# 3 months covering the period since the previous summary, carrying eight -# high-level summaries; CCM-OCR-NRD requires publishing the target date of the -# next OCR, and CCM-QTR-NRD the target date of the next Quarterly Review. This -# generator derives the OCR from the system's own published artifacts (the SCN -# register, the decision register, the VDR report) and emits it as both JSON (Certification -# Data, bound to the canonical inventory's signal_id) and human-readable -# markdown. It is the same report for the Rev5 and 20x certification types. +# CCM-OCR-AVL: a human-readable report every 3 months covering the period since +# the previous one, with the eight summaries, in FedRAMP's OCR schema. Dates +# come from the fixed calendar (infrastructure/schemas/ccm-calendar.json via +# scripts/_ccm.py), never from "now plus 91 days": # -# What it cannot manufacture is the *relationship*: the synchronous Quarterly -# Review (CCM-QTR-MTG) and the agency feedback loop (CCM-OCR-FBM/AFS) need a -# consuming party. With no agency sponsor those are recorded as N/A, and the OCR -# says so rather than implying a closed loop that does not exist. +# rolling (default) the report as it stands today, from the latest issue to +# today; rebuilt on every deploy and maintenance run +# --issue YYYY-MM-DD the frozen report for one calendar issue date, covering +# the previous issue to that one (scripts/issue-ocr.py) +# +# Sources: the SCN register (changes), the decision register (planned changes), +# the VDR report (accepted vulnerabilities), the incident register when present +# (reportable incidents and lessons learned), and the feedback register +# (data/ocr-feedback.json: the operator's anonymized summary of the questions +# and answers on the previous report, CCM-OCR-AFS). +# +# Before it is written, every string is screened (scripts/_sensitivity.py, +# CCM-OCR-LSI) and the whole document validated against the vendored schema; +# either failing writes nothing. The public-release determination (CCM-OCR-RPS) +# is a decision record the report cites. # # build-ocr.py --vdr vdr-report.json --decisions ../data/decisions.json \ -# --scn-register ../docs/scn/scn-register.csv --ksi-signal ksi-signal.json +# --scn-register ../docs/scn/scn-register.csv --ksi-signal ksi-signal.json # ============================================================================= import argparse import csv import json import sys -from datetime import datetime, timedelta, timezone +from datetime import date, datetime, timedelta, timezone from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _ccm # noqa: E402 import _decisions # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 +import _sensitivity # noqa: E402 -QUARTER_DAYS = 91 +REPO = Path(__file__).resolve().parent.parent +FEEDBACK_PATH = REPO / "data" / "ocr-feedback.json" +INCIDENTS_PATH = REPO / "data" / "incidents.json" +SITE = "https://samaydlette.com" +PLANNING_DAYS = 92 # at least 3 months past the report's end +SUMMARY_MAX = 300 +# The decision records the report cites (data/decisions.json). +PUBLIC_RELEASE_DECISION = "DEC-101" # CCM-OCR-RPS / CCM-QTR-SCR: published in full +FEEDBACK_DECISION = "DEC-102" # CCM-OCR-AFS: the operator summarizes feedback, anonymized +REVIEW_DECISION = "DEC-103" # CCM-QTR-MTG: the operator hosts each review +STANDING_AGENDA = [ + "Walk through the report's eight summaries and anything changed since it was issued.", + "Standing item (CCM-QTR-ACT): Key Security Indicator results and their trend over the quarter, from the " + "Security Decision Record's 30-day and one-year metric summaries.", + "Standing item (CCM-QTR-ACT): open and accepted vulnerabilities and their trend, from the vulnerability " + "history (VER-TFR-MRH).", + "Standing item (CCM-QTR-ACT): the plan for the next quarter, including planned changes to certification data.", + "Questions from attendees, and those received through the report's feedback channel.", +] -def _load_json(path): - p = Path(path) - if not p.exists(): - print(f"::warning::OCR input not found: {path}", file=sys.stderr) +def _fail(msg): + raise SystemExit(f"::error::OCR: {msg} (fail-closed)") + + +def _load_json(path, required=False): + p = Path(path) if path else None + if not p or not p.exists(): + if required: + _fail(f"{path} not found") return None return json.loads(p.read_text()) @@ -50,140 +83,267 @@ def _scn_rows(path): return list(csv.DictReader(f)) -def build_ocr(vdr, decisions, scn_rows, signal_id, now): - period_start = (now - timedelta(days=QUARTER_DAYS)).date().isoformat() - period_end = now.date().isoformat() - - # 1. Changes to Certification Data — the SCN register is the change record. - cert_changes = [{"scn_id": r.get("scn_id"), "type": r.get("scn_type"), - "summary": (r.get("short_description") or "")[:240], - "status": r.get("status", "")[:80]} for r in scn_rows] - # 4. Transformative changes (a subset of the above). - transformative = [c for c in cert_changes if (c.get("type") or "").lower() == "transformative"] - - # 2. Planned changes over the next 3 months — in-force decision records that - # carry a remediation plan or a planned completion date. A false positive or - # an accepted risk plans no change, so it is not listed here. - planned = [{"decision_id": r["id"], "title": r.get("title", "")[:160], - "planned_completion": r.get("planned_completion")} - for r in (decisions or {}).get("decisions", []) - if r.get("status") == "in-force" and (r.get("remediation_plan") or r.get("planned_completion"))] - - # 3. Accepted vulnerabilities. - accepted = [] - if vdr: - for a in vdr.get("risk_accepted", []) or []: - accepted.append({"tracking_id": a.get("tracking_id"), "pain": a.get("pain"), - "decision_id": a.get("decision_id"), - "explanation": (a.get("explanation") or "")[:200]}) - - report = { - "report_type": "ongoing-certification-report", - "schema": "fedramp-ongoing-certification-report-schema-2026-06-24.json", - "fedramp_id": "", - "class": "C", - "emitted_at": now.isoformat(), - "reporting_period": {"start": period_start, "end": period_end}, - "ksi_signal_id": signal_id, - "next_ongoing_certification_report_date": (now + timedelta(days=QUARTER_DAYS)).date().isoformat(), - "next_quarterly_review_date": (now + timedelta(days=QUARTER_DAYS)).date().isoformat(), - # The eight CCM-OCR-AVL summaries: - "summaries": { - "changes_to_certification_data": cert_changes, # 1 - "planned_changes_next_quarter": planned, # 2 - "accepted_vulnerabilities": accepted, # 3 - "transformative_changes": transformative, # 4 - "updated_recommendations": [ # 5 - "No new customer recommendations this period; the Secure Configuration " - "Guidance at /.well-known/ remains current."], - "agencies_using_product": [], # 6 (none) - "reportable_incidents_or_attestation": # 7 - "No FedRAMP Reportable Incidents occurred during this reporting period. " - "The system holds no federal customer data, so the IEC-CSO-EFR trigger " - "does not apply; this is an attestation of none, not an omission.", - "lessons_learned_from_incidents": [], # 8 (none) - }, - "relationship_obligations_status": ( - "N/A absent a consuming agency. The synchronous Quarterly Review (CCM-QTR-MTG), " - "the feedback channel (CCM-OCR-FBM), and the anonymized feedback summary " - "(CCM-OCR-AFS) require a counterparty; with no agency sponsor there is none to " - "exercise them. The next-review date above is published per CCM-QTR-NRD regardless."), - } - return report +def _day(v): + try: + return date.fromisoformat(str(v)[:10]) + except ValueError: + return None -def render_markdown(r): - s = r["summaries"] - out = ["# Ongoing Certification Report", ""] - out.append(f"- **Class:** {r['class']} | **Reporting period:** {r['reporting_period']['start']} to {r['reporting_period']['end']}") - out.append(f"- **Emitted:** {r['emitted_at']}") - out.append(f"- **Bound to inventory signal:** `{r['ksi_signal_id']}`") - out.append(f"- **Next Ongoing Certification Report (CCM-OCR-NRD):** {r['next_ongoing_certification_report_date']}") - out.append(f"- **Next Quarterly Review (CCM-QTR-NRD):** {r['next_quarterly_review_date']}") - out.append("") - out.append("> " + r["relationship_obligations_status"]) - out.append("") - - def section(n, title, body): - out.append(f"## {n}. {title}\n") - out.extend(body) - out.append("") - - cc = s["changes_to_certification_data"] - section(1, "Changes to Certification Data", - ([f"- `{c['scn_id']}` ({c['type']}): {c['summary']} — _{c['status']}_" for c in cc] - if cc else ["_No changes recorded this period._"])) - pc = s["planned_changes_next_quarter"] - section(2, "Planned changes over the next 3 months", - ([f"- {p['title']}" for p in pc] if pc else ["_None planned._"])) - av = s["accepted_vulnerabilities"] - section(3, "Accepted vulnerabilities", - ([f"- `{a['tracking_id']}` (PAIN {a['pain']}, {a['decision_id'] or 'no decision record'}): {a['explanation']}" for a in av] - if av else ["_None._"])) - tf = s["transformative_changes"] - section(4, "Transformative changes", - ([f"- `{c['scn_id']}`: {c['summary']}" for c in tf] if tf else ["_None this period._"])) - section(5, "Updated recommendations", [f"- {x}" for x in s["updated_recommendations"]]) - ag = s["agencies_using_product"] - section(6, "Agencies using the product", - ([f"- {a}" for a in ag] if ag else ["_None — unsponsored proof of concept._"])) - section(7, "FedRAMP Reportable Incidents", [s["reportable_incidents_or_attestation"]]) - ll = s["lessons_learned_from_incidents"] - section(8, "Lessons learned from incidents", - ([f"- {x}" for x in ll] if ll else ["_None; no incidents to date._"])) - out.append("---") - out.append("_Source of truth: the signed `ongoing-certification-report.json`. Rules: " - "CCM-OCR-AVL (report), CCM-OCR-NRD / CCM-QTR-NRD (next dates)._") - return "\n".join(out) +def _in(d, period): + return d is not None and period[0] < d <= period[1] + + +def _short(text, n=SUMMARY_MAX): + text = " ".join(str(text or "").split()) + return text if len(text) <= n else text[: n - 1].rstrip() + "…" + + +# --- the eight summaries ------------------------------------------------------------- + +def scn_changes(rows, period): + out, transformative = [], [] + for r in rows: + when = _day(r.get("date_finished")) or _day(r.get("date_initiated")) + if not _in(when, period): + continue + line = f"{r.get('scn_id')} ({r.get('scn_type')}, {when}): {_short(r.get('short_description'))}" + out.append(line) + if (r.get("scn_type") or "").lower() == "transformative": + transformative.append(line) + return out, transformative + + +def planned_changes(decisions, period): + horizon = period[1] + timedelta(days=PLANNING_DAYS) + changes = [f"{r['id']}: {_short(r.get('title'), 160)}" + + (f" (planned completion {r['planned_completion']})" if r.get("planned_completion") else "") + for r in _decisions.in_force(decisions or {"decisions": []}) + if r.get("remediation_plan") or r.get("planned_completion")] + return {"planningHorizonThrough": horizon.isoformat(), "changes": changes} + + +def accepted_summary(vdr, period): + acc = (vdr or {}).get("risk_accepted") or [] + if not acc: + return (f"No accepted vulnerabilities as of {period[1]}. Full records: " + f"{SITE}/.well-known/vdr-accepted-vulnerabilities.json (VER-RPT-AVI).") + ids = ", ".join(sorted(str(a.get("decision_id") or a.get("tracking_id")) for a in acc)[:20]) + return (f"{len(acc)} accepted vulnerabilities as of {period[1]}, each with a decision record ({ids}). " + f"Full records: {SITE}/.well-known/vdr-accepted-vulnerabilities.json (VER-RPT-AVI).") -def main(): +def reportable_incidents(register, period): + out = [] + for inc in (register or {}).get("incidents", []): + if not (inc.get("evaluation") or {}).get("reportable"): + continue + if not _in(_day(inc.get("started_at")), period): + continue + title = str(inc.get("title") or "") + if inc.get("exercise"): + title = "Exercise, not a real incident: " + title.removeprefix("Exercise: ") + rec = {"summary": f"{inc['id']}: {_short(title)}", "occurredAt": inc["started_at"]} + if inc.get("resolved_at"): + rec["resolvedAt"] = inc["resolved_at"] + lessons = list(inc.get("lessons_learned") or []) + for rep in inc.get("reports", []): + lessons += list((rep.get("set") or {}).get("lessons_learned") or []) + if lessons: + rec["incidentLessonsLearned"] = [_short(x) for x in lessons] + out.append(rec) + return out + + +# --- feedback (CCM-OCR-FBM / AFS) ---------------------------------------------------- + +def load_feedback(path=FEEDBACK_PATH): + doc = _load_json(path) or {"schema": "ocr-feedback/1", "summaries": []} + if doc.get("schema") != "ocr-feedback/1" or not isinstance(doc.get("summaries"), list): + _fail(f"{path} is not an ocr-feedback/1 document") + for s in doc["summaries"]: + for k in ("ocr", "received", "summarized_by", "summarized_on", "items"): + if k not in s: + _fail(f"feedback summary for {s.get('ocr')} has no {k}") + if not isinstance(s["items"], list) or len(s["items"]) > s["received"]: + _fail(f"feedback summary for {s['ocr']}: more summarized items than received") + return doc + + +def feedback_summary(feedback, previous_issue): + """The anonymized summary of feedback on the previous issued report.""" + if previous_issue is None: + return {"ocr": None, "statement": "No report has been issued before this one, so there is no feedback " + "to summarize yet."} + entry = next((s for s in feedback["summaries"] if s["ocr"] == previous_issue.isoformat()), None) + if entry is None or entry["received"] == 0: + return {"ocr": previous_issue.isoformat(), "received": 0, + "statement": f"No feedback or questions were received on the report issued {previous_issue}."} + return {"ocr": entry["ocr"], "received": entry["received"], + "summarizedOn": entry["summarized_on"], + "statement": f"{entry['received']} item(s) received on the report issued {entry['ocr']}, " + "summarized without names, agencies or identifying detail.", + "items": [{"question": _short(i["question"]), "answer": _short(i["answer"])} for i in entry["items"]]} + + +# --- build --------------------------------------------------------------------------- + +def build(cal, today, vdr, decisions, scn_rows, incidents, feedback, signal, prof, off, prev, now, issue=None): + if issue is None: + period = cal.current_period(today) + done = cal.issued(today) + prev_issue = done[-1] if done else None + kind = {"kind": "rolling", "statement": "The report as it stands since the latest issue; rebuilt on every " + "deploy and maintenance run. Issued reports are frozen: see ongoingCertificationReportIssues."} + else: + if issue not in cal.issues: + _fail(f"{issue} is not a calendar issue date") + if issue > today: + _fail(f"{issue} is in the future: a report is issued on or after its date") + period = cal.period(issue) + i = cal.issues.index(issue) + prev_issue = cal.issues[i - 1] if i else None + kind = {"kind": "issued", "issueDate": issue.isoformat(), "issuedAt": now.isoformat(), + "late": today > issue, + "statement": "Frozen at issue: this file is never rewritten. Its sha256 is in ocr-issues.json."} + ref = issue or today + review_issue = issue or (cal.issued(today)[-1] if cal.issued(today) else cal.issues[0]) + changes, transformative = scn_changes(scn_rows, period) + feedback_on = feedback_summary(feedback, prev_issue) + doc = { + "$schema": fs.stamp("ocr"), + "certificationPackageOverviewUri": fs.CPO_URI, + "reportPeriod": {"from": period[0].isoformat(), "to": period[1].isoformat()}, + "certificationDataChanges": changes, + "plannedCertificationDataChanges": planned_changes(decisions, period), + "acceptedVulnerabilities": accepted_summary(vdr, period), + "transformativeChanges": transformative, + "updatedRecommendations": [ + "No new recommendations this period. The secure configuration guidance remains current: " + f"{off.get('secure_configuration_guidance_url')}"], + "activeAgencies": [], + "reportableIncidents": {"incidents": reportable_incidents(incidents, period)}, + "metadata": {}, + "providerExtensions": { + "fedRampId": off["fedramp_id"], + "class": prof.get("fedramp_class"), + "impact_level": prof.get("impact_level"), + "ksi_signal_id": (signal or {}).get("signal_id"), + "report": kind, + "continuousMonitoring": _ccm.dates_summary(cal, ref), + "activeAgenciesStatement": "No agency uses this offering: it is an unsponsored proof of concept.", + "incidentRegister": ("data/incidents.json" if incidents is not None else + "No incident register in this build; the list above is empty because no " + "FedRAMP Reportable Incident has been recorded."), + "feedback": {"channel": _ccm.feedback_url(ref if issue else review_issue), + "howDelivered": "A public GitHub issue form per report. The operator answers there and " + "publishes an anonymized summary of the questions and answers in the next " + f"report ({FEEDBACK_DECISION}). Sensitive questions go to the security " + "contact in /.well-known/security.txt.", + "summaryOfPreviousReport": feedback_on}, + "quarterlyReview": {"date": cal.review_date(review_issue).isoformat(), + "start": cal.review_start(review_issue).isoformat(), + "durationMinutes": cal.duration, + "calendar": _ccm.ICS_URL, "registration": _ccm.REGISTRATION_URL, + "hostedBy": f"The operator hosts it by video call ({REVIEW_DECISION}).", + "agenda": STANDING_AGENDA}, + "publicRelease": {"decision": PUBLIC_RELEASE_DECISION, + "statement": "Published in full: it carries no federal customer or agency data and " + "passed the sensitivity screen below, so releasing it will not likely " + "have an adverse effect on the offering (CCM-OCR-RPS)."}, + }, + } + doc["providerExtensions"]["sensitivityScreen"] = _sensitivity.require_clean(doc, "the Ongoing Certification Report") + return _offering.stamp_version(doc, prev, now, "Automated: scripts/build-ocr.py, from the CCM calendar, the " + "SCN, decision, incident and feedback registers and the VDR report") + + +def main(argv=None): ap = argparse.ArgumentParser() ap.add_argument("--vdr", default="vdr-report.json") ap.add_argument("--decisions", default="../data/decisions.json") ap.add_argument("--scn-register", default="../docs/scn/scn-register.csv") ap.add_argument("--ksi-signal", default="ksi-signal.json") + ap.add_argument("--profile", default=str(REPO / "data" / "system-profile.json")) + ap.add_argument("--offering", default=str(_offering.OFFERING_PATH)) + ap.add_argument("--calendar", default=str(_ccm.CALENDAR_PATH)) + ap.add_argument("--incidents", default=str(INCIDENTS_PATH)) + ap.add_argument("--feedback", default=str(FEEDBACK_PATH)) + ap.add_argument("--previous", default=None, help="the previously published rolling report (for its version)") + ap.add_argument("--issue", default=None, help="build the frozen report for this calendar issue date") ap.add_argument("--output", default="ongoing-certification-report.json") ap.add_argument("--md-output", default="ongoing-certification-report.md") - a = ap.parse_args() + a = ap.parse_args(argv) now = datetime.now(timezone.utc) - vdr = _load_json(a.vdr) - decisions = _decisions.load(a.decisions) - sig = _load_json(a.ksi_signal) - signal_id = sig.get("signal_id") if sig else None - scn_rows = _scn_rows(a.scn_register) - - report = build_ocr(vdr, decisions, scn_rows, signal_id, now) - Path(a.output).write_text(json.dumps(report, indent=2) + "\n") + today = now.date() + cal = _ccm.load(a.calendar, today) + prev = _load_json(a.previous) or {} + issue = date.fromisoformat(a.issue) if a.issue else None + doc = build(cal, today, _load_json(a.vdr), _decisions.load(a.decisions), _scn_rows(a.scn_register), + _load_json(a.incidents), load_feedback(a.feedback), _load_json(a.ksi_signal), + json.loads(Path(a.profile).read_text()), _offering.load(a.offering), prev, now, issue) + fs.write_validated(doc, "ocr", a.output) if a.md_output: - Path(a.md_output).write_text(render_markdown(report) + "\n") - print(f"ongoing-certification-report: {len(report['summaries']['changes_to_certification_data'])} cert changes, " - f"{len(report['summaries']['planned_changes_next_quarter'])} planned, " - f"{len(report['summaries']['accepted_vulnerabilities'])} accepted vulns; " - f"next report {report['next_ongoing_certification_report_date']}") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + cm = doc["providerExtensions"]["continuousMonitoring"] + print(f"ongoing-certification-report ({doc['providerExtensions']['report']['kind']}) " + f"{doc['reportPeriod']['from']}..{doc['reportPeriod']['to']}: " + f"{len(doc['certificationDataChanges'])} changes, " + f"{len(doc['reportableIncidents']['incidents'])} incidents; next report " + f"{cm['nextOngoingCertificationReportDate']}, next review {cm['nextQuarterlyReviewDate']}") return 0 +# --- human-readable view (same data as the JSON) -------------------------------------- + +def render_markdown(r): + pe, m = r["providerExtensions"], r["metadata"] + cm, qr, fb = pe["continuousMonitoring"], pe["quarterlyReview"], pe["feedback"] + rep = pe["report"] + title = (f"Ongoing Certification Report, issued {rep['issueDate']}" if rep["kind"] == "issued" + else "Ongoing Certification Report (since the latest issue)") + out = [f"# {title}", "", + f"- **FedRAMP ID:** {pe['fedRampId']} (simulated)", + f"- **Class:** {pe['class']} | **Reporting period:** {r['reportPeriod']['from']} to {r['reportPeriod']['to']}", + f"- **Version:** {m['version']} | **Last updated:** {m['lastUpdated']}", + f"- **Bound to inventory signal:** `{pe['ksi_signal_id']}`", + f"- **Next Ongoing Certification Report (CCM-OCR-NRD):** {cm['nextOngoingCertificationReportDate']}", + f"- **Next Quarterly Review (CCM-QTR-NRD):** {cm['nextQuarterlyReviewDate']}", + f"- **Questions or feedback on this report:** {fb['channel']}", "", + f"> {rep['statement']}", ""] + + def section(n, t, lines): + out.extend([f"## {n}. {t}", "", *(lines or ["_None this period._"]), ""]) + + section(1, "Changes to certification data", [f"- {c}" for c in r["certificationDataChanges"]]) + pc = r["plannedCertificationDataChanges"] + section(2, f"Planned changes through {pc['planningHorizonThrough']}", [f"- {c}" for c in pc["changes"]]) + section(3, "Accepted vulnerabilities", [r["acceptedVulnerabilities"]]) + section(4, "Transformative changes", [f"- {c}" for c in r["transformativeChanges"]]) + section(5, "Updated recommendations", [f"- {c}" for c in r["updatedRecommendations"]]) + section(6, "Agencies using the offering", [f"- {a}" for a in r["activeAgencies"]] or + [pe["activeAgenciesStatement"]]) + inc = r["reportableIncidents"]["incidents"] + section(7, "FedRAMP Reportable Incidents", + [f"- {i['summary']} (occurred {i['occurredAt']}" + + (f", resolved {i['resolvedAt']})" if i.get("resolvedAt") else ")") for i in inc] + or ["No FedRAMP Reportable Incident occurred in this period."]) + lessons = [f"- {x}" for i in inc for x in i.get("incidentLessonsLearned", [])] + section(8, "Lessons learned from incidents", lessons) + s = fb["summaryOfPreviousReport"] + out += ["## Feedback on the previous report (anonymized)", "", s["statement"], ""] + out += [f"- **Q:** {i['question']} \n **A:** {i['answer']}" for i in s.get("items", [])] + out += ["", f"## Quarterly Review: {qr['date']}", "", + f"{qr['hostedBy']} Starts {qr['start']}, {qr['durationMinutes']} minutes. Calendar file: " + f"{qr['calendar']}. Registration: {qr['registration']}.", "", "Agenda:", ""] + out += [f"{n}. {x}" for n, x in enumerate(qr["agenda"], 1)] + out += ["", "## Public release", "", f"{pe['publicRelease']['statement']} ({pe['publicRelease']['decision']}). " + f"Sensitivity screen: {', '.join(pe['sensitivityScreen']['checks'])}; " + f"{pe['sensitivityScreen']['findings']} findings.", "", + "---", "_Source of truth: the signed JSON. Rules: CCM-OCR-AVL, CCM-OCR-NRD, CCM-QTR-NRD._"] + return "\n".join(out) + + if __name__ == "__main__": sys.exit(main()) diff --git a/scripts/build-policy-index.py b/scripts/build-policy-index.py index 47bdb0b1..e78d9228 100644 --- a/scripts/build-policy-index.py +++ b/scripts/build-policy-index.py @@ -6,7 +6,10 @@ # and procedure, with seven fields each: name; file/page name; brief summary; # word count; current version; date of last update; related FedRAMP Practices. # This scans the repo's policy and procedure markdown and emits that index as -# JSON + human-readable markdown. Each entry's last-update date and version are the last commit that changed +# JSON + human-readable markdown, with every field in both, and (with +# --publish-dir) copies each document for publication under +# /.well-known/policies/. Related FedRAMP Practices are concrete rule and KSI IDs +# from the pinned rules and the KSI catalog, never free text. Each entry's last-update date and version are the last commit that changed # it; the build refuses a shallow clone, where every file looks changed today. # # build-policy-index.py # run from repo root @@ -19,24 +22,92 @@ import sys from pathlib import Path +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _offering # noqa: E402 + REPO = Path(__file__).resolve().parent.parent -# Family/topic -> related FedRAMP Practices, keyed by filename stem. -RELATED = { - "secure-configuration-guide": "SCG-CSO-*, SCG-ENH-*", - "cm-policy": "CM family; SCN-*, MAS-*, KSI-CMT", - "ir-policy": "IR family; IEC-CSO-*, VER-TFR-IRI, KSI-INR", - "ra-policy": "RA family; VDR-*, VER-*, KSI-MLA", - "sc-policy": "SC family; CMU-CSO-*, KSI-SVC", - "sr-policy": "SR family; KSI-SCR", - "continuous-monitoring-plan": "CCM-OCR-*, CCM-QTR-*", - "incident-response": "IR family; IEC-CSO-*", - "recovery-plan": "CP family; KSI-RPL", - "security-review": "CA family; KSI-PIY", - "supply-chain": "SR family; KSI-SCR", - "privacy-threshold-analysis": "PT family", - "rules-of-behavior": "PL-4, PS family", +SITE = "https://samaydlette.com/.well-known/policies/" +RULES_DIR = REPO / "infrastructure" / "schemas" / "fedramp-rules" +CATALOG = REPO / "infrastructure" / "schemas" / "ksi-catalog.json" + +# Procedures indexed beside the policies (CDS-CSO-IRP: "policies and procedures"). +PROCEDURES = ("docs/continuous-monitoring-plan.md", "docs/incident-response.md", "docs/recovery-plan.md", + "docs/security-review.md", "docs/supply-chain.md", "docs/privacy-threshold-analysis.md", + "docs/rules-of-behavior.md", "docs/verification.md", "docs/ksi-signal.md", + "docs/silk-reeling-deploy.md", "docs/architecture-decisions.md") +PROCEDURE_DIRS = ("docs/procedures", "docs/runbooks") + +# Related FedRAMP Practices, by document: prefixes of FedRAMP rule IDs and KSI +# IDs, expanded against the pinned rules and the KSI catalog (a prefix that +# matches nothing fails the build). An "-policy" also gets every applicable +# rule and every KSI mapped to a control in its NIST family. +PRACTICES = { + "secure-configuration-guide": ("SCG-",), + "resource-tagging-standard": ("MAS-CSO-IIR", "MAS-CSO-FLO"), + "cm-policy": ("SCN-", "KSI-CMT-"), + "ir-policy": ("IEC-", "KSI-INR-"), + "ra-policy": ("VDR-", "VER-"), + "sc-policy": ("CMU-",), + "ca-policy": ("IVV-", "CCM-"), + "continuous-monitoring-plan": ("CCM-", "KSI-MLA-"), + "incident-response": ("IEC-", "KSI-INR-"), + "recovery-plan": ("KSI-RPL-",), + "security-review": ("KSI-PIY-", "CCM-QTR-"), + "supply-chain": ("KSI-SCR-", "MAS-CSO-TPR"), + "privacy-threshold-analysis": ("MAS-CSO-MDI",), + "rules-of-behavior": ("KSI-CED-",), + "verification": ("IVV-CSO-STE", "CDS-TRC-PAC", "SDR-CSO-"), + "ksi-signal": ("FRC-CSX-", "MAS-CSO-IIR"), + "silk-reeling-deploy": ("KSI-CMT-",), + "architecture-decisions": ("SCN-CSO-", "KSI-CMT-"), + "agency-access": ("CDS-TRC-AAI", "CDS-TRC-SSM", "CDS-UTC-"), + "information-sharing": ("CDS-CSO-RIS", "CDS-CSO-RPS"), + "evidence-sla-alarm": ("KSI-MLA-", "CDS-CSO-AVR"), + "vuln-gate-failure": ("VDR-", "KSI-SVC-VRI"), } +ACCESS = ("Every policy and procedure listed here is served as Markdown at its url (no authentication), and its " + "source is the file in the public repository. This index is published as JSON (policy-index.json, signed) " + "and Markdown (policy-index.md) and listed in the trust manifest (trust-manifest.json).") + + +def practice_ids(rules_dir=RULES_DIR, catalog_path=CATALOG): + """(sorted rule and KSI IDs, {NIST family: [IDs]}) from the pinned rules and the catalog.""" + sys.path.insert(0, str(Path(__file__).resolve().parent)) + import _rules # noqa: E402 + + rules, _ = _rules.load_rules(rules_dir) + applicable = _rules.applicable_provider_rules(rules_dir) + by_family = {} + + def walk(o): + if isinstance(o, dict): + for k, v in o.items(): + if k in applicable and isinstance(v, dict): + for c in v.get("controls") or []: + by_family.setdefault(c.split("-")[0], set()).add(k) + walk(v) + walk(rules.get("FRR", {})) + catalog = json.loads(Path(catalog_path).read_text()) + ksis = set() + for fam in catalog["KSI"].values(): + for ind in fam["indicators"]: + ksis.add(ind["id"]) + for c in ind.get("controls", []): + by_family.setdefault(c["control_id"].split("-")[0], set()).add(ind["id"]) + return sorted(set(applicable) | ksis), {f: sorted(v) for f, v in by_family.items()} + + +def related(stem, ids, by_family): + out = set() + for prefix in PRACTICES.get(stem, ()): + hit = [i for i in ids if i.startswith(prefix)] + if not hit: + sys.exit(f"build-policy-index: {stem}: {prefix!r} matches no FedRAMP rule or KSI") + out.update(hit) + if stem.endswith("-policy"): + out.update(by_family.get(stem.split("-")[0], [])) + return sorted(out) def _is_shallow(): @@ -77,61 +148,82 @@ def _name(text, stem): return stem.replace("-", " ").title() -def index_file(rel): +def index_file(rel, ids, by_family): path = REPO / rel text = path.read_text() stem = path.stem words = len(re.findall(r"\S+", text)) date, commit = _last_change(path) - related = RELATED.get(stem) or (f"{stem.split('-')[0].upper()} family" - if stem.endswith("-policy") else "general") return { "name": _name(text, stem), + "kind": "policy" if rel.startswith("docs/policies/") else "procedure", "file": rel, + "url": SITE + path.name, "summary": _summary(text), "word_count": words, "version": f"git:{commit[:12]}", "last_updated": date, - "related_practices": related, + "related_practices": related(stem, ids, by_family), } +def documents(): + files = sorted(str(p.relative_to(REPO)) for p in (REPO / "docs" / "policies").glob("*.md") + if p.name != "README.md") + files += [f for f in PROCEDURES if (REPO / f).exists()] + for d in PROCEDURE_DIRS: + files += sorted(str(p.relative_to(REPO)) for p in (REPO / d).glob("*.md") if p.name != "README.md") + names = [Path(f).name for f in files] + dup = sorted({n for n in names if names.count(n) > 1}) + if dup: + sys.exit(f"build-policy-index: two documents would publish as {dup}") + return files + + +def render_markdown(index): + out = ["# Policy and Procedure Index", "", + f"Machine- and human-readable index of {index['count']} policies and procedures " + "(CDS-CSO-IRP). Source of truth: the JSON alongside this file.", "", + f"**How to access them:** {index['access']}", ""] + for e in index["entries"]: + out += [f"## {e['name']}", "", + f"- **Kind:** {e['kind']} | **File:** [`{e['file']}`]({e['url']}) | **Words:** {e['word_count']}", + f"- **Version:** `{e['version']}` | **Last updated:** {e['last_updated']}", + f"- **Summary:** {e['summary']}", + f"- **Related FedRAMP Practices:** {', '.join(e['related_practices']) or 'none'}", ""] + return "\n".join(out) + + def main(): ap = argparse.ArgumentParser() ap.add_argument("--output", default="policy-index.json") ap.add_argument("--md-output", default="policy-index.md") + ap.add_argument("--publish-dir", default=None, help="copy every indexed document here for publication") a = ap.parse_args() if _is_shallow(): sys.exit("build-policy-index: shallow clone; the last-update dates need full history " "(actions/checkout fetch-depth: 0)") - files = sorted(str(p.relative_to(REPO)) for p in (REPO / "docs" / "policies").glob("*.md") - if p.name != "README.md") - for extra in ("docs/continuous-monitoring-plan.md", "docs/incident-response.md", - "docs/recovery-plan.md", "docs/security-review.md", "docs/supply-chain.md", - "docs/privacy-threshold-analysis.md", "docs/rules-of-behavior.md"): - if (REPO / extra).exists(): - files.append(extra) - - entries = [index_file(f) for f in files] + ids, by_family = practice_ids() + entries = [index_file(f, ids, by_family) for f in documents()] index = { "index_type": "policy-and-procedure-index", + "fedRampId": _offering.fedramp_id(), "rule": "CDS-CSO-IRP", + "access": ACCESS, "count": len(entries), "entries": entries, } Path(a.output).write_text(json.dumps(index, indent=2) + "\n") if a.md_output: - out = ["# Policy and Procedure Index", "", - f"Machine- and human-readable index of {len(entries)} policies and procedures " - "(CDS-CSO-IRP). Source of truth: the JSON alongside this file.", "", - "| Policy | File | Words | Last updated | Related Practices |", - "|---|---|---|---|---|"] + Path(a.md_output).write_text(render_markdown(index) + "\n") + if a.publish_dir: + # The documents themselves, served beside the index (CDS-CSO-IRP: supplied + # in the certification data, not only in the repository). + dest = Path(a.publish_dir) + dest.mkdir(parents=True, exist_ok=True) for e in entries: - out.append("| {n} | `{f}` | {w} | {u} | {r} |".format( - n=e["name"], f=e["file"], w=e["word_count"], - u=e["last_updated"], r=e["related_practices"])) - Path(a.md_output).write_text("\n".join(out) + "\n") + (dest / Path(e["file"]).name).write_bytes((REPO / e["file"]).read_bytes()) print(f"policy-index: {len(entries)} policies indexed") return 0 diff --git a/scripts/build-scg.py b/scripts/build-scg.py new file mode 100644 index 00000000..4bd96fa9 --- /dev/null +++ b/scripts/build-scg.py @@ -0,0 +1,286 @@ +#!/usr/bin/env python3 +"""The Secure Configuration Guide and the cryptographic module list. + +Publishes /.well-known/secure-configuration-guide.json and .md from one source, +data/secure-configuration.json (SCG-CSO-RSC, SCG-CSO-PUB, SCG-CSO-AUP, +SCG-ENH-MRG, SCG-ENH-API, SCG-ENH-VRH), joined with the per-service +cryptographic module list in data/crypto-modules.json and the deploy's +inventory (CMU-CSO-CMD, CMU-CSO-UVM, CMU-CSO-CAT). + +Fails closed, before anything is written, when: + * the recommended defaults changed without a new version and a changelog + entry carrying their new digest (SCG-ENH-VRH); + * a setting names an unknown account, or cites a decision that is not in force; + * the inventory holds a component type that is neither mapped to a + cryptographic module nor declared as using no cryptography (CMU-CSO-CMD); + * the guide names a retired mechanism (the old shared app credential, the + deployer access key, Duo-enforced root MFA). + + build-scg.py --ksi-signal ksi-signal.json --output secure-configuration-guide.json \ + --md-output secure-configuration-guide.md +""" + +import argparse +import hashlib +import json +import re +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _decisions # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +SOURCE = REPO / "data" / "secure-configuration.json" +CRYPTO = REPO / "data" / "crypto-modules.json" +SITE = "https://samaydlette.com/.well-known/" +SEMVER = re.compile(r"^(\d+)\.(\d+)\.(\d+)$") +LEVELS = ("top-level", "privileged") +# Mechanisms this system no longer has. A guide that still describes one is +# wrong about the system, so the build stops (the 2026-11-05 assessment found +# the prose guide describing all three). +RETIRED = ( + (re.compile(r"basic[ -]auth", re.I), "the retired Silk Reeling shared (Basic Auth) credential"), + (re.compile(r"deployer (IAM )?user|AWS_ACCESS_KEY_ID|AWS_SECRET_ACCESS_KEY", re.I), "the retired deployer access key"), + (re.compile(r"(enforced|MFA) via Duo", re.I), "Duo-enforced root MFA (root uses virtual TOTP, DEC-150)"), +) + + +def _fail(msg): + raise SystemExit(f"::error::secure configuration guide: {msg} (fail-closed)") + + +def defaults_digest(src): + """sha256 over what a release fixes: each setting's account, recommended + value, check and accepted deviation. Wording changes don't move it.""" + body = sorted(({"id": s["id"], "account": s["account"], "recommended": s["recommended"], + "check": s["check"], "accepted_deviation": s.get("accepted_deviation")} + for s in src["settings"]), key=lambda s: s["id"]) + return hashlib.sha256(json.dumps(body, sort_keys=True, separators=(",", ":")).encode()).hexdigest() + + +def _semver(v, where): + m = SEMVER.match(v or "") + if not m: + _fail(f"{where}: version {v!r} is not MAJOR.MINOR.PATCH") + return tuple(int(x) for x in m.groups()) + + +def validate_source(src, in_force_ids): + if not isinstance(src, dict) or src.get("schema") != "secure-configuration/1": + _fail("the source is not a secure-configuration/1 document") + for k in ("title", "version", "obtain_and_use", "accounts", "settings", "changelog"): + if not src.get(k): + _fail(f"the source has no {k}") + accounts = {} + for a in src["accounts"]: + for k in ("id", "level", "name", "how_named", "access", "configure", "operate", "decommission"): + if not isinstance(a.get(k), str) or not a[k].strip(): + _fail(f"account {a.get('id')!r} has no {k}") + if a["level"] not in LEVELS: + _fail(f"account {a['id']}: level must be one of {LEVELS}") + accounts[a["id"]] = a + if not any(a["level"] == "top-level" for a in accounts.values()): + _fail("no top-level administrative account is described") + seen, checks = set(), set() + for s in src["settings"]: + sid = s.get("id") + for k in ("id", "account", "operable_by", "setting", "implication", "read", "change", "check"): + if not isinstance(s.get(k), str) or not s[k].strip(): + _fail(f"setting {sid!r} has no {k}") + if "recommended" not in s: + _fail(f"setting {sid} has no recommended value") + if sid in seen: + _fail(f"setting {sid} appears twice") + seen.add(sid) + if s["account"] not in accounts: + _fail(f"setting {sid} names unknown account {s['account']!r}") + if s["check"] == "attested": + if s.get("attested_by") not in in_force_ids: + _fail(f"setting {sid} is attested but cites no in-force decision") + elif s["check"] in checks: + _fail(f"check {s['check']} is used by two settings") + checks.add(s["check"]) + dev = s.get("accepted_deviation") + if dev is not None and dev not in in_force_ids: + _fail(f"setting {sid} cites {dev!r} as its accepted deviation, which is not an in-force decision") + # SCG-ENH-VRH: versioned, with a release history of the defaults. + prev = None + for entry in src["changelog"]: + v = _semver(entry.get("version"), "changelog") + if prev is not None and v <= prev: + _fail("changelog versions must increase") + if not entry.get("date") or not entry.get("changes"): + _fail(f"changelog {entry.get('version')} has no date or changes") + prev = v + latest = src["changelog"][-1] + if latest["version"] != src["version"]: + _fail(f"version {src['version']} has no changelog entry (latest is {latest['version']})") + digest = defaults_digest(src) + if latest.get("defaults_sha256") != digest: + _fail(f"the recommended defaults changed since version {src['version']} was released: bump the version " + f"and add a changelog entry with defaults_sha256 {digest}") + return src + + +def module_list(crypto, signal): + """Per-service module list joined with the inventory's component types. + Fails on a type that is neither mapped nor declared cryptography-free.""" + modules = crypto["modules"] + by_type = {} + for svc in crypto["services"]: + if svc["module"] not in modules: + _fail(f"{svc['service']}: unknown module {svc['module']!r}") + for t in svc["types"]: + if t in by_type: + _fail(f"component type {t} is mapped twice") + by_type[t] = svc + none = set(crypto["no_cryptography"]["types"]) + if none & set(by_type): + _fail(f"types both mapped and declared cryptography-free: {sorted(none & set(by_type))}") + counts = {} + for c in signal.get("components", []): + counts[c.get("type")] = counts.get(c.get("type"), 0) + 1 + unmapped = sorted(t for t in counts if t not in by_type and t not in none) + if unmapped: + _fail(f"the inventory has component type(s) with no cryptographic module mapping: {', '.join(map(str, unmapped))}. " + "Map each in data/crypto-modules.json (or declare it cryptography-free)") + out = [] + for svc in crypto["services"]: + m = modules[svc["module"]] + out.append({"service": svc["service"], "protects": svc["protects"], "configuration": svc["configuration"], + "protects_customer_data": svc["customer_data"], + "agency_tenant_default": svc.get("tenant_default"), + "components": sum(counts.get(t, 0) for t in svc["types"]), "component_types": svc["types"], + "module": m["name"], "cmvp_certificate": m["cmvp_certificate"], "standard": m["standard"], + "level": m["level"], "validation_status": m["status"], "source": m["source"], + "validated": m["cmvp_certificate"] is not None}) + return out + + +def build(src, crypto, signal, now): + doc = { + "schema": "secure-configuration-guide/1", + "title": src["title"], + "version": src["version"], + "emitted_at": now.isoformat(timespec="seconds"), + "ksi_signal_id": signal.get("signal_id"), + "source": "Generated by scripts/build-scg.py from data/secure-configuration.json and " + "data/crypto-modules.json, joined with this deploy's inventory.", + "human_readable": SITE + "secure-configuration-guide.md", + "machine_readable": SITE + "secure-configuration-guide.json", + "comparison": SITE + "security-settings.json", + "obtain_and_use": src["obtain_and_use"], + "accounts": src["accounts"], + "settings": src["settings"], + "release_history": src["changelog"], + "cryptographic_modules": { + "checked_on": crypto["checked_on"], + "services": module_list(crypto, signal), + "no_cryptography": crypto["no_cryptography"], + }, + } + text = json.dumps(doc) + "\n" + render_markdown(doc) + for pat, what in RETIRED: + if pat.search(text): + _fail(f"the guide names {what}") + return doc + + +def _value(v): + if isinstance(v, dict): + return "; ".join(f"{k} {_value(x)}" for k, x in v.items()) + if isinstance(v, list): + return ", ".join(map(str, v)) + if isinstance(v, bool): + return "yes" if v else "no" + if v is None: + return "—" + return str(v) + + +def _cell(text): + return str(text).replace("|", "\\|").replace("\n", " ") + + +def render_markdown(doc): + out = [f"# {doc['title']}", "", + f"- **Version:** {doc['version']} | **Generated:** {doc['emitted_at']}", + f"- **Machine-readable:** {doc['machine_readable']}", + f"- **Live comparison:** {doc['comparison']}", + f"- **Source:** {doc['source']}", "", "## How to obtain and use this guide", ""] + out += [f"- {line}" for line in doc["obtain_and_use"]] + out += ["", "## Accounts", ""] + for a in doc["accounts"]: + out += [f"### {a['name']} (`{a['id']}`, {a['level']})", "", + f"- **How it is named:** {a['how_named']}", f"- **Secure access:** {a['access']}", + f"- **Configure:** {a['configure']}", f"- **Operate:** {a['operate']}", + f"- **Decommission:** {a['decommission']}", ""] + out += ["## Security settings", "", + "| Setting | Account | Operable by | Recommended | Implication | Read | Change | Deviation |", + "|---|---|---|---|---|---|---|---|"] + for s in doc["settings"]: + dev = s.get("accepted_deviation") or (f"attested ({s['attested_by']})" if s.get("attested_by") else "—") + out.append(f"| `{s['id']}`: {_cell(s['setting'])} | {s['account']} | {_cell(s['operable_by'])} | " + f"{_cell(_value(s['recommended']))} | {_cell(s['implication'])} | {_cell(s['read'])} | " + f"{_cell(s['change'])} | {dev} |") + cm = doc["cryptographic_modules"] + out += ["", f"## Cryptographic modules per service (checked {cm['checked_on']})", "", + "| Service | Components | Module | CMVP certificate | Status | Protects customer data | " + "Agency-tenant default | Configuration |", "|---|---|---|---|---|---|---|---|"] + for m in cm["services"]: + cert = f"[#{m['cmvp_certificate']}]({m['source']})" if m["cmvp_certificate"] else "none" + out.append(f"| {_cell(m['service'])} | {m['components']} | {_cell(m['module'])} | {cert} | " + f"{_cell(m['validation_status'])} | {_value(m['protects_customer_data'])} | " + f"{_cell(_value(m['agency_tenant_default']))} | {_cell(m['configuration'])} |") + out += ["", f"Cryptography-free component types: {', '.join(cm['no_cryptography']['types'])}. " + f"{cm['no_cryptography']['why']}", "", "## Release history", ""] + for r in reversed(doc["release_history"]): + out.append(f"### {r['version']} ({r['date']})") + out += [f"- {c}" for c in r["changes"]] + out.append(f"- Defaults digest: `{r['defaults_sha256']}`") + out.append("") + out += ["---", "_Source of truth: the signed `secure-configuration-guide.json`._"] + return "\n".join(out) + + +def load(source=SOURCE, decisions_path=None): + try: + src = json.loads(Path(source).read_text()) + except (OSError, json.JSONDecodeError) as exc: + _fail(f"cannot read {source}: {exc}") + reg = _decisions.load(decisions_path) + return validate_source(src, {r["id"] for r in _decisions.in_force(reg)}) + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--source", default=str(SOURCE)) + ap.add_argument("--crypto", default=str(CRYPTO)) + ap.add_argument("--decisions", default=None) + ap.add_argument("--ksi-signal", default="ksi-signal.json") + ap.add_argument("--output", default="secure-configuration-guide.json") + ap.add_argument("--md-output", default="secure-configuration-guide.md") + ap.add_argument("--print-digest", action="store_true", help="print the defaults digest and exit") + a = ap.parse_args(argv) + if a.print_digest: + print(defaults_digest(json.loads(Path(a.source).read_text()))) + return 0 + src = load(a.source, a.decisions) + try: + crypto = json.loads(Path(a.crypto).read_text()) + signal = json.loads(Path(a.ksi_signal).read_text()) + except (OSError, json.JSONDecodeError) as exc: + _fail(f"cannot read an input: {exc}") + doc = build(src, crypto, signal, datetime.now(timezone.utc)) + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + v = sum(1 for m in doc["cryptographic_modules"]["services"] if m["validated"]) + print(f"secure-configuration-guide {doc['version']}: {len(doc['settings'])} settings, " + f"{len(doc['cryptographic_modules']['services'])} services ({v} on a CMVP-validated module)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/build-sdr.py b/scripts/build-sdr.py index 70dc500b..c60dadfe 100644 --- a/scripts/build-sdr.py +++ b/scripts/build-sdr.py @@ -1,272 +1,648 @@ #!/usr/bin/env python3 # ============================================================================= -# SECURITY DECISION RECORD BUILDER (CR26 SDR — the 20x SSP replacement) +# SECURITY DECISION RECORD BUILDER (CR26 SDR, FedRAMP's 2026-06-24 schema) # ============================================================================= -# CR26 replaces the traditional System Security Plan with a persistently -# maintained Security Decision Record (SDR-CSO-FRR): for each applicable FedRAMP -# rule, an explanation of how it is followed, plus verification, validation, -# independent verification, independent validation, responses to assessor -# comments, and rule-specific artifacts. SDR-CSO-MTD carries version + last -# update + source; the 20x extension SDR-CSX-KSI carries per-KSI summaries, and -# SDR-CSX-KMT (Class C) carries metric summaries over 30 days / up to a year / -# all daily metric data. +# The SDR says, for this 20x Class C offering: # -# It carries both views CR26 defines over the same rule families: per KSI -# (SDR-CSX-KSI, the 20x record) and per applicable Rev5 control (SDR-CSF-CTF, -# the Rev5 record, in rev5_controls). Both come from the control projection -# (scripts/_controls.py) computed from the canonical inventory and the KSI -# catalog, so they cannot disagree. The OSCAL SSP that used to carry the -# per-control statements is retired (CR26); this record replaces it. +# fedRampRequirements every applicable FedRAMP rule (SDR-CSO-FRR), from the +# governed records in data/frr-records.json, which +# scripts/_frr.py holds to the pinned rules and to +# evidence that resolves; +# keySecurityIndicators every KSI (SDR-CSX-KSI): its measures (the OPA rules +# annotated with it), the automated methods that verify +# it (the deploy-time plan gate and the signed runtime +# re-validation), tests and evidence; +# securityControls every NIST 800-53 Rev5 control in the FedRAMP Moderate +# baseline, plus the controls FedRAMP's KSIs map beyond +# it: how 20x meets each Rev5 objective. A control's +# status is no stronger than what backs it. +# +# The record is 20x. The control view explains how the Rev5 objectives are met +# by the 20x evidence; it is not a second certification claim. +# +# Status rules for a control (the honesty rule, applied to Rev5): +# Implemented inherited from AWS (its FedRAMP authorization), or +# backed by a KSI whose measures are checked +# automatically, or by an implemented FedRAMP rule, or, +# for a policy-and-procedure control (XX-1), the +# family's published policy; +# (no status) not applicable, with the reason; +# Partially Implemented everything else the projection calls implemented: +# the mechanism is described but nothing checks it yet. +# +# Validated against the vendored schema before it is written; nothing that +# fails is written. Site-specific data is under providerExtensions. # # build-sdr.py --catalog schemas/ksi-catalog.json --ksi-signal ksi-signal.json \ -# --vdr vdr-report.json --previous-sdr prev.json +# --runtime-signal ksi-signal-runtime.json --vdr vdr-report.json --previous-sdr prev.json # ============================================================================= import argparse +import hashlib +import importlib.util import json import os +import re +import subprocess import sys from datetime import datetime, timezone from pathlib import Path -# Shared generator helpers. The insert is __file__-relative, so this script stays -# runnable standalone from any working directory (see scripts/_common.py). sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -from _common import prop # noqa: E402 import _assessor # noqa: E402 import _controls # noqa: E402 +import _decisions # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _freshness # noqa: E402 +import _frr # noqa: E402 +import _offering # noqa: E402 +import _rules # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +MODERATE_PROFILE = REPO / "data" / "profiles" / "FedRAMP_rev5_MODERATE-baseline_profile.json" +POLICY_DIR = REPO / "infrastructure" / "policy" +POLICIES = REPO / "docs" / "policies" +SITE = "https://samaydlette.com" +REPO_URL = "https://github.com/sam-aydlette/samaydlette.com/blob/main" +HISTORY_DAYS = 366 # SDR-CSX-KMT: daily metric data up to the past year +SEMVER = re.compile(r"^(\d+)\.(\d+)\.(\d+)$") + +NO_ASSESSMENT = ("No independent assessment: no FedRAMP Recognized assessment service is engaged. " + "The provider-side verification and validation above is what an assessor would examine.") +WORKSTREAMS = { + "W2": "vulnerability report follow-ups", "W3": "certification package in FedRAMP's schemas", + "W4": "quarterly reporting cycle", "W5": "significant change notifications", + "W6": "incident reporting", "W7": "detection and evaluation", "W8": "trust center", + "W9": "FedRAMP Security Inbox", "W10": "scope, cryptography and secure configuration", + "sam": "an act of the operator (registration, assessor, application)", +} +EVIDENCE_WORDS = {"test": "test", "step": "pipeline step", "artifact": "published artifact", + "decision": "decision record"} + + +def _fail(msg): + raise SystemExit(f"::error::SDR: {msg} (fail-closed)") + + +# --- inputs --------------------------------------------------------------------------- + +def moderate_ids(path=MODERATE_PROFILE): + prof = json.loads(Path(path).read_text())["profile"] + return {i for imp in prof["imports"] for inc in imp.get("include-controls", []) for i in inc.get("with-ids", [])} + + +def policy_rules(policy_dir=POLICY_DIR): + """{KSI ID: [{"id", "title", "file"}]} from the OPA rule annotations + (custom.ksi_ids), read with `opa inspect` like check-policy-annotations.""" + out = subprocess.run(["opa", "inspect", "-a", str(policy_dir), "--format", "json"], + capture_output=True, text=True, check=True) + by_ksi = {} + for entry in json.loads(out.stdout).get("annotations", []) or []: + ann = entry.get("annotations") or {} + custom = ann.get("custom") or {} + if ann.get("scope") != "rule" or not custom.get("id"): + continue + f = Path((entry.get("location") or {}).get("file", "?")).name + for k in custom.get("ksi_ids") or []: + by_ksi.setdefault(k, []).append({"id": custom["id"], "title": ann.get("title", ""), "file": f}) + for rules in by_ksi.values(): + rules.sort(key=lambda r: (r["file"], r["id"])) + return by_ksi + + +def runtime_validations(path): + """Validations from the signed runtime signal, only when it verifies and is + fresh (the VDR builder's own loader); otherwise none, with the reason.""" + spec = importlib.util.spec_from_file_location("vdr_builder", REPO / "scripts" / "build-vdr-report.py") + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + rt = mod.load_runtime_signal(path) + if not (rt["verified"] and rt["fresh"]): + return [], rt["reason"] or "runtime signal not usable" + return rt["validations"], None + + +# --- FedRAMP rules -------------------------------------------------------------------- + +def _evidence_line(ev): + return f"{EVIDENCE_WORDS[ev['kind']]} `{ev['ref']}`" + + +def evidence_context(freshness_path=None, decisions_path=None): + """What a rule's evidence lines say about cycle and authority: the freshness + entry of each published artifact and the in-force decision records.""" + cfg = _freshness.load_freshness_config(freshness_path) + decs = _decisions.in_force(_decisions.load(decisions_path or REPO / "data" / "decisions.json")) + return {"artifacts": {a["path"]: a for a in cfg["artifacts"]}, "decisions": {d["id"]: d for d in decs}} + + +def _evidence_validation(ev, ctx): + """IVV-CSO-SEI/SEE: what one piece of evidence verifies, and on what cycle.""" + kind, ref = ev["kind"], ev["ref"] + if kind == "test": + return (f"Verified by the test `{ref}`, run on every pull request and before every deploy " + "(the deploy's unit-test job); the deploy does not proceed if it fails.") + if kind == "step": + return (f"Exercised by the workflow step `{ref}` each time that workflow runs; the run fails if the " + "step does.") + if kind == "artifact": + a = (ctx or {}).get("artifacts", {}).get(ref) + cyc = (f", refreshed on its {a['cadence']} cadence and alarmed past {a['max_age_hours']} hours by the " + "evidence watchdog") if a else "" + return f"Shown by the published artifact `{ref}`{' (signed)' if a and a.get('signed') else ''}{cyc}." + d = (ctx or {}).get("decisions", {}).get(ref) + when = f", decided by {d.get('decided_by')} on {d.get('decided_on')}, review by {d.get('review_by')}" if d else "" + return f"Attested by the decision record {ref}{when}: {d.get('title') if d else 'in force'}." -HISTORY_DAYS = 366 # SDR-CSX-KMT: all daily metric data up to the past year - -NA = "N/A — self-attested proof of concept; no FedRAMP Recognized independent assessment service engaged (IVV is not applicable to an unsponsored system)." - - -def _control_map(irs): - """control_id -> {status, origination} from the control projection.""" - m = {} - for ir in irs: - m[ir["control-id"]] = {"status": prop(ir, "implementation-status"), - "origination": prop(ir, "control-origination")} - return m - - -def build_records(catalog, cmap): - """One SDR-CSO-FRR record per in-scope KSI, derived from its controls' projected state.""" - records = [] - for fam in catalog.get("KSI", {}).values(): - for ind in fam.get("indicators", []) or []: - if ind.get("retired"): - continue - controls = [] - impl = inh = na = 0 - for c in ind.get("controls", []) or []: - cid = c.get("control_id") - st = cmap.get(cid, {}) - controls.append({"control_id": cid, "status": st.get("status"), - "origination": st.get("origination")}) - o = st.get("origination") - if st.get("status") == "not-applicable": - na += 1 - elif o == "inherited" or o == "shared": - inh += 1 - else: - impl += 1 - if controls: - expl = (f"Satisfied through {len(controls)} NIST 800-53 control(s) " - f"({impl} system-implemented, {inh} inherited/shared, {na} not-applicable); " - f"see rev5_controls in this record for each control's implementation statement.") - else: - expl = ("Process/organizational indicator with no direct 800-53 control mapping; " - "satisfied at the operator level and documented in the linked policy.") - records.append({ - "rule_id": ind["id"], - "statement": ind.get("statement", ""), - "controls": controls, - "explanation": expl, - "verification": ("Automated: the deploy-time OPA gate and the per-deploy KSI signal " - "record the implementing controls; the daily runtime emitter " - "re-validates the live configuration against the same compiled policy."), - "validation": ("Effectiveness reviewed continuously by the daily runtime revalidation " - "(drift detector) and annually by the structural security review."), - "independent_verification": NA, - "independent_validation": NA, - "assessor_comment_responses": [], - "artifacts": ["/.well-known/ksi-signal.json", "/.well-known/security-decision-record.json"], - }) - return records - - -# CR26 implementation-status vocabulary (SDR-CSF-CTF) for the projection's -# OSCAL tokens. -REV5_STATUS = {"implemented": "Implemented", "partial": "Partially Implemented", "planned": "Planned", - "alternative": "Alternative Implementation", "not-applicable": "Not Applicable"} - - -def build_rev5_controls(irs, catalog): - """SDR-CSF-CTF: a summary for each applicable Rev5 control: parameter values, - implementation status, the mechanisms (the projection's statement, including - any inheritance), verification, validation, independent verification and - validation, and control-specific artifacts. Verification and validation - point at the records of the KSIs that claim the control rather than - restating them; a control no KSI claims says so.""" - ksis_by_control, _ = _controls.contributing_ksis(catalog) + +def _assessment(rule_id, assessor_by_rule): + entries = assessor_by_rule.get(rule_id) or [] + if not entries: + return [NO_ASSESSMENT] + return [f"Assessor record {e['record_id']} ({e['kind']}): {e['text']}" for e in entries] + + +def build_requirements(records, applicable, assessor_by_rule, evidence_ctx=None): out = [] - for ir in irs: - cid = ir["control-id"] - status = prop(ir, "implementation-status") - origination = prop(ir, "control-origination") - ksis = sorted(ksis_by_control.get(cid, ())) - if status == "not-applicable": - verification = validation = "Not applicable." - elif origination == "inherited": - verification = validation = ("Inherited from AWS under its FedRAMP certification " - "(leveraged authorization); verified and validated there.") - elif ksis: - verification = validation = ("See the rule records (rule_records) of the contributing KSIs: " - + ", ".join(ksis) + ".") - else: - verification = ("No KSI claims this control; the statement is maintained in the control " - "projection (scripts/_controls.py, data/component-definitions/) and " - "reviewed with it.") - validation = "No automated validation." - remarks = [ir["statements"][0]["remarks"]] if ir.get("statements") else [] - live = prop(ir, "implementation-status-remarks") + for r in records["records"]: + rid, status = r["frr_id"], r["status"] + impl = [r["implementation"]] + if status == "Not Applicable": + impl.append(f"Not applicable: {r['not_applicable']}") + if r.get("may_rationale"): + impl.append(f"Use of this permission: {r['may_rationale']}") + val = [] + if r.get("evidence"): + val.append("Evidence: " + "; ".join(_evidence_line(e) for e in r["evidence"]) + ".") + val += [_evidence_validation(e, evidence_ctx) for e in r["evidence"]] + if r.get("simulated"): + val.append(f"Simulated counterparty ({r['simulated']['counterparty']}): {r['simulated']['how']}") + val.append("Checked on every build by scripts/_frr.py: the rule set matches the pinned FedRAMP " + "rules and every piece of evidence cited resolves.") + if r.get("gap"): + val.append(f"Gap: {r['gap']}") + val.append("Closes with: " + "; ".join(f"{c} ({WORKSTREAMS[c]})" for c in r["closes_with"]) + ".") + rec = {"frrID": rid} + if status != "Not Applicable": + rec["frrImplementationStatus"] = status + rec["frrImplementation"] = impl + rec["frrValidation"] = val + rec["frrAssessment"] = _assessment(rid, assessor_by_rule) + rec["providerExtensions"] = {"status": status, "force": applicable[rid]["force"], + "evidence": r.get("evidence", []), + "closesWith": r.get("closes_with", [])} + if r.get("simulated"): + rec["providerExtensions"]["simulated"] = r["simulated"] + out.append(rec) + return out + + +# --- KSIs ----------------------------------------------------------------------------- + +def ksi_status(k): + """Implemented only when the KSI passes and its measures are checked + automatically against the plan; a pass by inventory or document alone is + partial.""" + if k.get("status") != "pass": + return "Not Implemented" + if k.get("method") == "policy-validation" and (k.get("evidence") or {}).get("validation_ids"): + return "Implemented" + return "Partially Implemented" + + +def _names(items, n=6): + items = sorted(items) + return ", ".join(f"`{i}`" for i in items[:n]) + (f" and {len(items) - n} more" if len(items) > n else "") + + +def ksi_text(kid, cat, k, rules, comps, rt, runtime_reason, nval, nfail, plan_ok): + """SDR-CSX-KSI, written for this KSI from its own measures, components and + results: (implementation lines, validation lines) covering the measures and + their objective (or the reason there are none, and the risk), their cycle, + verification that they demonstrate the KSI and that the automation is + accurate, and validation that they are in place and working.""" + stmt = cat["statement"] + impl = [stmt] + if rules: + impl.append(f"Measures ({len(rules)}), each an OPA rule annotated with {kid}: " + + "; ".join(f"{r['title']} (`{r['file']}#{r['id']}`)" for r in rules) + + f". Objective: together they show that {stmt[0].lower() + stmt[1:]}") + impl.append(f"Cycle: on every deploy, before apply, against the Terraform plan for {len(comps)} " + f"component(s) ({_names(comps)})" + + (f"; and daily at runtime against the live configuration of {len(rt)} of them." if rt else ".")) + else: + impl.append(f"No automated measure is annotated with {kid} in this build. Evidence is " + f"{k.get('method')}" + (f" over {len(comps)} inventory component(s) ({_names(comps)})" if comps + else "") + ". Reason: no policy rule checks this KSI yet. Risk to " + "customers: a regression against the KSI would not stop a deploy and would surface only " + "when the inventory or the documentation is reviewed.") + impl.append("Cycle: the inventory behind it is re-derived from live state on every deploy; there is no " + "persistent check.") + val = [] + if rules: + files = sorted({r["file"] for r in rules}) + val.append(f"Verification that the measures demonstrate {kid}: each rule carries {kid} in its " + "custom.ksi_ids annotation, and scripts/check-policy-annotations.py fails CI when an " + "annotation and the KSI catalog disagree. Verification that the automation is accurate: " + f"the rules' own tests ({', '.join(f'infrastructure/policy/{f[:-5]}_test.rego' for f in files)}) " + "run with a coverage floor on every pull request, and the parity test checks that the CLI and " + "the compiled Wasm the runtime uses decide alike.") + if plan_ok: + val.append(f"Validation on this deploy: {nval} validation(s) of these measures against the plan, " + f"{nfail} failing; the deploy stops on a violation.") + if rt: + val.append(f"Re-validated daily at runtime: the signed runtime signal re-evaluates the same compiled " + f"policy against live configuration for {len(rt)} of these components.") + elif runtime_reason: + val.append(f"Runtime re-validation not counted for this build: {runtime_reason}.") + if not rules: + val.append(f"Verification: none automated for {kid}; the inventory attestation is checked only for " + "completeness by the reconciliation gate. The reason for having no measure is not accepted: no " + "decision record accepts it, so the KSI is reported at the status its evidence supports.") + val.append("Validation: there is no measure to validate as in place and working; the reason (no policy rule " + "yet) is valid for this build and is removed by annotating a rule with the KSI.") + return impl, val + + +def build_ksis(catalog, signal, rules_by_ksi, runtime, runtime_reason, assessor_by_rule): + statements = {i["id"]: i for f in catalog["KSI"].values() for i in f["indicators"]} + sig = {k["id"]: k for k in signal.get("ksis", [])} + missing = sorted(set(statements) - set(sig)) + if missing: + _fail(f"the KSI signal carries no result for {', '.join(missing)}") + emitted = (signal.get("emitted_at") or "")[:10] or None + out, status = [], {} + for kid in sorted(statements): + k, cat = sig[kid], statements[kid] + st = ksi_status(k) + status[kid] = st + ev = k.get("evidence") or {} + comps = set(ev.get("component_refs") or []) + rt = [v for v in runtime if comps & set(v.get("component_refs") or [])] + plan_ok = bool(ev.get("validation_ids")) + methods = int(plan_ok) + int(bool(rt)) + rules = rules_by_ksi.get(kid, []) + nval, nfail = len(ev.get("validation_ids") or []), len(ev.get("failed_validation_ids") or []) + impl, val = ksi_text(kid, cat, k, rules, comps, rt, runtime_reason, nval, nfail, plan_ok) + val.append(f"Automated methods in place: {methods} (FRC-CSX-VVK requires 2 for Class C).") + if st != "Implemented": + val.append("Status is not Implemented because " + + ("the KSI does not pass." if st == "Not Implemented" else + f"its evidence is {k.get('method')}, not an automated check of its measures.")) + evidence = [{"evidenceType": "Report", + "evidenceDescription": "Deploy-time KSI signal: inventory, validations and per-KSI results, " + "signed with cosign by the deploy workflow.", + "evidenceLocation": f"{SITE}/.well-known/ksi-signal.json", + **({"lastUpdated": emitted} if emitted else {})}] + if rt: + evidence.append({"evidenceType": "Report", + "evidenceDescription": "Runtime KSI signal: daily re-validation of live configuration, " + "signed with the runtime KMS key.", + "evidenceLocation": f"{SITE}/.well-known/ksi-signal-runtime.json"}) out.append({ - "control_id": cid, - "implementation_status": REV5_STATUS.get(status, status), - "origination": origination, - "parameters": [{"param_id": sp["param-id"], "values": sp.get("values", [])} - for sp in ir.get("set-parameters", [])], - "mechanisms": " ".join(remarks + ([live] if live else [])), - "contributing_ksis": ksis, - "verification": verification, - "validation": validation, - "independent_verification": NA, - "independent_validation": NA, - "assessor_comment_responses": [], - "artifacts": [lk["href"] for lk in ir.get("links", [])], + "ksiId": kid, + "ksiImplementationStatus": st, + "ksiImplementation": impl, + "ksiValidation": val, + "ksiAssessment": _assessment(kid, assessor_by_rule), + "ksiTests": [f"infrastructure/policy/{r['file']}#{r['id']}" for r in rules], + "ksiEvidence": evidence, + "providerExtensions": {"method": k.get("method"), "automatedMethods": methods, + "controls": [c["control_id"] for c in cat["controls"]], + "measures": [f"{r['file']}#{r['id']}" for r in rules], + "components": len(comps), "validations": nval, "failingValidations": nfail, + "runtimeComponents": len(rt)}, }) + return out, status + + +# --- controls ------------------------------------------------------------------------- + +def nist_id(cid): + """ac-2.1 -> AC-2(1).""" + base, _, enh = cid.partition(".") + return base.upper() + (f"({enh})" if enh else "") + + +def control_basis(ir, ksis_for, ksi_st, frrs_for, frr_st, policies): + """(status, or None when not applicable; the basis sentence).""" + cid = ir["control-id"] + st = _controls.prop(ir, "implementation-status") + orig = _controls.prop(ir, "control-origination") + if st == "not-applicable": + return None, "Not applicable." + if st == "partial": + return "Partially Implemented", "A contributing KSI is failing." + checked = sorted(k for k in ksis_for.get(cid, ()) if ksi_st.get(k) == "Implemented") + rules = sorted(r for r in frrs_for.get(cid, ()) if frr_st.get(r) == "Implemented") + fam = cid.split("-")[0] + if orig == "inherited": + return "Implemented", "Inherited from AWS under its FedRAMP authorization." + if checked: + return "Implemented", "Backed by automatically checked KSI(s): " + ", ".join(checked) + "." + if rules: + return "Implemented", "Backed by implemented FedRAMP rule(s): " + ", ".join(rules) + "." + if re.fullmatch(r"[a-z]{2}-1", cid) and fam in policies: + return "Implemented", f"Policy and procedures, published: {policies[fam]}" + return "Partially Implemented", ("The mechanism is described, but no automated check, implemented " + "FedRAMP rule or published policy shows it yet.") + + +def _find_rule(rules, rid): + for fam in rules["FRR"].values(): + for groups in fam["data"].values(): + for members in groups.values(): + if rid in members: + return members[rid] + _fail(f"{rid} is not in the pinned rules") + + +def _sort_key(cid): + fam, _, rest = cid.partition("-") + num, _, enh = rest.partition(".") + return (fam, int(num), int(enh or 0)) + + +def build_controls(irs, catalog, ksi_st, applicable, records, moderate, policies): + ksis_for, _ = _controls.contributing_ksis(catalog) + frr_st = {r["frr_id"]: r["status"] for r in records["records"]} + rules, _ = _rules.load_rules() + frrs_for = {} + for rid in applicable: + for c in _find_rule(rules, rid).get("controls", []) or []: + frrs_for.setdefault(str(c).lower(), set()).add(rid) + missing = sorted(moderate - {ir["control-id"] for ir in irs}) + if missing: + _fail(f"{len(missing)} Moderate control(s) have no implementation record: {', '.join(missing[:10])}") + out = [] + for ir in sorted(irs, key=lambda i: _sort_key(i["control-id"])): + cid = ir["control-id"] + status, basis = control_basis(ir, ksis_for, ksi_st, frrs_for, frr_st, policies) + statement = ir["statements"][0]["remarks"] if ir.get("statements") else "" + orig = _controls.prop(ir, "control-origination") + ks = sorted(ksis_for.get(cid, ())) + fr = sorted(frrs_for.get(cid, ())) + desc = [f"**Not applicable.** {statement}"] if status is None else [f"**Basis:** {basis}", statement] + desc.append(f"**Origination:** {orig}.") + desc.append("**20x coverage:** " + (", ".join(ks) if ks else "no KSI maps this control") + + ("; FedRAMP rules: " + ", ".join(fr) if fr else "") + ".") + if cid not in moderate: + desc.append("Beyond the FedRAMP Moderate baseline; included because a FedRAMP KSI maps it.") + rec = {"controlId": nist_id(cid)} + params = [{"parameterId": sp["param-id"], "parameterValue": ", ".join(sp["values"])} + for sp in ir.get("set-parameters", []) if sp.get("values")] + if params: + rec["parameterValues"] = params + if status: + rec["controlImplementationStatus"] = status + rec["controlImplementationDescription"] = "\n\n".join(d for d in desc if d) + rec["providerExtensions"] = {"basis": basis, "origination": orig, "ksis": ks, "fedrampRules": fr, + "inModerateBaseline": cid in moderate, + "status": status or "Not Applicable"} + out.append(rec) return out -def build_metrics(records, controls_in_scope, vdr, signal, history, now): - """SDR-CSX-KMT: metric snapshot + appended daily history (toward one year).""" +def policy_documents(policy_dir=POLICIES): + """{control family: URL of its published policy} for families with one.""" + return {p.stem.removesuffix("-policy"): f"{REPO_URL}/docs/policies/{p.name}" + for p in sorted(Path(policy_dir).glob("??-policy.md"))} + + +# --- metrics, version ----------------------------------------------------------------- + +KSI_CODES = {"Implemented": "I", "Partially Implemented": "P", "Not Implemented": "N"} + + +def ksi_point(ksis): + """Today's per-KSI metric data (SDR-CSX-KMT): status code (I/P/N), deploy-time + validations and failures, automated methods, and whether the runtime signal + re-validated it (the status of persistent validation).""" + return {k["ksiId"]: {"s": KSI_CODES.get(k["ksiImplementationStatus"], "N"), + "v": k["providerExtensions"]["validations"], + "f": k["providerExtensions"]["failingValidations"], + "m": k["providerExtensions"]["automatedMethods"], + "r": int(k["providerExtensions"]["runtimeComponents"] > 0)} for k in ksis} + + +def ksi_summaries(history): + """Per KSI: a summary of each metric over the past 30 days and up to the + past year, from the days that carry per-KSI data.""" + def summ(window, kid): + pts = [h["ksis"][kid] for h in window if isinstance(h.get("ksis"), dict) and kid in h["ksis"]] + if not pts: + return {"days": 0} + return {"days": len(pts), "daysImplemented": sum(p["s"] == "I" for p in pts), + "daysNotImplemented": sum(p["s"] == "N" for p in pts), + "maxFailingValidations": max(p["f"] for p in pts), + "minAutomatedMethods": min(p["m"] for p in pts), + "daysRuntimeValidated": sum(p["r"] for p in pts), + "current": KSI_NAMES[pts[-1]["s"]]} + kids = sorted({kid for h in history if isinstance(h.get("ksis"), dict) for kid in h["ksis"]}) + return {kid: {"summary_30d": summ(history[-30:], kid), "summary_1y": summ(history, kid)} for kid in kids} + + +KSI_NAMES = {v: k for k, v in KSI_CODES.items()} + + +def build_metrics(counts, vdr, signal, history, now, ksis_today=None): + """SDR-CSX-KMT: today's point and daily history toward one year, with + per-KSI data and summaries.""" sig_vals = signal.get("validations", []) if signal else [] - failing = sum(1 for v in sig_vals if v.get("result") == "fail") vsum = (vdr or {}).get("summary", {}) today = now.date().isoformat() - point = { - "date": today, - "ksi_in_scope": len(records), - "controls_in_scope": controls_in_scope, - "signal_validations": len(sig_vals), - "signal_failing": failing, - "vdr_total": vsum.get("total_findings", 0), - "vdr_blocking": vsum.get("blocking", 0), - "vdr_accepted": vsum.get("risk_accepted", 0), - "vdr_kev": vsum.get("kev", 0), - } - history = [h for h in history if h.get("date") != today] - history.append(point) + point = {"date": today, **counts, + "signal_validations": len(sig_vals), + "signal_failing": sum(1 for v in sig_vals if v.get("result") == "fail"), + "vdr_total": vsum.get("total_findings", 0), "vdr_blocking": vsum.get("blocking", 0), + "vdr_accepted": vsum.get("risk_accepted", 0), "vdr_kev": vsum.get("kev", 0)} + if ksis_today is not None: + point["ksis"] = ksis_today + history = [h for h in history if h.get("date") != today] + [point] history = sorted(history, key=lambda h: h.get("date", ""))[-HISTORY_DAYS:] - last30 = history[-30:] - def _summ(window): - if not window: - return {} + def summ(window): return {"days": len(window), "max_blocking": max(h.get("vdr_blocking", 0) for h in window), "max_failing_validations": max(h.get("signal_failing", 0) for h in window), "current_accepted": window[-1].get("vdr_accepted", 0)} + return {"current": point, "summary_30d": summ(history[-30:]), "summary_1y": summ(history), + "ksi_summaries": ksi_summaries(history), + "daily_metric_keys": {"ksis": "per KSI: s status (I Implemented, P Partially, N Not), v deploy-time " + "validations, f failing, m automated methods, r runtime re-validated " + "(1/0)"}, + "daily_metric_data": history} + + +def previous_history(prev): + pe = prev.get("providerExtensions") or {} + hist = (pe.get("metrics") or {}).get("daily_metric_data") + if hist is None: # the record before the schema reshape kept it at the top level + hist = (prev.get("metrics") or {}).get("daily_metric_data") + return [h for h in hist or [] if isinstance(h, dict)] - return { - "current": point, - "summary_30d": _summ(last30), - "summary_1y": _summ(history), - "daily_metric_data": history, # all daily points up to a year (SDR-CSX-KMT) - "note": ("Daily metric history accumulates one point per deploy/day; the full " - "one-year window builds over time from the first published SDR."), + +def content_hash(doc): + """What the version tracks: everything but the metadata, the daily + metrics and the hash itself.""" + body = {k: v for k, v in doc.items() if k not in ("metadata", "providerExtensions")} + pe = {k: v for k, v in (doc.get("providerExtensions") or {}).items() if k not in ("metrics", "contentSha256")} + raw = json.dumps({"body": body, "pe": pe}, sort_keys=True, separators=(",", ":")).encode() + return hashlib.sha256(raw).hexdigest() + + +def next_version(prev, digest): + """Semver: unchanged content keeps the previous version; changed content + bumps the patch; a previous record without a semver starts at 1.0.0.""" + v = (prev.get("metadata") or {}).get("version", "") + m = SEMVER.match(v or "") + if not m: + return "1.0.0" + if (prev.get("providerExtensions") or {}).get("contentSha256") == digest: + return v + return f"{m.group(1)}.{m.group(2)}.{int(m.group(3)) + 1}" + + +# --- build ---------------------------------------------------------------------------- + +def _tally(items, key): + out = {} + for it in items: + s = it["providerExtensions"][key] + out[s] = out.get(s, 0) + 1 + return dict(sorted(out.items())) + + +def simulated_summary(reqs): + """How many rule records rely on a simulated outside party, and which.""" + by = {} + for r in reqs: + sim = r["providerExtensions"].get("simulated") + if sim: + by[sim["counterparty"]] = by.get(sim["counterparty"], 0) + 1 + return {"records": sum(by.values()), "of": len(reqs), "byCounterparty": dict(sorted(by.items())), + "statement": f"{sum(by.values())} of {len(reqs)} rule records rely on a simulated counterparty " + "(an assessor, FedRAMP, an agency, an incident recipient, the mail system or SAM.gov): " + "the mechanism is real and runs on every deploy; only the outside party is simulated."} + + +def build(catalog, signal, records, applicable, irs, moderate, rules_by_ksi, runtime, runtime_reason, + assessor_records, prof, prev, vdr, now, policies, evidence_ctx=None, fedramp_id=None): + ids = [r["frr_id"] for r in records["records"]] + sorted( + i["id"] for f in catalog["KSI"].values() for i in f["indicators"]) + pseudo = [{"rule_id": i, "assessor_comment_responses": []} for i in ids] + block = _assessor.attach(pseudo, assessor_records) + by_rule = {p["rule_id"]: p["assessor_comment_responses"] for p in pseudo if p["assessor_comment_responses"]} + + reqs = build_requirements(records, applicable, by_rule, evidence_ctx) + ksis, ksi_st = build_ksis(catalog, signal, rules_by_ksi, runtime, runtime_reason, by_rule) + controls = build_controls(irs, catalog, ksi_st, applicable, records, moderate, policies) + in_mod = [c for c in controls if c["providerExtensions"]["inModerateBaseline"]] + beyond = [c for c in controls if not c["providerExtensions"]["inModerateBaseline"]] + ksi_counts = {} + for s in ksi_st.values(): + ksi_counts[s] = ksi_counts.get(s, 0) + 1 + counts = {"rules": len(reqs), "ksis": len(ksis), "controls_moderate": len(in_mod), + "controls_beyond_moderate": len(beyond)} + doc = { + "$schema": fs.stamp("sdr"), + "certificationPackageOverviewUri": fs.CPO_URI, + "metadata": {}, + "fedRampRequirements": reqs, + "keySecurityIndicators": ksis, + "securityControls": controls, + "providerExtensions": { + "fedRampId": fedramp_id or _offering.fedramp_id(), + "certification": "FedRAMP 20x, Program path, Class C", + "class": prof.get("fedramp_class"), + "impact_level": prof.get("impact_level"), + "ksi_signal_id": signal.get("signal_id"), + "rules": _rules.pin(), + "summary": {"fedRampRequirements": _tally(reqs, "status"), + "simulatedCounterparties": simulated_summary(reqs), + "keySecurityIndicators": dict(sorted(ksi_counts.items())), + "securityControlsModerate": _tally(in_mod, "status"), + "securityControlsBeyondModerate": _tally(beyond, "status")}, + "assessorRecords": block, + "assessorCommentResponses": by_rule, + "metrics": build_metrics(counts, vdr, signal, previous_history(prev), now, ksi_point(ksis)), + }, } + digest = content_hash(doc) + doc["providerExtensions"]["contentSha256"] = digest + doc["metadata"] = {"version": next_version(prev, digest), "lastUpdated": now.isoformat(), + "updateSource": "Automated: scripts/build-sdr.py in the deploy workflow, from " + "data/frr-records.json, the KSI signal and the control projection"} + return doc -def main(): +def main(argv=None): ap = argparse.ArgumentParser() ap.add_argument("--catalog", default="schemas/ksi-catalog.json") ap.add_argument("--ksi-signal", default="ksi-signal.json") + ap.add_argument("--runtime-signal", default="ksi-signal-runtime.json") ap.add_argument("--vdr", default="vdr-report.json") ap.add_argument("--profile", default="../data/system-profile.json") + ap.add_argument("--frr-records", default=str(_frr.DEFAULT_PATH)) ap.add_argument("--previous-sdr", default=None) ap.add_argument("--output", default="security-decision-record.json") ap.add_argument("--md-output", default="security-decision-record.md") - ap.add_argument("--assessor-records", default=str(_assessor.RECORDS_DIR), - help="directory of signed assessor records (REQ-ASR-1); empty = no assessor record") - ap.add_argument("--assessor-identity", default=str(_assessor.IDENTITY_PATH), - help="pinned assessor identity the records must verify against") - a = ap.parse_args() + ap.add_argument("--assessor-records", default=str(_assessor.RECORDS_DIR)) + ap.add_argument("--assessor-identity", default=str(_assessor.IDENTITY_PATH)) + # A keyless-signed assessment set (the simulated assessor's, on every deploy): + # given, it is required to exist and verify; its records replace the loose ones. + ap.add_argument("--assessment", default=None) + ap.add_argument("--assessment-bundle", default=None) + a = ap.parse_args(argv) now = datetime.now(timezone.utc) catalog = json.loads(Path(a.catalog).read_text()) - signal = json.loads(Path(a.ksi_signal).read_text()) if Path(a.ksi_signal).exists() else {} + if not Path(a.ksi_signal).exists(): + _fail(f"{a.ksi_signal} not found") + signal = json.loads(Path(a.ksi_signal).read_text()) vdr = json.loads(Path(a.vdr).read_text()) if Path(a.vdr).exists() else {} prof = json.loads(Path(a.profile).read_text()) if Path(a.profile).exists() else {} - history = [] + prev = {} if a.previous_sdr and Path(a.previous_sdr).exists(): try: - history = json.loads(Path(a.previous_sdr).read_text()).get("metrics", {}).get("daily_metric_data", []) or [] - except Exception: - history = [] - - # The projection needs the inventory: without it there is no control state - # to record, so a missing signal stops the build (fail-closed). + prev = json.loads(Path(a.previous_sdr).read_text()) + except json.JSONDecodeError: + prev = {} + records = _frr.load(a.frr_records) + applicable = _rules.applicable_provider_rules() irs = _controls.load(a.ksi_signal, a.catalog) - cmap = _control_map(irs) - records = build_records(catalog, cmap) - # REQ-ASR-1: assessor records enter only through the signed port; any record - # that does not verify fails the build. They are carried verbatim. - assessor_records = _assessor.load_records(a.assessor_records, a.assessor_identity) - assessor_block = _assessor.attach(records, assessor_records) - metrics = build_metrics(records, len(cmap), vdr, signal, history, now) - - sdr = { - "record_type": "security-decision-record", - "schema": "fedramp-security-decision-record-schema-2026-06-24.json", - "note": "The CR26 replacement for the System Security Plan: per-KSI records (20x) and " - "per-Rev5-control records (rev5_controls), both from one control projection.", - # SDR-CSO-MTD - "metadata": { - "version": "live (regenerated each deploy)", - "last_updated": now.isoformat(), - "source_of_update": "scripts/build-sdr.py, derived from the canonical KSI inventory and the control projection", - }, - "class": prof.get("fedramp_class"), - "impact_level": prof.get("impact_level"), - "ksi_signal_id": (signal or {}).get("signal_id"), - "rule_records": records, # SDR-CSO-FRR + SDR-CSX-KSI - "rev5_controls": build_rev5_controls(irs, catalog), # SDR-CSF-CTF - "metrics": metrics, # SDR-CSX-KMT - # REQ-ASR-1: verified, signed assessor records not tied to one rule, and - # the status ("no assessor record" when none exist). - "assessor_records": assessor_block, - } - _assessor.verify_output(sdr, assessor_records) # T74: output text == signed text - Path(a.output).write_text(json.dumps(sdr, indent=2) + "\n") + runtime, reason = runtime_validations(a.runtime_signal) + if a.assessment: + assessor_records = _assessor.load_assessment(a.assessment, a.assessment_bundle, a.assessor_identity) + else: + assessor_records = _assessor.load_records(a.assessor_records, a.assessor_identity) + doc = build(catalog, signal, records, applicable, irs, moderate_ids(), policy_rules(), runtime, reason, + assessor_records, prof, prev, vdr, now, policy_documents(), evidence_context()) + _assessor.verify_output(doc, assessor_records) # T74 + fs.write_validated(doc, "sdr", a.output) if a.md_output: - Path(a.md_output).write_text(render_markdown(sdr) + "\n") - print(f"security-decision-record: {len(records)} per-KSI rule records; " - f"{metrics['current']['controls_in_scope']} controls in scope; " - f"{len(metrics['daily_metric_data'])} day(s) of metric history") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + s = doc["providerExtensions"]["summary"] + print(f"security-decision-record {doc['metadata']['version']}: rules {s['fedRampRequirements']}; " + f"KSIs {s['keySecurityIndicators']}; Moderate controls {s['securityControlsModerate']}") return 0 -def _assessor_lines(sdr): - block = sdr.get("assessor_records") or {"status": _assessor.NO_RECORD, "records": []} - entries = list(block.get("records", [])) - for r in sdr["rule_records"]: - entries += [dict(e, rule_id=r["rule_id"]) for e in r.get("assessor_comment_responses", [])] +# --- human-readable view (CDS-CSO-CBF: same data as the JSON) ------------------------- + +def _cell(text): + return str(text).replace("|", "\\|").replace("\n", " ") + + +def _assessor_lines(doc): + pe = doc["providerExtensions"] + entries = list(pe["assessorRecords"].get("records", [])) + for rid, es in pe.get("assessorCommentResponses", {}).items(): + entries += [dict(e, rule_id=rid) for e in es] if not entries: return ["**Assessor records:** No assessor record. Nothing on this page was written " "or signed by an assessor."] - out = [f"**Assessor records:** {block['status']}. Each is quoted verbatim from the " + out = [f"**Assessor records:** {pe['assessorRecords']['status']}. Each is quoted verbatim from the " "assessor's signed record; the signature is in the JSON."] for e in sorted(entries, key=lambda e: e["record_id"]): rule = f" (`{e['rule_id']}`)" if e.get("rule_id") else "" @@ -275,42 +651,52 @@ def _assessor_lines(sdr): return out -def render_markdown(sdr): - m = sdr["metadata"] - cur = sdr["metrics"]["current"] +def _summary_line(d): + return ", ".join(f"{k} {v}" for k, v in d.items()) or "none" + + +def render_markdown(doc): + m, pe = doc["metadata"], doc["providerExtensions"] + s = pe["summary"] out = ["# Security Decision Record", "", - f"_{sdr['note']}_", "", - f"- **Class:** {sdr['class']} | **Impact:** {sdr['impact_level']}", - f"- **Version:** {m['version']} | **Last updated:** {m['last_updated']}", - f"- **Source:** {m['source_of_update']}", - f"- **Bound to inventory signal:** `{sdr['ksi_signal_id']}`", - "", - "## Metrics (SDR-CSX-KMT)", "", - f"- KSIs in scope: **{cur['ksi_in_scope']}** | Controls in scope: **{cur['controls_in_scope']}**", - f"- Signal validations: {cur['signal_validations']} ({cur['signal_failing']} failing)", - f"- Vulnerabilities: {cur['vdr_total']} total, {cur['vdr_blocking']} blocking, " - f"{cur['vdr_accepted']} accepted, {cur['vdr_kev']} KEV", - f"- Daily metric history: {len(sdr['metrics']['daily_metric_data'])} day(s) on record " - "(builds toward one year)", - "", - "## Per-rule records (SDR-CSO-FRR / SDR-CSX-KSI)", "", - "Independent verification and validation are N/A for this self-attested system " - "(no FedRAMP Recognized assessor). Verification and validation below are the " - "provider-side evidence an assessor would consume.", "", - *_assessor_lines(sdr), "", - "| KSI | Controls | Explanation |", "|---|---|---|"] - for r in sdr["rule_records"]: - cids = ", ".join(c["control_id"] for c in r["controls"]) or "—" - out.append("| `{rid}` | {cids} | {ex} |".format( - rid=r["rule_id"], cids=cids, ex=r["explanation"].replace("|", "\\|"))) - rc = sdr.get("rev5_controls", []) - by_status = {} - for c in rc: - by_status[c["implementation_status"]] = by_status.get(c["implementation_status"], 0) + 1 - out += ["", "## Rev5 controls (SDR-CSF-CTF)", "", - f"{len(rc)} controls, each with its parameter values, implementation status, mechanisms, " - "verification and validation in `rev5_controls` of the JSON record. By status: " - + (", ".join(f"{k} {v}" for k, v in sorted(by_status.items())) or "none") + "."] + f"_{pe['certification']}. Every applicable FedRAMP rule, every Key Security Indicator, and every " + "NIST 800-53 Rev5 control in the Moderate baseline, with how 20x evidence meets it._", "", + f"- **FedRAMP ID:** {pe.get('fedRampId')} (simulated: no FedRAMP ID has been assigned)", + f"- **Version:** {m['version']} | **Last updated:** {m['lastUpdated']}", + f"- **Source:** {m['updateSource']}", + f"- **Bound to inventory signal:** `{pe['ksi_signal_id']}`", + f"- **FedRAMP rules (pinned):** {pe['rules']['version']} at `{pe['rules']['commit'][:12]}`", + "", "## Summary", "", + f"- FedRAMP rules ({len(doc['fedRampRequirements'])}): {_summary_line(s['fedRampRequirements'])}", + f"- {(s.get('simulatedCounterparties') or {}).get('statement', 'No rule record relies on a simulated counterparty.')}", + f"- Key Security Indicators ({len(doc['keySecurityIndicators'])}): " + f"{_summary_line(s['keySecurityIndicators'])}", + f"- Rev5 Moderate controls ({sum(s['securityControlsModerate'].values())}): " + f"{_summary_line(s['securityControlsModerate'])}", + f"- Controls beyond Moderate mapped by KSIs ({sum(s['securityControlsBeyondModerate'].values())}): " + f"{_summary_line(s['securityControlsBeyondModerate'])}", + "", *_assessor_lines(doc), "", + "## FedRAMP rules", "", "| Rule | Status | Implementation | Gap / closes with |", "|---|---|---|---|"] + for r in doc["fedRampRequirements"]: + x = r["providerExtensions"] + gap = next((v for v in r["frrValidation"] if v.startswith("Gap: ")), "") + closes = next((v for v in r["frrValidation"] if v.startswith("Closes with: ")), "") + sim = f" (simulated {x['simulated']['counterparty']})" if x.get("simulated") else "" + out.append(f"| `{r['frrID']}` | {x['status']}{sim} | {_cell(' '.join(r['frrImplementation']))} | " + f"{_cell((gap + ' ' + closes).strip()) or '—'} |") + out += ["", "## Key Security Indicators", "", + "| KSI | Status | Automated methods | Measures |", "|---|---|---|---|"] + for k in doc["keySecurityIndicators"]: + x = k["providerExtensions"] + out.append(f"| `{k['ksiId']}` | {k['ksiImplementationStatus']} | {x['automatedMethods']} | " + f"{_cell('; '.join(k['ksiTests'])) or '—'} |") + out += ["", "## NIST 800-53 Rev5 controls", "", + "| Control | Status | Basis | 20x coverage |", "|---|---|---|---|"] + for c in doc["securityControls"]: + x = c["providerExtensions"] + cov = ", ".join(x["ksis"] + x["fedrampRules"]) or "—" + tag = "" if x["inModerateBaseline"] else " (beyond Moderate)" + out.append(f"| {c['controlId']}{tag} | {x['status']} | {_cell(x['basis'])} | {_cell(cov)} |") out += ["", "---", "_Source of truth: the signed `security-decision-record.json`._"] return "\n".join(out) diff --git a/scripts/build-trust-center.py b/scripts/build-trust-center.py index 31bad9cb..2df2f7e2 100644 --- a/scripts/build-trust-center.py +++ b/scripts/build-trust-center.py @@ -44,6 +44,7 @@ from _freshness import load_freshness_config # noqa: E402 import _decisions # noqa: E402 import _gates # noqa: E402 +import _offering # noqa: E402 FRESHNESS: dict[str, Any] = load_freshness_config(os.environ.get("FRESHNESS_CONFIG") or None) VDR_MAX_AGE_HOURS = FRESHNESS["windows"][".well-known/vdr-report.json"] @@ -768,6 +769,7 @@ def build(inp: dict[str, Any], commit: str, now: datetime) -> dict[str, Any]: pending = build_decisions_pending(inp, now, log, gaps) return { "schema": SCHEMA, + "fedRampId": _offering.fedramp_id(), "generated_at": now.isoformat(timespec="seconds"), "commit": commit, "ksi_signal_id": signal_id, diff --git a/scripts/build-trust-manifest.py b/scripts/build-trust-manifest.py new file mode 100644 index 00000000..2c80ccae --- /dev/null +++ b/scripts/build-trust-manifest.py @@ -0,0 +1,170 @@ +#!/usr/bin/env python3 +"""The trust center's manifest: every piece of FedRAMP certification data, where +it is, how to fetch and verify it, and its human-readable forms (CDS-TRC-PAC, +CDS-TRC-HMR, CDS-CSO-UTC). + +It is generated, never hand-kept: the artifact list is the governed freshness +config (every artifact published under /.well-known/ must have an entry there, +or tests/test_freshness_config.py fails), the policies and procedures come from +this build's policy index, and each artifact's human-readable forms are the +files this build actually wrote beside it. So the manifest cannot omit a +published artifact or name a view that does not exist. + + python3 scripts/build-trust-manifest.py --dir . --policy-index policy-index.json \ + --output trust-manifest.json --md-output trust-manifest.md +""" + +import argparse +import json +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _freshness # noqa: E402 +import _offering # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +SITE = "https://samaydlette.com" +WF = "https://github.com/sam-aydlette/samaydlette.com/.github/workflows" +ISSUER = "https://token.actions.githubusercontent.com" +SIGNERS = { + "deploy": f"{WF}/deploy-with-opa.yml@refs/heads/main", + "nightly": f"{WF}/evidence-nightly.yml@refs/heads/main", + "assessor": f"{WF}/simulated-assessor.yml@refs/heads/main", +} +MEDIA = {".json": "application/json", ".md": "text/markdown; charset=utf-8", ".csv": "text/csv", + ".jsonl": "application/x-ndjson", ".gz": "application/gzip"} +# Published by something other than the deploy, so not built here; shown +# human-readably on the trust page, which renders them from the live JSON. +LIVE_RENDERED = {"ksi-signal-runtime.json": "the runtime signal, published hourly by the runtime Lambda", + "vdr-status.json": "the nightly evidence run's status beacon"} +EXTERNAL = [{ + "name": "Independent availability status (CDS-CSO-AVR)", + "url": "https://raw.githubusercontent.com/sam-aydlette/samaydlette.com/availability-status/availability-status.json", + "media_type": "application/json", + "human_readable": ["https://github.com/sam-aydlette/samaydlette.com/blob/availability-status/availability-status.md"], + "note": "Served by GitHub, independent of the offering's AWS hosting, so it stays available when the offering " + "is not.", +}] +ACCESS = ( + "All certification data is public: no account, key or request is needed. Fetch any artifact with an HTTPS GET " + "(CORS is open for read-only use from a browser). Verify a signed artifact with cosign against the identity " + "named in `signed_by`: `cosign verify-blob --bundle --certificate-identity " + "--certificate-oidc-issuer https://token.actions.githubusercontent.com `. Every JSON artifact has a " + "complete human-readable view (`.view.md`) that this build checked reproduces the JSON exactly, and most have a " + "curated Markdown summary (`.md`). The policies and procedures are served as Markdown. This manifest is itself " + "signed, and is the programmatic index of everything listed. A step-by-step guide per rule is in " + "assessor-guide.json.") + + +def _signer(name): + if name.startswith("simulated-assessment"): + return "assessor" + if name.startswith("vdr-"): + return "deploy or nightly" + return "deploy" + + +def _schema(path): + if path.suffix != ".json" or not path.is_file(): + return None + try: + doc = json.loads(path.read_text()) + except (OSError, json.JSONDecodeError): + return None + s = doc.get("$schema") if isinstance(doc, dict) else None + return s if isinstance(s, str) and s.startswith("http") else None + + +def artifacts(fresh, d): + out = [] + for a in fresh["artifacts"]: + rel = a["path"] + name = rel.rsplit("/", 1)[1] + local = d / name + suffix = Path(name).suffix + entry = {"name": name, "url": f"{SITE}/{rel}", "media_type": MEDIA.get(suffix, "application/octet-stream"), + "cadence": a["cadence"], "max_age_hours": a["max_age_hours"], "signed": a["signed"]} + if a.get("signature"): + entry["signature"] = f"{SITE}/{a['signature']}" + who = _signer(name) + entry["signed_by"] = who + schema = _schema(local) + if name == "ksi-signal.json": + schema = f"{SITE}/.well-known/ksi-signal.schema.json" + if schema: + entry["schema"] = schema + human = [] + stem = name[:-len(suffix)] if suffix in (".json", ".csv") else None + if stem: + for twin in (f"{stem}.md", f"{stem}.view.md"): + if (d / twin).is_file(): + human.append(f"{SITE}/.well-known/{twin}") + if name in LIVE_RENDERED: + human.append(f"{SITE}/trust/ (renders {LIVE_RENDERED[name]} from the live JSON)") + entry["human_readable"] = human + out.append(entry) + return out + + +def build(fresh, d, policy_index, now, commit=None): + arts = artifacts(fresh, d) + policies = [{"name": e["name"], "kind": e["kind"], "url": e["url"], "media_type": MEDIA[".md"], + "version": e["version"], "last_updated": e["last_updated"]} for e in policy_index["entries"]] + return {"manifest_type": "fedramp-certification-data-manifest", "schema_version": "1", + "fedRampId": _offering.fedramp_id(), + "generated_at": now.isoformat(), "commit": commit, + "trust_center": f"{SITE}/trust/", "access": ACCESS, + "signers": {**SIGNERS, "oidc_issuer": ISSUER}, + "summary": {"artifacts": len(arts), "policies_and_procedures": len(policies), + "with_human_readable_form": sum(1 for x in arts if x["human_readable"])}, + "artifacts": arts, "policies_and_procedures": policies, "external": EXTERNAL} + + +def render_markdown(m): + out = ["# FedRAMP certification data: manifest", "", + f"_Everything the trust center ({m['trust_center']}) shares, generated on every deploy. Source of truth: " + "the signed `trust-manifest.json`._", "", + f"- **Generated:** {m['generated_at']} | **Commit:** `{m['commit'] or 'local build'}`", + f"- **Artifacts:** {m['summary']['artifacts']} | **Policies and procedures:** " + f"{m['summary']['policies_and_procedures']}", "", + "## Programmatic access", "", m["access"], "", "## Signing identities", ""] + out += [f"- {k}: `{v}`" for k, v in m["signers"].items()] + out += ["", "## Artifacts", "", "| Artifact | Media type | Cadence | Signature | Human-readable |", + "|---|---|---|---|---|"] + for a in m["artifacts"]: + sig = f"[bundle]({a['signature']}) ({a['signed_by']})" if a.get("signature") else "unsigned" + human = ", ".join(h if not h.startswith("http") else f"[{h.rsplit('/', 1)[1]}]({h})" + for h in a["human_readable"]) or "—" + out.append(f"| [{a['name']}]({a['url']}) | {a['media_type']} | {a['cadence']}, {a['max_age_hours']}h | " + f"{sig} | {human} |") + out += ["", "## Policies and procedures", "", "| Name | Kind | Version | Last updated |", "|---|---|---|---|"] + out += [f"| [{p['name']}]({p['url']}) | {p['kind']} | `{p['version']}` | {p['last_updated']} |" + for p in m["policies_and_procedures"]] + out += ["", "## Elsewhere", ""] + out += [f"- [{e['name']}]({e['url']}): {e['note']}" for e in m["external"]] + return "\n".join(out) + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--dir", default=".") + ap.add_argument("--policy-index", default="policy-index.json") + ap.add_argument("--freshness", default=str(REPO / "infrastructure" / "schemas" / "freshness-config.json")) + ap.add_argument("--commit", default=None) + ap.add_argument("--output", default="trust-manifest.json") + ap.add_argument("--md-output", default="trust-manifest.md") + a = ap.parse_args(argv) + fresh = _freshness.load_freshness_config(a.freshness) + m = build(fresh, Path(a.dir), json.loads(Path(a.policy_index).read_text()), datetime.now(timezone.utc), + a.commit) + Path(a.output).write_text(json.dumps(m, indent=2) + "\n") + if a.md_output: + Path(a.md_output).write_text(render_markdown(m) + "\n") + print(f"trust-manifest: {m['summary']}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-edge-access-logging.py b/scripts/check-edge-access-logging.py new file mode 100644 index 00000000..92fc97d9 --- /dev/null +++ b/scripts/check-edge-access-logging.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 +"""Access to the certification data is logged, within the privacy limits (CDS-TRC-ACL). + +Reads the CloudFront standard-logging (v2) configuration the deploy role can see +and fails unless: + + * a delivery from the source named for this site exists; + * that source is the CloudFront distribution's ACCESS_LOGS; + * the delivery goes to S3; and + * its record fields are exactly within ALLOWED_FIELDS and include REQUIRED_FIELDS. + +ALLOWED_FIELDS is the operator's privacy condition: no client IP, forwarded-for, +port, cookies, query string, user agent or referrer is ever logged. It must equal +the delivery's record_fields in infrastructure/bootstrap/trust-access-logs.tf +(tests/test_edge_access_logging.py holds them equal). The configuration is +operator-applied (bootstrap), so this check is what fails the deploy when it is +missing, before the trust center or the SDR say access is logged. + +Inputs are the AWS CLI's JSON (aws logs describe-deliveries, aws logs +get-delivery-source), so the check runs the same on fixtures. Prints no ARN. +""" +import argparse +import json +import sys +from pathlib import Path + +ALLOWED_FIELDS = ("date", "time", "x-edge-location", "c-country", "cs-method", "cs-uri-stem", + "sc-status", "sc-bytes", "x-edge-result-type") +REQUIRED_FIELDS = ("date", "time", "cs-uri-stem", "sc-status") +# Named so the failure message says what was found; any field outside +# ALLOWED_FIELDS fails, whether or not it is listed here. +IDENTIFYING = ("c-ip", "x-forwarded-for", "c-port", "cs(Cookie)", "cs-uri-query", "cs(User-Agent)", + "cs(Referer)") + + +def problems(deliveries, source, name): + out = [] + mine = [d for d in (deliveries or {}).get("deliveries", []) if d.get("deliverySourceName") == name] + if not mine: + return [f"no CloudFront access-log delivery from source {name!r} (bootstrap not applied?)"] + if len(mine) > 1: + out.append(f"{len(mine)} deliveries from {name!r}; expected one") + src = (source or {}).get("deliverySource") or {} + if src.get("name") != name: + out.append(f"delivery source {name!r} could not be read") + if src.get("logType") != "ACCESS_LOGS": + out.append(f"delivery source log type is {src.get('logType')!r}, not ACCESS_LOGS") + if not any(":distribution/" in a and a.startswith("arn:aws:cloudfront::") for a in src.get("resourceArns") or []): + out.append("delivery source is not a CloudFront distribution") + for d in mine: + if d.get("deliveryDestinationType") != "S3": + out.append(f"delivery destination type is {d.get('deliveryDestinationType')!r}, not S3") + fields = d.get("recordFields") or [] + extra = sorted(set(fields) - set(ALLOWED_FIELDS)) + bad = sorted(f for f in extra if f in IDENTIFYING) + if bad: + out.append(f"delivery logs identifying field(s) {bad}") + if sorted(set(extra) - set(bad)): + out.append(f"delivery logs field(s) outside the privacy allowlist: {sorted(set(extra) - set(bad))}") + missing = sorted(set(REQUIRED_FIELDS) - set(fields)) + if missing: + out.append(f"delivery omits required field(s) {missing}") + return out + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--deliveries", required=True, help="aws logs describe-deliveries output") + ap.add_argument("--source", required=True, help="aws logs get-delivery-source output (may be empty)") + ap.add_argument("--name", required=True, help="the delivery source's name") + a = ap.parse_args(argv) + + def read(p): + t = Path(p).read_text() if Path(p).exists() else "" + try: + return json.loads(t) if t.strip() else {} + except json.JSONDecodeError: + return {} + why = problems(read(a.deliveries), read(a.source), a.name) + for w in why: + print(f"::error::edge access logging: {w}", file=sys.stderr) + if why: + print("Access to the certification data is not logged as the trust center states; " + "the deploy does not proceed.", file=sys.stderr) + return 1 + print(f"ok: CloudFront access logging to S3, fields {', '.join(ALLOWED_FIELDS)} " + "(no IP, cookies, query string or user agent)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-fedramp-id.py b/scripts/check-fedramp-id.py new file mode 100644 index 00000000..9002a327 --- /dev/null +++ b/scripts/check-fedramp-id.py @@ -0,0 +1,82 @@ +#!/usr/bin/env python3 +"""Deploy gate: every FedRAMP report this build publishes carries the offering's +FedRAMP ID (CDS-CSO-FID). + +For each file named: a report in a FedRAMP schema ($schema under +https://fedramp.gov/schemas/) must carry providerExtensions.fedRampId equal to +data/cds/offering.json's fedramp_id, and the CPO also in +serviceIdentification.fedRampPackageId; any other JSON (the issue index, logs, +snapshot manifests, the trust-center data) must carry the same value at top +level, `fedRampId`. A file named here without one fails, as does a file that +cannot be read. Exit 0 pass, 1 fail. + + check-fedramp-id.py # every file in REPORTS, in the current directory + check-fedramp-id.py FILE... # these files + +REPORTS is the one list of what the deploy checks: a group that publishes a +FedRAMP report adds its file here, one line. +""" + +import json +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _offering # noqa: E402 + +# Every FedRAMP report the deploy publishes, by built file name. Add a line per report. +REPORTS = ( + "certification-package-overview.json", + "security-decision-record.json", + "ongoing-certification-report.json", + # Trust center, scope and assessor (group 5): site files, top-level fedRampId. + "trust-center.json", + "trust-manifest.json", + "availability.json", + "policy-index.json", + "assessor-guide.json", + "simulated-assessment.json", + "agency-access-exercise.json", + "frr-evidence.json", + # The independent monitor's feed as this deploy read it (availability-status.json + # from the availability-status branch; it is built by scripts/availability-probe.py). + "availability-probe.json", +) +FEDRAMP_SCHEMAS = ("https://fedramp.gov/schemas/", "https://www.fedramp.gov/schemas/") + + +def problems(name, doc, fid): + out = [] + if not isinstance(doc, dict): + return [f"{name}: not a JSON object"] + if str(doc.get("$schema", "")).startswith(FEDRAMP_SCHEMAS): + if (doc.get("providerExtensions") or {}).get("fedRampId") != fid: + out.append(f"{name}: providerExtensions.fedRampId is missing or not the offering's FedRAMP ID") + si = doc.get("serviceIdentification") + if si is not None and si.get("fedRampPackageId") != fid: + out.append(f"{name}: serviceIdentification.fedRampPackageId is not the offering's FedRAMP ID") + elif doc.get("fedRampId") != fid: + out.append(f"{name}: top-level fedRampId is missing or not the offering's FedRAMP ID") + return out + + +def main(argv=None): + files = (sys.argv[1:] if argv is None else argv) or list(REPORTS) + fid = _offering.fedramp_id() + bad = [] + for f in files: + try: + doc = json.loads(Path(f).read_text()) + except (OSError, ValueError) as exc: + bad.append(f"{f}: unreadable ({type(exc).__name__})") + continue + bad += problems(Path(f).name, doc, fid) + for b in bad: + print(f"::error::CDS-CSO-FID: {b}") + if not bad: + print(f"CDS-CSO-FID: {len(files)} file(s) carry the offering's FedRAMP ID") + return 1 if bad else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-frr-evidence.py b/scripts/check-frr-evidence.py new file mode 100644 index 00000000..81ebe123 --- /dev/null +++ b/scripts/check-frr-evidence.py @@ -0,0 +1,120 @@ +#!/usr/bin/env python3 +"""Every test a FedRAMP rule record cites ran and passed (FRC-CSX-VVR). + +scripts/_frr.py shows that each piece of evidence a rule record cites exists. +This shows the cited tests passed in this build: it reads the JUnit XML that the +unit-test job's pytest run wrote and fails when a test cited as evidence failed, +errored, was skipped, or did not run at all. A parametrized test passes only +when every one of its cases ran and passed. + +It writes the result per record (frr-evidence.json), which the deploy signs and +publishes beside the Security Decision Record, so a reader can see that each +Implemented record's tests passed in the build that published it. + + python3 scripts/check-frr-evidence.py --junit pytest-results.xml --output frr-evidence.json +""" + +import argparse +import json +import sys +import xml.etree.ElementTree as ET # nosec B405: parses the JUnit file this job's own pytest wrote +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _frr # noqa: E402 +import _offering # noqa: E402 + +SCHEMA = "frr-evidence/1" + + +def _fail(msg): + raise SystemExit(f"::error::FRR evidence: {msg} (fail-closed)") + + +def junit_outcomes(path): + """{(module path, class or None, function): [outcome per case]} from a JUnit XML file.""" + try: + root = ET.parse(path).getroot() # nosec B314: trusted, locally generated file + except (OSError, ET.ParseError) as exc: + _fail(f"cannot read the test results {path}: {exc}") + out = {} + for case in root.iter("testcase"): + classname, name = case.get("classname", ""), case.get("name", "") + parts = classname.split(".") + # classname is "tests.test_x" or "tests.test_x.TestClass" + if len(parts) >= 2 and parts[-1][:1].isupper(): + module, cls = "/".join(parts[:-1]) + ".py", parts[-1] + else: + module, cls = "/".join(parts) + ".py", None + func = name.split("[", 1)[0] + if case.find("failure") is not None or case.find("error") is not None: + outcome = "failed" + elif case.find("skipped") is not None: + outcome = "skipped" + else: + outcome = "passed" + out.setdefault((module, cls, func), []).append(outcome) + if not out: + _fail(f"{path} records no test cases") + return out + + +def _key(ref): + m = _frr.TEST_RE.match(ref) + if not m: + _fail(f"{ref!r} is not a test reference") + rel, first, second = m.groups() + return (rel, first, second) if second else (rel, None, first) + + +def test_result(ref, outcomes): + cases = outcomes.get(_key(ref)) + if not cases: + return "not run" + if all(c == "passed" for c in cases): + return "passed" + return "failed" if "failed" in cases else "skipped" + + +def evaluate(records, outcomes): + """(per-record results, list of failures).""" + per, failures = {}, [] + for r in records["records"]: + tests = {e["ref"]: test_result(e["ref"], outcomes) for e in r.get("evidence", []) if e["kind"] == "test"} + for ref, res in tests.items(): + if res != "passed": + failures.append(f"{r['frr_id']}: cited test {ref} {res}") + per[r["frr_id"]] = {"status": r["status"], "tests": tests, + "result": "pass" if all(v == "passed" for v in tests.values()) else "fail"} + return per, failures + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--junit", required=True) + ap.add_argument("--records", default=str(_frr.DEFAULT_PATH)) + ap.add_argument("--output", default="frr-evidence.json") + ap.add_argument("--commit", default=None) + a = ap.parse_args(argv) + records = _frr.load(a.records) + per, failures = evaluate(records, junit_outcomes(a.junit)) + cited = sum(len(v["tests"]) for v in per.values()) + doc = {"schema": SCHEMA, "fedRampId": _offering.fedramp_id(), "generated_at": datetime.now(timezone.utc).isoformat(), "commit": a.commit, + "explanation": "Each FedRAMP rule record's cited tests and whether they passed in the unit-test run " + "of the build that published this file (scripts/check-frr-evidence.py). The build " + "fails when any cited test fails, errors, is skipped or does not run.", + "summary": {"records": len(per), "cited_tests": cited, + "records_with_tests": sum(1 for v in per.values() if v["tests"])}, + "records": per} + if failures: + for f in failures: + print(f"::error::{f}") + _fail(f"{len(failures)} cited test(s) did not pass") + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") + print(f"frr-evidence: {cited} cited tests across {doc['summary']['records_with_tests']} records, all passed") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-package-maintainer.py b/scripts/check-package-maintainer.py new file mode 100644 index 00000000..f1e5d39a --- /dev/null +++ b/scripts/check-package-maintainer.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Deploy preflight: the unattended certification package maintainer is in place. + +The rule records for package maintenance and the quarterly cycle (CPO-CSX-CPM, +CCM-OCR-AVL/SOR, CDS-CSO-HAD, SDR-CSX-KMT) describe the system as it is after +a successful deploy, so a deploy must not succeed without what they rely on. +Run early in the deploy job, before anything is applied or the SDR is built, +this fails the deploy unless: + + 1. the repository variable AWS_PACKAGE_MAINTENANCE_ROLE_ARN is set, and + 2. it names the role infrastructure/bootstrap/package-maintenance.tf creates + (github-actions-package-maintenance-oidc, an IAM role ARN), and + 3. the `package-maintenance` GitHub Environment exists and deploys only from + main (a custom branch policy naming exactly `main`). + +The same checks as the incident report publisher's preflight, for this role. + +Check 3 reads GitHub's API with the job token. A missing environment (404) +fails. If the token cannot read the environment at all (any other error), the +check is reported as not observed and the deploy continues on checks 1-2: the +deploy's later package-maintainer job assumes the role from that environment, +so a wrong environment still fails the deploy there. + +Whether the role itself works is proved later in the same run: the +`package-maintainer` job calls .github/workflows/package-maintenance.yml, +which assumes the role, publishes, and fails the deploy if it cannot. + +Prints no ARN or account ID. Exit 0 pass, 1 fail. +""" + +from __future__ import annotations + +import argparse +import json +import os +import re +import sys +import urllib.error +import urllib.request +from typing import Any + +EXPECTED_ROLE_NAME = "github-actions-package-maintenance-oidc" +ENVIRONMENT = "package-maintenance" +EXPECTED_BRANCHES = {"main"} +ROLE_ARN_RE = re.compile(r"^arn:aws(-[a-z]+)*:iam::[0-9]{12}:role/(?:[\w+=,.@-]+/)*([\w+=,.@-]+)$") + + +def check_variable(role_arn: str | None) -> list[str]: + if not role_arn or not role_arn.strip(): + return ["the repository variable AWS_PACKAGE_MAINTENANCE_ROLE_ARN is not set: apply " + "infrastructure/bootstrap/package-maintenance.tf and set it from the package_maintenance_role_arn output"] + m = ROLE_ARN_RE.match(role_arn.strip()) + if not m: + return ["AWS_PACKAGE_MAINTENANCE_ROLE_ARN is not an IAM role ARN"] + if m.group(2) != EXPECTED_ROLE_NAME: + return [f"AWS_PACKAGE_MAINTENANCE_ROLE_ARN names a role other than {EXPECTED_ROLE_NAME}"] + return [] + + +def check_environment(env: dict[str, Any] | None, branch_policies: list[str] | None) -> tuple[list[str], str]: + """(problems, note). env None = the environment does not exist.""" + if env is None: + return [f"the {ENVIRONMENT} GitHub Environment does not exist"], "" + policy = env.get("deployment_branch_policy") or {} + if not policy.get("custom_branch_policies") or policy.get("protected_branches"): + return [f"the {ENVIRONMENT} environment does not restrict deployments to a custom branch list"], "" + if branch_policies is None: + return [], "branch policies not observed" + if set(branch_policies) != EXPECTED_BRANCHES: + return [f"the {ENVIRONMENT} environment deploys from {sorted(branch_policies) or 'no branch'}, " + "not only main"], "" + return [], f"{ENVIRONMENT} deploys only from main" + + +def _get(url: str, token: str | None) -> Any: + if not url.startswith("https://"): + raise ValueError("refusing non-HTTPS URL") + headers = {"Accept": "application/vnd.github+json", "User-Agent": "samaydlette-preflight"} + if token: + headers["Authorization"] = f"Bearer {token}" + with urllib.request.urlopen(urllib.request.Request(url, headers=headers), timeout=15) as r: # noqa: S310 + return json.loads(r.read().decode()) + + +def read_environment(repo: str, token: str | None) -> tuple[str, dict[str, Any] | None, list[str] | None]: + """("ok"|"missing"|"unreadable", environment, branch policy names).""" + api = f"https://api.github.com/repos/{repo}/environments/{ENVIRONMENT}" + try: + env = _get(api, token) + except urllib.error.HTTPError as exc: + return ("missing" if exc.code == 404 else "unreadable"), None, None + except Exception: # noqa: BLE001 (any other failure: not observed) + return "unreadable", None, None + try: + pols = _get(f"{api}/deployment-branch-policies", token) + names = [p.get("name", "") for p in pols.get("branch_policies", [])] + except Exception: # noqa: BLE001 + names = None + return "ok", env, names + + +def evaluate(role_arn: str | None, env_state: str, env: dict[str, Any] | None, + branch_policies: list[str] | None) -> tuple[list[str], list[str]]: + """(problems, notes) for one run; pure, for tests.""" + problems = check_variable(role_arn) + notes = [] + if env_state == "unreadable": + notes.append(f"the {ENVIRONMENT} environment could not be read with the job token; not observed " + "(the package-maintainer job still fails the deploy if the role cannot be assumed from it)") + else: + p, note = check_environment(env if env_state == "ok" else None, branch_policies) + problems += p + if note: + notes.append(note) + return problems, notes + + +def main(argv: list[str] | None = None) -> int: + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--fixture", default=None, + help="JSON {role_arn, env_state, environment, branch_policies} instead of live reads (tests)") + a = ap.parse_args(argv) + if a.fixture: + with open(a.fixture) as fh: + fx = json.load(fh) + problems, notes = evaluate(fx.get("role_arn"), fx["env_state"], fx.get("environment"), + fx.get("branch_policies")) + else: + state, env, pols = read_environment(os.environ.get("GITHUB_REPOSITORY", "sam-aydlette/samaydlette.com"), + os.environ.get("GITHUB_TOKEN")) + problems, notes = evaluate(os.environ.get("PACKAGE_MAINTENANCE_ROLE_ARN"), state, env, pols) + for n in notes: + print(f"package maintainer preflight: {n}") + for p in problems: + print(f"::error::package maintainer preflight: {p}") + if not problems: + print("package maintainer preflight: role variable names the package-maintenance role; ok") + return 1 if problems else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-secure-config.py b/scripts/check-secure-config.py new file mode 100644 index 00000000..ee867e6a --- /dev/null +++ b/scripts/check-secure-config.py @@ -0,0 +1,337 @@ +#!/usr/bin/env python3 +"""Compare the live settings of the top-level and privileged accounts with the +Secure Configuration Guide's recommended defaults (SCG-ENH-CMP), and export +them as JSON (SCG-ENH-EXP): /.well-known/security-settings.json and .md. + +Runs in the deploy, before the Security Decision Record is built. Every read is +read-only (AWS CLI with the deploy role; GitHub's API with the run's token). A +setting either matches its recommended value, or differs and is covered by the +in-force decision the guide cites (an accepted deviation), or is attested by a +decision because no API exposes it to this run. Anything else, a deviation no +decision covers or a setting that could not be read, fails the deploy: the +published comparison is then never stale or partial. + +Published values are counts, booleans and policy values only: never an account +ID, an ARN, an IAM user or role name, or an email address. +""" + +import argparse +import importlib.util +import json +import subprocess +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _decisions # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +SOURCE = REPO / "data" / "secure-configuration.json" +SCHEMA = "security-settings/1" +REGION = "us-east-2" +OPERATOR_GROUP = "operators" +# The CI roles' names, as infrastructure/bootstrap names them (read, never published). +ROLES = {"role-trust-deploy": "github-actions-deploy-oidc", + "role-trust-plan": "github-actions-plan-oidc", + "role-trust-nightly": "github-actions-evidence-nightly-oidc"} +SUB_KEY = "token.actions.githubusercontent.com:sub" +READ_ONLY_MANAGED = {"ReadOnlyAccess", "SecurityAudit", "ViewOnlyAccess"} +READ_VERBS = ("Get", "List", "Describe", "Search", "BatchGet", "Lookup", "View") + + +class ReadError(Exception): + """A setting could not be read.""" + + +class AwsError(Exception): + def __init__(self, code): + super().__init__(code) + self.code = code + + +def aws(args): + """Run a read-only AWS CLI call; JSON out, or AwsError with the error code.""" + p = subprocess.run(["aws", *args, "--output", "json"], capture_output=True, text=True, timeout=60) + if p.returncode != 0: + code = "Unknown" + for word in ("NoSuchEntity", "AccessDenied", "AccessDeniedException", "NoSuchPublicAccessBlockConfiguration"): + if word in p.stderr: + code = word + break + raise AwsError(code) + return json.loads(p.stdout or "{}") + + +# --- comparison ----------------------------------------------------------------------- + +def matches(recommended, current): + """Recommended values are literals, {"at_least": n}, {"at_most": n}, lists + (compared as sets) or objects of those (every key must match).""" + if isinstance(recommended, dict): + if set(recommended) == {"at_least"}: + return isinstance(current, (int, float)) and not isinstance(current, bool) and current >= recommended["at_least"] + if set(recommended) == {"at_most"}: + return isinstance(current, (int, float)) and not isinstance(current, bool) and current <= recommended["at_most"] + return isinstance(current, dict) and all(k in current and matches(v, current[k]) for k, v in recommended.items()) + if isinstance(recommended, list): + return isinstance(current, list) and sorted(map(str, recommended)) == sorted(map(str, current)) + return type(recommended) is type(current) and recommended == current + + +def compare(src, current, in_force): + """One result per setting. `current` is {check id: value or ReadError}.""" + out = [] + for s in src["settings"]: + r = {"id": s["id"], "account": s["account"], "setting": s["setting"], "recommended": s["recommended"]} + if s["check"] == "attested": + dec = s.get("attested_by") + r.update(current=None, result="attested" if dec in in_force else "not-read", decision=dec) + else: + val = current.get(s["check"], ReadError("no reader for this check")) + if isinstance(val, ReadError): + r.update(current=None, result="not-read", detail=str(val)) + elif matches(s["recommended"], val): + r.update(current=val, result="matches") + elif s.get("accepted_deviation") in in_force: + r.update(current=val, result="accepted-deviation", decision=s["accepted_deviation"]) + else: + r.update(current=val, result="deviation") + out.append(r) + return out + + +# --- readers -------------------------------------------------------------------------- + +def _guard(fn): + try: + return fn() + except (AwsError, KeyError, TypeError, ValueError, subprocess.SubprocessError, FileNotFoundError) as exc: + return ReadError(f"{type(exc).__name__}: {getattr(exc, 'code', '')}".rstrip(": ")) + + +def _is_read_only(doc): + for st in doc.get("Statement", []) if isinstance(doc.get("Statement"), list) else [doc.get("Statement")]: + if not st or st.get("Effect") != "Allow": + continue + actions = st.get("Action", []) + for a in [actions] if isinstance(actions, str) else actions: + if a == "*" or ":" not in a: + return False + verb = a.split(":", 1)[1] + if not (verb == "GET" or verb.startswith(READ_VERBS)): + return False + return True + + +def _policy_doc(raw): + return json.loads(raw) if isinstance(raw, str) else raw + + +def read_aws(call, pool_id, now=None): + """{check id: value or ReadError} for every AWS-backed check.""" + out = {} + summary = _guard(lambda: call(["iam", "get-account-summary"])["SummaryMap"]) + virtual = _guard(lambda: [d.get("User", {}).get("Arn", "") for d in call( + ["iam", "list-virtual-mfa-devices", "--assignment-status", "Assigned"])["VirtualMFADevices"]]) + + def from_summary(key, conv): + return summary if isinstance(summary, ReadError) else conv(summary[key]) + + out["aws-root-mfa-enabled"] = from_summary("AccountMFAEnabled", lambda v: v == 1) + out["aws-root-access-keys"] = from_summary("AccountAccessKeysPresent", int) + if isinstance(virtual, ReadError) or isinstance(summary, ReadError): + out["aws-root-mfa-type"] = virtual if isinstance(virtual, ReadError) else summary + else: + out["aws-root-mfa-type"] = summary["AccountMFAEnabled"] == 1 and not any(a.endswith(":root") for a in virtual) + + def password_policy(): + try: + return call(["iam", "get-account-password-policy"])["PasswordPolicy"] + except AwsError as e: + if e.code == "NoSuchEntity": + return {} + raise + out["aws-account-password-policy"] = _guard(password_policy) + + def bpa(): + account = call(["sts", "get-caller-identity"])["Account"] + try: + return call(["s3control", "get-public-access-block", "--account-id", account])["PublicAccessBlockConfiguration"] + except AwsError as e: + if e.code == "NoSuchPublicAccessBlockConfiguration": + return {} + raise + out["aws-account-s3-bpa"] = _guard(bpa) + + def users(): + names = [u["UserName"] for u in call(["iam", "list-users"])["Users"]] + groups = {n: [g["GroupName"] for g in call(["iam", "list-groups-for-user", "--user-name", n])["Groups"]] + for n in names} + operators = [n for n in names if OPERATOR_GROUP in groups[n]] + if len(operators) != 1: + raise ValueError(f"expected one member of {OPERATOR_GROUP}, found {len(operators)}") + return names, groups, operators[0] + roster = _guard(users) + if isinstance(roster, ReadError): + for k in ("aws-iam-users", "operator-mfa-enabled", "operator-mfa-type", "operator-console-password", + "operator-access-keys"): + out[k] = roster + else: + names, groups, op = roster + out["aws-iam-users"] = _guard(lambda: sum(1 for n in names if n != op and not _user_read_only(call, n, groups[n]))) + out["operator-mfa-enabled"] = _guard(lambda: len(call(["iam", "list-mfa-devices", "--user-name", op])["MFADevices"]) > 0) + if isinstance(virtual, ReadError): + out["operator-mfa-type"] = virtual + else: + out["operator-mfa-type"] = _guard(lambda: len(call(["iam", "list-mfa-devices", "--user-name", op])["MFADevices"]) > 0 + and not any(a.endswith(f":user/{op}") for a in virtual)) + out["operator-console-password"] = _guard(lambda: _has_login_profile(call, op)) + out["operator-access-keys"] = _guard(lambda: _access_keys(call, op, now)) + + for check, role in ROLES.items(): + out[check] = _guard(lambda role=role: _trust_subjects(call(["iam", "get-role", "--role-name", role])["Role"])) + + def cognito(): + if not pool_id: + raise ValueError("no user pool id was given") + p = call(["cognito-idp", "describe-user-pool", "--region", REGION, "--user-pool-id", pool_id])["UserPool"] + pw = p["Policies"]["PasswordPolicy"] + return {"MfaConfiguration": p.get("MfaConfiguration"), + "AllowAdminCreateUserOnly": p["AdminCreateUserConfig"]["AllowAdminCreateUserOnly"], + **{k: pw.get(k) for k in ("MinimumLength", "RequireUppercase", "RequireLowercase", + "RequireNumbers", "RequireSymbols")}} + out["cognito-pool-policy"] = _guard(cognito) + return out + + +def _has_login_profile(call, user): + try: + call(["iam", "get-login-profile", "--user-name", user]) + return True + except AwsError as e: + if e.code == "NoSuchEntity": + return False + raise + + +def _user_read_only(call, user, groups): + """True when a user can only read: every attached policy is an AWS read-only + policy, every inline policy allows only read verbs, the same for its groups, + and it has no console password.""" + if _has_login_profile(call, user): + return False + managed = [p["PolicyName"] for p in call(["iam", "list-attached-user-policies", "--user-name", user])["AttachedPolicies"]] + inline = [_policy_doc(call(["iam", "get-user-policy", "--user-name", user, "--policy-name", n])["PolicyDocument"]) + for n in call(["iam", "list-user-policies", "--user-name", user])["PolicyNames"]] + for g in groups: + managed += [p["PolicyName"] for p in call(["iam", "list-attached-group-policies", "--group-name", g])["AttachedPolicies"]] + inline += [_policy_doc(call(["iam", "get-group-policy", "--group-name", g, "--policy-name", n])["PolicyDocument"]) + for n in call(["iam", "list-group-policies", "--group-name", g])["PolicyNames"]] + return all(m in READ_ONLY_MANAGED for m in managed) and all(_is_read_only(d) for d in inline) + + +def _access_keys(call, user, now=None): + now = now or datetime.now(timezone.utc) + keys = [k for k in call(["iam", "list-access-keys", "--user-name", user])["AccessKeyMetadata"] if k["Status"] == "Active"] + ages = [(now - datetime.fromisoformat(k["CreateDate"].replace("Z", "+00:00"))).days for k in keys] + return {"active": len(keys), "oldest_age_days": max(ages) if ages else 0} + + +def _trust_subjects(role): + doc = _policy_doc(role["AssumeRolePolicyDocument"]) + subs = [] + for st in doc.get("Statement", []): + for cond in (st.get("Condition") or {}).values(): + v = cond.get(SUB_KEY) + if v is not None: + subs += [v] if isinstance(v, str) else list(v) + return sorted(subs) + + +def read_github(github): + """{check id: value or ReadError} from check-manual-settings' github result.""" + if github.get("status") == "not_observed" or not github.get("facts"): + err = ReadError(github.get("detail") or "GitHub settings were not observed") + return {k: err for k in ("github-prod-reviewer", "github-nightly-branches", "github-main-checks")} + f = github["facts"] + return {"github-prod-reviewer": f["prod_required_reviewers"], + "github-nightly-branches": f["evidence_nightly_branches"], + "github-main-checks": {"required": f["main_required_checks"], "enforced_for": f["main_checks_enforced_for"]}} + + +def _manual_settings(): + spec = importlib.util.spec_from_file_location("manual_settings", REPO / "scripts" / "check-manual-settings.py") + m = importlib.util.module_from_spec(spec) + spec.loader.exec_module(m) + return m + + +# --- output --------------------------------------------------------------------------- + +def build(src, results, now): + tally = {} + for r in results: + tally[r["result"]] = tally.get(r["result"], 0) + 1 + return {"schema": SCHEMA, "emitted_at": now.isoformat(timespec="seconds"), + "guide_version": src["version"], + "guide": "https://samaydlette.com/.well-known/secure-configuration-guide.json", + "description": "Every security setting of the top-level administrative and privileged accounts, read live " + "during the deploy and compared with the Secure Configuration Guide's recommended defaults " + "(SCG-ENH-CMP); this file is the machine-readable export of those settings (SCG-ENH-EXP).", + "summary": dict(sorted(tally.items())), "settings": results} + + +def failures(doc): + return [r for r in doc["settings"] if r["result"] in ("deviation", "not-read")] + + +def _v(v): + return json.dumps(v, sort_keys=True) + + +def render_markdown(doc): + out = ["# Security settings: live comparison with the Secure Configuration Guide", "", + f"- **Read:** {doc['emitted_at']} | **Guide version:** {doc['guide_version']}", + f"- **Summary:** {', '.join(f'{k} {v}' for k, v in doc['summary'].items())}", + f"- {doc['description']}", "", + "| Setting | Account | Recommended | Current | Result | Decision |", "|---|---|---|---|---|---|"] + for r in doc["settings"]: + cur = "—" if r["current"] is None else _v(r["current"]) + out.append(f"| `{r['id']}` | {r['account']} | `{_v(r['recommended'])}` | `{cur}` | {r['result']} | " + f"{r.get('decision', '—')} |") + out += ["", "---", "_Source of truth: the signed `security-settings.json`._"] + return "\n".join(out) + + +def main(argv=None): + ap = argparse.ArgumentParser(description="Compare live account settings with the Secure Configuration Guide.") + ap.add_argument("--source", default=str(SOURCE)) + ap.add_argument("--decisions", default=None) + ap.add_argument("--cognito-pool-id", default="") + ap.add_argument("--github-settings", default=None, + help="a check-manual-settings.py output to take the GitHub facts from (default: read GitHub now)") + ap.add_argument("--output", default="security-settings.json") + ap.add_argument("--md-output", default="security-settings.md") + a = ap.parse_args(argv) + src = json.loads(Path(a.source).read_text()) + in_force = {r["id"] for r in _decisions.in_force(_decisions.load(a.decisions))} + if a.github_settings: + checks = json.loads(Path(a.github_settings).read_text())["checks"] + github = next((c for c in checks if c["id"] == "github_settings"), {"status": "not_observed"}) + else: + github = _manual_settings().check_github() + current = {**read_aws(aws, a.cognito_pool_id), **read_github(github)} + doc = build(src, compare(src, current, in_force), datetime.now(timezone.utc)) + Path(a.output).write_text(json.dumps(doc, indent=2) + "\n") + Path(a.md_output).write_text(render_markdown(doc) + "\n") + bad = failures(doc) + for r in bad: + print(f"::error::secure configuration: {r['id']} is {r['result']}" + + (f" ({r['detail']})" if r.get("detail") else "")) + print(f"security-settings: {doc['summary']}") + return 1 if bad else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/check-wellknown-headers.py b/scripts/check-wellknown-headers.py new file mode 100644 index 00000000..4ea01002 --- /dev/null +++ b/scripts/check-wellknown-headers.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""The public JSON under /.well-known/ is servable to any program (FRC-CSO-JSN). + +Fetches each named artifact over HTTPS from the live site, as a browser on +another origin would (an Origin header), and fails unless the response carries: + + * Access-Control-Allow-Origin: * (CORS: a page on any origin can read it) + * a JSON Content-Type (application/json or application/*+json) + * X-Content-Type-Options: nosniff (the browser keeps that type) + +The headers come from the CloudFront response-headers policy for /.well-known/* +(infrastructure/bootstrap/cloudfront.tf), which the operator applies; this step +is what makes the deploy fail when that apply is missing. Read-only; stdlib only. + + check-wellknown-headers.py --site https://samaydlette.com ksi-signal.json ... + check-wellknown-headers.py --fixture headers.json (tests: {name: {header: value}}) +""" +import argparse +import json +import sys +import urllib.error +import urllib.request + +ORIGIN = "https://example.org" +DEFAULT_ARTIFACTS = ("ksi-signal.json", "security-decision-record.json", "trust-center.json", + "vdr-report.json", "certification-package-overview.json") + + +def problems(headers): + """[reason, ...] for one response's headers (names case-insensitive).""" + h = {k.lower(): (v or "").strip() for k, v in headers.items()} + out = [] + if h.get("access-control-allow-origin") != "*": + out.append(f"Access-Control-Allow-Origin is {h.get('access-control-allow-origin')!r}, not '*'") + ctype = h.get("content-type", "").split(";")[0].strip().lower() + if not (ctype == "application/json" or (ctype.startswith("application/") and ctype.endswith("+json"))): + out.append(f"Content-Type is {ctype or 'absent'!r}, not JSON") + if h.get("x-content-type-options", "").lower() != "nosniff": + out.append("X-Content-Type-Options: nosniff is absent") + return out + + +def fetch(url, timeout=20): + req = urllib.request.Request(url, method="GET", headers={"Origin": ORIGIN, "User-Agent": "samaydlette-header-check"}) + with urllib.request.urlopen(req, timeout=timeout) as resp: # nosec B310: fixed https URL + return dict(resp.headers.items()) + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + ap.add_argument("--site", default="https://samaydlette.com") + ap.add_argument("--fixture", default=None, help="JSON {artifact: {header: value}} instead of the network") + ap.add_argument("artifacts", nargs="*", default=None) + a = ap.parse_args(argv) + if not a.site.startswith("https://"): + print("::error::--site must be an https:// URL", file=sys.stderr) + return 2 + fixture = json.loads(open(a.fixture).read()) if a.fixture else None + names = a.artifacts or (sorted(fixture) if fixture is not None else list(DEFAULT_ARTIFACTS)) + failed = 0 + for name in names: + url = f"{a.site.rstrip('/')}/.well-known/{name}" + try: + headers = fixture[name] if fixture is not None else fetch(url) + except (urllib.error.URLError, OSError, KeyError) as exc: + print(f"::error::{url}: could not be read ({type(exc).__name__})", file=sys.stderr) + failed += 1 + continue + why = problems(headers) + for w in why: + print(f"::error::{url}: {w}", file=sys.stderr) + failed += bool(why) + if not why: + print(f"ok: {url} (CORS *, JSON, nosniff)") + if failed: + print(f"{failed} artifact(s) under /.well-known/ lack the required headers; the deploy does not proceed.", + file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/issue-ocr.py b/scripts/issue-ocr.py new file mode 100644 index 00000000..ba4f6a87 --- /dev/null +++ b/scripts/issue-ocr.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python3 +"""Issue the quarterly Ongoing Certification Report and snapshot the package +(CCM-OCR-AVL, CCM-OCR-SOR, CDS-CSO-HAD). + +On or after each issue date in the CCM calendar, the first run that finds the +date missing from the published index (ocr-issues.json): + +1. builds the frozen report for that date with scripts/build-ocr.py --issue, + covering the previous issue to this one: ocr-issue-.json and .md; +2. copies every certification artifact present in --work (the package as + published at that moment, with its signatures) to snapshots// and + writes the snapshot manifest snapshot-.json (name, sha256, bytes); +3. appends the issue to ocr-issues.json with the report's and manifest's + sha256, the review date and the feedback channel. + +Issued files are never rebuilt: an issue already in the index is carried over +unchanged, and an index that loses or alters an earlier issue fails. The +publishing workflow signs each new file, refuses to overwrite one that is +already served, and checks the served bytes against the index. + +Writes the list of new files to publish (one per line) to --new-files. + + issue-ocr.py --work DIR --previous-index prev-ocr-issues.json --out DIR \ + --new-files issued.txt (plus build-ocr.py's inputs) +""" + +import argparse +import hashlib +import importlib.util +import json +import shutil +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _ccm # noqa: E402 +import _decisions # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +BASE = "https://samaydlette.com/.well-known/" +# What a snapshot holds: the certification data as published, with signatures. +SNAPSHOT = [ + "certification-package-overview.json", "certification-package-overview.md", "certification-package-overview.bundle", + "security-decision-record.json", "security-decision-record.md", "security-decision-record.bundle", + "ongoing-certification-report.json", "ongoing-certification-report.md", "ongoing-certification-report.bundle", + "ksi-signal.json", "ksi-signal.bundle", "vdr-report.json", "vdr-report.bundle", + "vdr-detail-report.json", "vdr-detail-report.bundle", "vdr-accepted-vulnerabilities.json", + "vdr-accepted-vulnerabilities.bundle", "vdr-history.json", "vdr-history.bundle", + "boundary-map.json", "boundary-map.bundle", "policy-index.json", "policy-index.bundle", + "availability.json", "availability.bundle", "trust-center.json", "trust-center.bundle", + "iiw.csv", "iiw.bundle", "fedramp-certification-reports.json", "fedramp-certification-reports.bundle", + "package-submission-log.json", "package-submission-log.bundle", +] +# Without these the snapshot is not the certification data, and nothing is issued. +REQUIRED = ("certification-package-overview.json", "security-decision-record.json", + "ongoing-certification-report.json", "ksi-signal.json") +ACCESS = ("Each issued report is at /.well-known/ocr-issue-.json (and .md), signed (.bundle), and never " + "rewritten. The certification data as published on that date is at /.well-known/snapshots//, " + "each file with its original signature, listed with sha256s in the signed manifest " + "/.well-known/snapshot-.json. Snapshots are kept for the duration of certification. Verify a file: " + "compare its sha256 with the manifest, and its signature with cosign as in docs/verification.md.") + + +def _fail(msg): + raise SystemExit(f"::error::OCR issue: {msg} (fail-closed)") + + +def _sha(path): + return hashlib.sha256(Path(path).read_bytes()).hexdigest() + + +def _ocr_builder(): + spec = importlib.util.spec_from_file_location("build_ocr", REPO / "scripts" / "build-ocr.py") + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +def check_index(prev, cal): + """The previous index, checked: known schema, only calendar dates, in order.""" + if not prev: + return [] + if prev.get("schema") != "ocr-issues/1" or not isinstance(prev.get("issues"), list): + _fail("the published ocr-issues.json is not an ocr-issues/1 index") + dates = [i.get("issueDate") for i in prev["issues"]] + if dates != sorted(dates) or len(set(dates)) != len(dates): + _fail("the published index is out of order or repeats an issue") + for d in dates: + if d not in {x.isoformat() for x in cal.issues}: + _fail(f"the published index lists {d}, which is not a calendar issue date") + return prev["issues"] + + +def snapshot(work, out, issue, fedramp_id, now): + missing = [f for f in REQUIRED if not (work / f).exists()] + if missing: + _fail(f"cannot snapshot the package for {issue}: {', '.join(missing)} missing") + d = out / "snapshots" / issue + d.mkdir(parents=True, exist_ok=True) + files = [] + for name in SNAPSHOT: + src = work / name + if src.exists(): + shutil.copyfile(src, d / name) + files.append({"name": name, "url": f"{BASE}snapshots/{issue}/{name}", "sha256": _sha(src), + "bytes": src.stat().st_size}) + manifest = {"schema": "snapshot/1", "ocrIssue": issue, "takenAt": now.isoformat(), "fedRampId": fedramp_id, + "certificationPackageOverviewUri": fs.CPO_URI, "access": ACCESS, "files": files} + (out / f"snapshot-{issue}.json").write_text(json.dumps(manifest, indent=2) + "\n") + return [f"snapshots/{issue}/{f['name']}" for f in files] + [f"snapshot-{issue}.json"] + + +def run(a, now): + today = now.date() + cal = _ccm.load(a.calendar, today) + off = _offering.load(a.offering) + work, out = Path(a.work), Path(a.out) + out.mkdir(parents=True, exist_ok=True) + prev = json.loads(Path(a.previous_index).read_text()) if a.previous_index and Path(a.previous_index).exists() else {} + issues = list(check_index(prev, cal)) + have = {i["issueDate"] for i in issues} + new_files = [] + ocr = _ocr_builder() + for d in cal.issued(today): + if d.isoformat() in have: + continue + iso = d.isoformat() + name = f"ocr-issue-{iso}" + doc = ocr.build(cal, today, ocr._load_json(a.vdr), _decisions.load(a.decisions), ocr._scn_rows(a.scn_register), + ocr._load_json(a.incidents), ocr.load_feedback(a.feedback), ocr._load_json(a.ksi_signal), + json.loads(Path(a.profile).read_text()), off, {}, now, d) + fs.write_validated(doc, "ocr", out / f"{name}.json") + (out / f"{name}.md").write_text(ocr.render_markdown(doc) + "\n") + snap = snapshot(work, out, iso, off["fedramp_id"], now) + issues.append({"issueDate": iso, "issuedAt": now.isoformat(), "late": today > d, + "reportPeriod": doc["reportPeriod"], + "report": f"{BASE}{name}.json", "reportMarkdown": f"{BASE}{name}.md", + "reportSha256": _sha(out / f"{name}.json"), + "snapshotManifest": f"{BASE}snapshot-{iso}.json", + "snapshotManifestSha256": _sha(out / f"snapshot-{iso}.json"), + "quarterlyReviewDate": cal.review_date(d).isoformat(), + "feedback": _ccm.feedback_url(d)}) + new_files += [f"{name}.json", f"{name}.md", *snap] + issues.sort(key=lambda i: i["issueDate"]) + index = {"schema": "ocr-issues/1", "generated_at": now.isoformat(), "fedRampId": off["fedramp_id"], + "certificationPackageOverviewUri": fs.CPO_URI, + "continuousMonitoring": _ccm.dates_summary(cal, today), "access": ACCESS, "issues": issues} + (out / "ocr-issues.json").write_text(json.dumps(index, indent=2) + "\n") + if a.new_files: + Path(a.new_files).write_text("".join(f + "\n" for f in new_files)) + return index, new_files + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--work", required=True, help="directory holding the package as published") + ap.add_argument("--out", required=True) + ap.add_argument("--previous-index", default=None) + ap.add_argument("--new-files", default=None) + ap.add_argument("--calendar", default=str(_ccm.CALENDAR_PATH)) + ap.add_argument("--offering", default=str(_offering.OFFERING_PATH)) + ap.add_argument("--profile", default=str(REPO / "data" / "system-profile.json")) + ap.add_argument("--vdr", default="vdr-report.json") + ap.add_argument("--decisions", default=str(REPO / "data" / "decisions.json")) + ap.add_argument("--scn-register", default=str(REPO / "docs" / "scn" / "scn-register.csv")) + ap.add_argument("--ksi-signal", default="ksi-signal.json") + ap.add_argument("--incidents", default=str(REPO / "data" / "incidents.json")) + ap.add_argument("--feedback", default=str(REPO / "data" / "ocr-feedback.json")) + a = ap.parse_args(argv) + index, new = run(a, datetime.now(timezone.utc)) + print(f"ocr-issues: {len(index['issues'])} issued; {len([f for f in new if f.startswith('ocr-issue-')]) // 2} " + f"new this run; next {index['continuousMonitoring']['nextOngoingCertificationReportDate']}") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/publish-certification-reports.py b/scripts/publish-certification-reports.py new file mode 100644 index 00000000..6aba2f8c --- /dev/null +++ b/scripts/publish-certification-reports.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python3 +"""Publish FedRAMP Certification Reports unmodified (CDS-CSO-FRC). + +Reads data/fedramp-certification-reports/register.json, checks every listed +report's bytes against its recorded sha256 (an edited report fails closed: the +rule forbids inappropriate modification), copies each byte-identical to +--out/fedramp-certification-reports/, and writes the signed index +--out/fedramp-certification-reports.json. The index carries over each report's +first publication date from the previously published index, so the days from +receipt to publication (FedRAMP's window: 2 weeks) are a matter of record; a +report first published late is flagged late, never hidden. + +SIMULATED: no FedRAMP counterpart exists for this proof of concept. The one +report is a stand-in the operator wrote, flagged simulated; nothing was +received from FedRAMP and nothing is sent anywhere. + + publish-certification-reports.py --out DIR --previous prev.json +""" + +import argparse +import hashlib +import json +import shutil +import sys +from datetime import date, datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +REPORTS_DIR = REPO / "data" / "fedramp-certification-reports" +BASE = "https://samaydlette.com/.well-known/fedramp-certification-reports/" +WINDOW_DAYS = 14 +SIMULATION = ("FedRAMP is simulated: this proof of concept has no FedRAMP counterpart. The report listed is a " + "plainly fake stand-in the operator wrote to exercise this path; nothing was received from FedRAMP.") + + +def _fail(msg): + raise SystemExit(f"::error::FedRAMP certification reports: {msg} (fail-closed)") + + +def load_register(reports_dir=REPORTS_DIR, today=None): + today = today or datetime.now(timezone.utc).date() + reports_dir = Path(reports_dir) + try: + reg = json.loads((reports_dir / "register.json").read_text()) + except (OSError, ValueError) as exc: + _fail(f"register unreadable: {exc}") + if reg.get("schema") != "fedramp-certification-reports/1" or not isinstance(reg.get("reports"), list): + _fail("register is not a fedramp-certification-reports/1 document") + listed = set() + for r in reg["reports"]: + f = r.get("file") + if not isinstance(f, str) or "/" in f or f.startswith(".") or f in listed: + _fail(f"bad or repeated file name {f!r}") + listed.add(f) + try: + received = date.fromisoformat(r.get("received_on", "")) + except ValueError: + _fail(f"{f}: received_on is not a date") + if received > today: + _fail(f"{f}: received_on {received} is in the future") + p = reports_dir / f + if not p.is_file(): + _fail(f"{f} is listed but not present") + if hashlib.sha256(p.read_bytes()).hexdigest() != r.get("sha256"): + _fail(f"{f} differs from the sha256 recorded when it was received: reports are published unmodified") + unlisted = {p.name for p in reports_dir.iterdir() if p.is_file()} - listed - {"register.json"} + if unlisted: + _fail(f"files not in the register: {sorted(unlisted)}") + return reg + + +def build(reg, previous, now, out, reports_dir=REPORTS_DIR): + today = now.date() + first = {e["file"]: e["firstPublished"] for e in (previous or {}).get("reports", []) + if isinstance(e, dict) and e.get("file") and e.get("firstPublished")} + (out / "fedramp-certification-reports").mkdir(parents=True, exist_ok=True) + entries = [] + for r in reg["reports"]: + shutil.copyfile(Path(reports_dir) / r["file"], out / "fedramp-certification-reports" / r["file"]) + published = first.get(r["file"], today.isoformat()) + days = (date.fromisoformat(published) - date.fromisoformat(r["received_on"])).days + entries.append({"file": r["file"], "url": BASE + r["file"], "sha256": r["sha256"], + "receivedOn": r["received_on"], "from": r["from"], "firstPublished": published, + "daysToPublish": days, "withinTwoWeeks": days <= WINDOW_DAYS, + "simulated": bool(r.get("simulated"))}) + return {"schema": "fedramp-certification-reports-index/1", "generated_at": now.isoformat(), + "fedRampId": _offering.fedramp_id(), "certificationPackageOverviewUri": fs.CPO_URI, + "simulated": {"counterparty": "fedramp", "how": SIMULATION}, + "rule": "CDS-CSO-FRC: FedRAMP Certification Reports are included unmodified and made available within " + "2 weeks of receipt.", + "reports": entries} + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--reports-dir", default=str(REPORTS_DIR)) + ap.add_argument("--previous", default=None) + ap.add_argument("--out", default=".") + a = ap.parse_args(argv) + now = datetime.now(timezone.utc) + reg = load_register(a.reports_dir, now.date()) + prev = {} + if a.previous and Path(a.previous).exists(): + try: + prev = json.loads(Path(a.previous).read_text()) + except ValueError: + prev = {} + out = Path(a.out) + idx = build(reg, prev, now, out, a.reports_dir) + (out / "fedramp-certification-reports.json").write_text(json.dumps(idx, indent=2) + "\n") + for e in idx["reports"]: + if not e["withinTwoWeeks"]: + print(f"::warning::{e['file']} was first published {e['daysToPublish']} days after receipt") + print(f"fedramp-certification-reports: {len(idx['reports'])} report(s) published unmodified (simulated FedRAMP)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/reconcile.py b/scripts/reconcile.py index 5f187a81..3e8abd7d 100644 --- a/scripts/reconcile.py +++ b/scripts/reconcile.py @@ -369,12 +369,20 @@ def check_c_suppressions(checkov_skips, register, vdr): # ---------------------------------------------------------------------------- # (d) impact level identical; nothing asserts Low # ---------------------------------------------------------------------------- +def sdr_fields(sdr): + """Where a CR26 report (the SDR, the CPO) keeps its site-specific fields: + under providerExtensions since it follows FedRAMP's schema (the top level is + FedRAMP's). A report in the older shape keeps them at the top level.""" + pe = sdr.get("providerExtensions") + return pe if isinstance(pe, dict) else sdr + + def extract_impacts(signal, sdr, cpo, vdr, dashboard_html): impacts = {} impacts["signal"] = normalize_impact( signal.get("categorization", {}).get("impact_level")) - impacts["sdr"] = normalize_impact(sdr.get("impact_level")) - impacts["cpo"] = normalize_impact(cpo.get("impact_level")) + impacts["sdr"] = normalize_impact(sdr_fields(sdr).get("impact_level")) + impacts["cpo"] = normalize_impact(sdr_fields(cpo).get("impact_level")) impacts["vdr"] = normalize_impact(vdr.get("impact_level") or ("class " + vdr.get("class", "")).strip()) # dashboard (the trust center page, website/trust/index.html): its static @@ -406,7 +414,7 @@ def check_e_binding(signal, sdr, cpo, vdr): sid = signal.get("signal_id") if not sid: return ["(e) signal has no signal_id"] - for art, doc in (("vdr", vdr), ("sdr", sdr), ("cpo", cpo)): + for art, doc in (("vdr", vdr), ("sdr", sdr_fields(sdr)), ("cpo", sdr_fields(cpo))): got = doc.get("ksi_signal_id") if got != sid: violations.append(f"(e) {art} signal_id {got!r} != inventory signal_id {sid!r}") diff --git a/scripts/submit-package.py b/scripts/submit-package.py new file mode 100644 index 00000000..faf1e677 --- /dev/null +++ b/scripts/submit-package.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python3 +"""Simulated submission of the FedRAMP Certification Package (FRC-CSO-PKG). + +FRC-CSO-PKG: the package supplied to FedRAMP holds at least the Certification +Package Overview (CPO-CSO-OVR), the Security Decision Record with every +applicable rule (SDR-CSO-FRR), and an Ongoing Certification Report +(CCM-OCR-AVL). On every deploy this: + +1. checks the three reports this build is about to publish: each validates + against FedRAMP's schema, the SDR lists every applicable rule once, and all + carry the same FedRAMP ID; +2. builds a submission manifest (each report's sha256 and version, and a + package digest over their content hashes); +3. hands it to the simulated FedRAMP intake below, a function in this file, + and checks the receipt echoes the digest; +4. appends an entry to the published log (package-submission-log.json) when + the package changed since the last entry; earlier entries must be carried + over unchanged. + +NOTHING IS SENT. There is no network call: FedRAMP is simulated, and the +"submission" is this log entry. Any unexpected outcome fails the deploy. + + submit-package.py --cpo certification-package-overview.json \ + --sdr security-decision-record.json --ocr ongoing-certification-report.json \ + --previous prev-log.json --output package-submission-log.json --commit SHA +""" + +import argparse +import hashlib +import json +import sys +from datetime import datetime, timezone +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 +import _rules # noqa: E402 + +BASE = "https://samaydlette.com/.well-known/" +SIMULATION = ("FedRAMP is simulated. The package goes to simulated_fedramp_intake() in scripts/submit-package.py, " + "a function that never touches the network, and the only trace is this signed log. Nothing has been " + "submitted to the real FedRAMP, and nothing will be.") + + +def _fail(msg): + raise SystemExit(f"::error::package submission: {msg} (fail-closed)") + + +def simulated_fedramp_intake(manifest): + """The simulated counterparty. Accepts any well-formed manifest and returns + a receipt; it is obviously not FedRAMP.""" + return {"receiptId": "SIM-" + manifest["packageSha256"][:12].upper(), + "receivedBy": "Simulated FedRAMP intake: a Python function in this repository. Nothing left the building.", + "packageSha256": manifest["packageSha256"], + "message": "Thank you for your submission. It has been placed in a queue that does not exist."} + + +PROGRAM = "20x" # FRC-CSO-POP: one program sought (DEC-107) + + +# CPO-CSO-OVR content the schema leaves optional but the rules require here: +# the trust center and secure configuration guidance (CDS-CSO-PUB), the +# third-party resources (MAS-CSO-TPR) and the assessor's overall summary +# (CPO-CSO-OSA). +CPO_REQUIRED = (("serviceProperties", "trustCenter"), ("serviceProperties", "secureConfigurationGuidance"), + ("thirdPartyInformationResources",), + ("providerExtensions", "independentAssessment", "overallSummary")) + + +def cpo_gaps(cpo): + out = [] + for path in CPO_REQUIRED: + node = cpo + for k in path: + node = node.get(k) if isinstance(node, dict) else None + if not node: + out.append(".".join(path)) + return out + + +def check_components(docs, applicable, fedramp_id): + for kind, doc in docs.items(): + errs = fs.validate(doc, kind) + if errs: + _fail(f"the {kind.upper()} does not validate against FedRAMP's schema: {errs[0]}") + missing = cpo_gaps(docs["cpo"]) + if missing: + _fail(f"the CPO is incomplete (CPO-CSO-OVR): no {', '.join(missing)}") + if docs["cpo"]["serviceIdentification"]["certificationType"] != PROGRAM: + _fail(f"the CPO's certificationType is not {PROGRAM}: this offering seeks one program only (FRC-CSO-POP)") + ids = [r["frrID"] for r in docs["sdr"]["fedRampRequirements"]] + if sorted(ids) != sorted(applicable) or len(ids) != len(set(ids)): + _fail("the SDR does not list every applicable FedRAMP rule exactly once (SDR-CSO-FRR)") + got = {"cpo": docs["cpo"]["serviceIdentification"]["fedRampPackageId"], + "sdr": (docs["sdr"].get("providerExtensions") or {}).get("fedRampId"), + "ocr": (docs["ocr"].get("providerExtensions") or {}).get("fedRampId")} + wrong = sorted(k for k, v in got.items() if v != fedramp_id) + if wrong: + _fail(f"{', '.join(wrong)} carry a FedRAMP ID other than the offering's (CDS-CSO-FID)") + + +def manifest_for(docs, paths, commit): + """Each report's bytes (sha256) and content (its contentSha256, which leaves + out the timestamp): the log gains an entry when the content changes.""" + comps = [] + for kind, rule, name in (("cpo", "CPO-CSO-OVR", "certification-package-overview.json"), + ("sdr", "SDR-CSO-FRR", "security-decision-record.json"), + ("ocr", "CCM-OCR-AVL", "ongoing-certification-report.json")): + raw = Path(paths[kind]).read_bytes() + content = (docs[kind].get("providerExtensions") or {}).get("contentSha256") + if not content: + _fail(f"the {kind.upper()} carries no contentSha256") + comps.append({"component": kind.upper(), "rule": rule, "url": BASE + name, + "sha256": hashlib.sha256(raw).hexdigest(), "contentSha256": content, + "version": (docs[kind].get("metadata") or {}).get("version")}) + digest = hashlib.sha256("".join(c["contentSha256"] for c in comps).encode()).hexdigest() + return {"components": comps, "packageSha256": digest, "commit": commit} + + +def build(docs, paths, previous, now, commit, applicable, fedramp_id): + check_components(docs, applicable, fedramp_id) + entries = list((previous or {}).get("entries") or []) + for e in entries: + if not isinstance(e, dict) or not {"submittedAt", "manifest", "receipt"} <= set(e): + _fail("the previous log has a malformed entry; earlier entries are carried over unchanged") + manifest = manifest_for(docs, paths, commit) + receipt = simulated_fedramp_intake(manifest) + if receipt.get("packageSha256") != manifest["packageSha256"]: + _fail("the simulated intake's receipt does not echo the package digest") + if not entries or entries[-1]["manifest"]["packageSha256"] != manifest["packageSha256"]: + entries.append({"submittedAt": now.isoformat(), "manifest": manifest, "receipt": receipt}) + return {"schema": "package-submission-log/1", "generated_at": now.isoformat(), "fedRampId": fedramp_id, + "certificationPackageOverviewUri": fs.CPO_URI, "nothingSent": True, + "simulated": {"counterparty": "fedramp", "how": SIMULATION}, "entries": entries} + + +def main(argv=None): + ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + ap.add_argument("--cpo", default="certification-package-overview.json") + ap.add_argument("--sdr", default="security-decision-record.json") + ap.add_argument("--ocr", default="ongoing-certification-report.json") + ap.add_argument("--previous", default=None) + ap.add_argument("--output", default="package-submission-log.json") + ap.add_argument("--commit", default="") + a = ap.parse_args(argv) + paths = {"cpo": a.cpo, "sdr": a.sdr, "ocr": a.ocr} + docs = {} + for k, p in paths.items(): + try: + docs[k] = json.loads(Path(p).read_text()) + except (OSError, ValueError) as exc: + _fail(f"cannot read the {k.upper()} ({p}): {exc}") + prev = {} + if a.previous and Path(a.previous).exists(): + try: + prev = json.loads(Path(a.previous).read_text()) + except ValueError: + _fail("the previously published log is not JSON; refusing to start a new log over it") + if prev and prev.get("schema") != "package-submission-log/1": + _fail("the previously published log is not a package-submission-log/1 document") + log = build(docs, paths, prev, datetime.now(timezone.utc), a.commit, _rules.applicable_provider_rules(), + _offering.fedramp_id()) + Path(a.output).write_text(json.dumps(log, indent=2) + "\n") + last = log["entries"][-1] + print(f"package-submission-log: {len(log['entries'])} entr(ies); latest {last['receipt']['receiptId']} " + "(simulated FedRAMP; nothing sent)") + return 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/scripts/sync-ksi-catalog.py b/scripts/sync-ksi-catalog.py new file mode 100644 index 00000000..199c3a8d --- /dev/null +++ b/scripts/sync-ksi-catalog.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python3 +"""Keep infrastructure/schemas/ksi-catalog.json equal to the pinned FedRAMP rules. + +The catalog's KSI block (IDs, names, statements and KSI->control mappings) is +FedRAMP's, so it is derived from the vendored, hash-checked Consolidated Rules +(scripts/_rules.py), never edited by hand. FedRAMP revises mappings between +releases (for example on 2026-10-13); re-pinning the rules and re-running this +script carries the change, and tests/test_ksi_catalog_corpus.py fails while +the two disagree. + +Control titles come from the vendored NIST SP 800-53 Rev5 catalog. The per-KSI impact flags are the catalog's +own (the corpus does not carry them) and are kept. + + sync-ksi-catalog.py rewrite the catalog + sync-ksi-catalog.py --check exit 1 if it differs from the corpus +""" + +import argparse +import json +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +import _rules # noqa: E402 + +REPO = Path(__file__).resolve().parent.parent +CATALOG = REPO / "infrastructure" / "schemas" / "ksi-catalog.json" +NIST = REPO / "data" / "catalogs" / "NIST_SP-800-53_rev5_catalog.json" + + +def _fail(msg): + raise SystemExit(f"::error::KSI catalog: {msg} (fail-closed)") + + +def _titles(): + out = {} + + def walk(group): + for c in group.get("controls", []) or []: + out[c["id"]] = c["title"] + walk(c) + for g in group.get("groups", []) or []: + walk(g) + walk(json.loads(NIST.read_text())["catalog"]) + return out + + +def derive(catalog, rules_dir=_rules.RULES_DIR): + """The catalog with its KSI block rebuilt from the pinned corpus.""" + rules, _ = _rules.load_rules(rules_dir) + titles = _titles() + old_impact = {i["id"]: i.get("impact") for f in catalog.get("KSI", {}).values() + for i in f.get("indicators", [])} + ksi = {} + for fam_id, fam in rules["KSI"].items(): + indicators = [] + for kid, k in fam["indicators"].items(): + controls = [] + for c in k.get("controls", []) or []: + cid = str(c).lower() + if cid not in titles: + _fail(f"{kid} maps {cid}, which is not in the NIST SP 800-53 Rev5 catalog") + controls.append({"control_id": cid, "title": titles[cid]}) + if kid not in old_impact: + _fail(f"{kid} is new in the corpus; set its impact flags in the catalog first") + # Class C's statement where the KSI varies by class (five do). + statement = ((k.get("varies_by_class") or {}).get(_rules.CERT_CLASS) or k).get("statement") + if not isinstance(statement, str): + _fail(f"{kid} has no Class {_rules.CERT_CLASS.upper()} statement") + indicators.append({"id": kid, "name": k["name"], "statement": statement, + "impact": old_impact[kid], "controls": controls}) + ksi[fam_id] = {"id": fam["id"], "name": fam["name"], "indicators": indicators} + out = dict(catalog) + out["KSI"] = ksi + return out + + +def main(argv=None): + ap = argparse.ArgumentParser() + ap.add_argument("--check", action="store_true") + a = ap.parse_args(argv) + current = json.loads(CATALOG.read_text()) + want = derive(current) + if a.check: + if want != current: + print("::error::infrastructure/schemas/ksi-catalog.json differs from the pinned FedRAMP rules; " + "run scripts/sync-ksi-catalog.py and review the diff") + return 1 + return 0 + CATALOG.write_text(json.dumps(want, indent=2, ensure_ascii=False) + "\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/verify-published.sh b/scripts/verify-published.sh index f6b59456..31386395 100755 --- a/scripts/verify-published.sh +++ b/scripts/verify-published.sh @@ -45,6 +45,10 @@ IDENTITY='https://github.com/sam-aydlette/samaydlette.com/.github/workflows/depl # a person with a key. Everything else — the canonical inventory, the SDR — # still verifies against the deploy identity alone. NIGHTLY_IDENTITY='https://github.com/sam-aydlette/samaydlette.com/.github/workflows/evidence-nightly.yml@refs/heads/main' +# The certification package (SDR, CPO, OCR) has a second publisher for the same +# reason: package-maintenance.yml rebuilds it daily at the deployed commit, so +# it stays inside CPO-CSX-CPM's two-week window without a reviewed deploy. +MAINT_IDENTITY='https://github.com/sam-aydlette/samaydlette.com/.github/workflows/package-maintenance.yml@refs/heads/main' ISSUER='https://token.actions.githubusercontent.com' SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" @@ -92,6 +96,7 @@ for f in ksi-signal.json ksi-signal.bundle \ security-decision-record.json security-decision-record.bundle \ security-decision-record.json.intoto.jsonl \ certification-package-overview.json certification-package-overview.bundle \ + ongoing-certification-report.json ongoing-certification-report.bundle \ vdr-report.json vdr-report.json.intoto.jsonl \ vdr-detail-report.json vdr-detail-report.bundle \ vdr-accepted-vulnerabilities.json vdr-accepted-vulnerabilities.bundle \ @@ -115,7 +120,7 @@ else fi if verify_attestation_any_identity "$work/security-decision-record.json.intoto.jsonl" \ - "$work/security-decision-record.json" "$IDENTITY"; then + "$work/security-decision-record.json" "$IDENTITY" "$MAINT_IDENTITY"; then ok "security-decision-record.json attestation signed by the pinned workflow on main" else bad "security-decision-record.json attestation signature" @@ -123,13 +128,18 @@ fi # The CR26 record (SDR, CPO) and the trust center's own data: the generated # boundary map, the gate's report and the trust center itself. -for art in security-decision-record certification-package-overview boundary-map reconcile-report trust-center; do - if verify_blob_any_identity "$work/$art.bundle" "$work/$art.json" "$IDENTITY"; then +for art in security-decision-record certification-package-overview boundary-map reconcile-report trust-center ongoing-certification-report; do + ids="$IDENTITY" + case "$art" in + security-decision-record|certification-package-overview|ongoing-certification-report) ids="$IDENTITY $MAINT_IDENTITY" ;; + esac + # shellcheck disable=SC2086 # a word list by design + if verify_blob_any_identity "$work/$art.bundle" "$work/$art.json" $ids; then ok "$art.json signed by the pinned workflow on main" else bad "$art.json signature" fi - if [ "$(jq -r .ksi_signal_id "$work/$art.json")" = "$(jq -r .signal_id "$work/ksi-signal.json")" ]; then + if [ "$(jq -r '.ksi_signal_id // .providerExtensions.ksi_signal_id' "$work/$art.json")" = "$(jq -r .signal_id "$work/ksi-signal.json")" ]; then ok "$art.json is bound to the published inventory" else bad "$art.json names a different inventory than ksi-signal.json" diff --git a/tests/fixtures/agency-access/overdue-denial.json b/tests/fixtures/agency-access/overdue-denial.json new file mode 100644 index 00000000..28252a43 --- /dev/null +++ b/tests/fixtures/agency-access/overdue-denial.json @@ -0,0 +1,7 @@ +{ + "schema": "agency-access/1", + "_note": "Known-bad: a denial on 2026-11-02 with no FedRAMP notice; the 5-business-day window closed on 2026-11-09. Validation as of 2026-11-10 must fail.", + "requests": [ + {"id": "AAR-B01", "agency": "Bureau of Known-Bad Fixtures (simulated)", "kind": "access", "channel": "issue form", "received_on": "2026-11-02", "decision": "denied", "decided_on": "2026-11-02", "decided_by": "Operator", "reason": "Fixture."} + ] +} diff --git a/tests/fixtures/agency-access/person-in-register.json b/tests/fixtures/agency-access/person-in-register.json new file mode 100644 index 00000000..24a7e322 --- /dev/null +++ b/tests/fixtures/agency-access/person-in-register.json @@ -0,0 +1,7 @@ +{ + "schema": "agency-access/1", + "_note": "Known-bad: the register names a person's email address; it records agencies and systems only.", + "requests": [ + {"id": "AAR-B02", "agency": "Bureau of Known-Bad Fixtures (simulated)", "kind": "access", "channel": "jane.doe@example.gov", "received_on": "2026-11-02"} + ] +} diff --git a/tests/fixtures/assessor-guide/unknown-evidence-kind.json b/tests/fixtures/assessor-guide/unknown-evidence-kind.json new file mode 100644 index 00000000..d71db381 --- /dev/null +++ b/tests/fixtures/assessor-guide/unknown-evidence-kind.json @@ -0,0 +1,8 @@ +{ + "schema": "frr-records/1", + "$comment": "Known bad: evidence of a kind the assessor guide cannot tell an assessor how to reproduce.", + "records": [ + {"frr_id": "CDS-CSO-CBF", "status": "Implemented", "implementation": "x", + "evidence": [{"kind": "vibes", "ref": "trust me"}]} + ] +} diff --git a/tests/fixtures/assessor/simulated-set-tampered.json b/tests/fixtures/assessor/simulated-set-tampered.json new file mode 100644 index 00000000..f9483465 --- /dev/null +++ b/tests/fixtures/assessor/simulated-set-tampered.json @@ -0,0 +1,103 @@ +{ + "assessment_type": "simulated-independent-assessment", + "schema_version": "1", + "simulated": true, + "fedramp_recognized": false, + "assessor_id": "NOT-A-REAL-ASSESSOR-ID", + "disclaimer": "SIMULATED. Totally Real Assessment Services, LLC is a GitHub Actions workflow in the provider's own repository, wearing a lanyard. It is not independent, it is not a FedRAMP Recognized independent assessment service, its assessor ID is NOT-A-REAL-ASSESSOR-ID, and nothing here is a FedRAMP independent assessment. It exists to show the assessor port working end to end. Our rates are very competitive: free.", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "subject": { + "site": "https://samaydlette.com", + "commit": "0000000000000000000000000000000000000000", + "assessor_guide_sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + }, + "results": { + "rules": { + "pass": 1, + "observation": 1, + "fail": 0 + }, + "ksis": { + "pass": 1, + "observation": 0, + "fail": 0 + } + }, + "records": [ + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-SDR-CSO-FRR", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of rule SDR-CSO-FRR, not a FedRAMP Recognized assessment. Result: Pass with flying colours. Independent verification: test tests/test_sdr.py::test_every_applicable_rule_is_listed_once passed (re-run by the assessor). Independent validation: security-decision-record.json served; signature verified (deploy identity); 3h old (window 720h).", + "rule_id": "SDR-CSO-FRR", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "632106e406c8aed713dee1a91fc1b2c0053eeb8b280866b7fe72e3f6ba741358", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-CDS-CSO-RPS", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of rule CDS-CSO-RPS, not a FedRAMP Recognized assessment. Result: Pass with observation. Independent verification: Not Applicable (MAY): example. Independent validation: policy-index.json is not yet published; it is first published by the deploy under assessment, and validated at the next assessment.", + "rule_id": "CDS-CSO-RPS", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "7c82618e3c8f080db94cf5a0f9e77efa81b7276bf634add6294c121a72107dbd", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-KSI-CED-RAT", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of KSI KSI-CED-RAT, not a FedRAMP Recognized assessment. Result: Pass. Independent verification: in the published signal sig-1 with status pass by method documentation. Independent validation: KSI signal served and its signature verified (deploy identity).", + "rule_id": "KSI-CED-RAT", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "5f529cd3c3f006eac63f176f1e8baac1ce8cc23cae3dbd413ede1b76eb606fdd", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-SUMMARY", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "summary", + "text": "Overall summary (IVV-IAS-OSA), SIMULATED. Totally Real Assessment Services, LLC (simulated) verified and validated all 2 applicable FedRAMP rules and all 1 Key Security Indicators for commit 0000000000000000000000000000000000000000: rules 1 pass, 1 pass with observation, 0 fail; KSIs 1 pass, 0 pass with observation, 0 fail. Failures: none. Areas of dispute: none. Observations: CDS-CSO-RPS: policy-index.json is not yet published; it is first published by the deploy under assessment, and validated at the next assessment. SIMULATED. Totally Real Assessment Services, LLC is a GitHub Actions workflow in the provider's own repository, wearing a lanyard. It is not independent, it is not a FedRAMP Recognized independent assessment service, its assessor ID is NOT-A-REAL-ASSESSOR-ID, and nothing here is a FedRAMP independent assessment. It exists to show the assessor port working end to end. Our rates are very competitive: free.", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "807d840be4064f51bc9ab05e8d6814b0611981b42d1fb37b5ba86d78b927b136", + "signed_set": "simulated-assessment.json" + } + } + ] +} diff --git a/tests/fixtures/assessor/simulated-set.json b/tests/fixtures/assessor/simulated-set.json new file mode 100644 index 00000000..eb8372b1 --- /dev/null +++ b/tests/fixtures/assessor/simulated-set.json @@ -0,0 +1,103 @@ +{ + "assessment_type": "simulated-independent-assessment", + "schema_version": "1", + "simulated": true, + "fedramp_recognized": false, + "assessor_id": "NOT-A-REAL-ASSESSOR-ID", + "disclaimer": "SIMULATED. Totally Real Assessment Services, LLC is a GitHub Actions workflow in the provider's own repository, wearing a lanyard. It is not independent, it is not a FedRAMP Recognized independent assessment service, its assessor ID is NOT-A-REAL-ASSESSOR-ID, and nothing here is a FedRAMP independent assessment. It exists to show the assessor port working end to end. Our rates are very competitive: free.", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "subject": { + "site": "https://samaydlette.com", + "commit": "0000000000000000000000000000000000000000", + "assessor_guide_sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + }, + "results": { + "rules": { + "pass": 1, + "observation": 1, + "fail": 0 + }, + "ksis": { + "pass": 1, + "observation": 0, + "fail": 0 + } + }, + "records": [ + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-SDR-CSO-FRR", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of rule SDR-CSO-FRR, not a FedRAMP Recognized assessment. Result: Pass. Independent verification: test tests/test_sdr.py::test_every_applicable_rule_is_listed_once passed (re-run by the assessor). Independent validation: security-decision-record.json served; signature verified (deploy identity); 3h old (window 720h).", + "rule_id": "SDR-CSO-FRR", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "632106e406c8aed713dee1a91fc1b2c0053eeb8b280866b7fe72e3f6ba741358", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-CDS-CSO-RPS", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of rule CDS-CSO-RPS, not a FedRAMP Recognized assessment. Result: Pass with observation. Independent verification: Not Applicable (MAY): example. Independent validation: policy-index.json is not yet published; it is first published by the deploy under assessment, and validated at the next assessment.", + "rule_id": "CDS-CSO-RPS", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "7c82618e3c8f080db94cf5a0f9e77efa81b7276bf634add6294c121a72107dbd", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-KSI-CED-RAT", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "finding", + "text": "SIMULATED assessment of KSI KSI-CED-RAT, not a FedRAMP Recognized assessment. Result: Pass. Independent verification: in the published signal sig-1 with status pass by method documentation. Independent validation: KSI signal served and its signature verified (deploy identity).", + "rule_id": "KSI-CED-RAT", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "5f529cd3c3f006eac63f176f1e8baac1ce8cc23cae3dbd413ede1b76eb606fdd", + "signed_set": "simulated-assessment.json" + } + }, + { + "record_type": "assessor-record", + "schema_version": "1", + "record_id": "TRAS-20261105T120000Z-SUMMARY", + "assessor": { + "organization": "Totally Real Assessment Services, LLC (simulated)", + "key_id": "sigstore-keyless:simulated-assessor.yml" + }, + "issued_at": "2026-11-05T12:00:00+00:00", + "kind": "summary", + "text": "Overall summary (IVV-IAS-OSA), SIMULATED. Totally Real Assessment Services, LLC (simulated) verified and validated all 2 applicable FedRAMP rules and all 1 Key Security Indicators for commit 0000000000000000000000000000000000000000: rules 1 pass, 1 pass with observation, 0 fail; KSIs 1 pass, 0 pass with observation, 0 fail. Failures: none. Areas of dispute: none. Observations: CDS-CSO-RPS: policy-index.json is not yet published; it is first published by the deploy under assessment, and validated at the next assessment. SIMULATED. Totally Real Assessment Services, LLC is a GitHub Actions workflow in the provider's own repository, wearing a lanyard. It is not independent, it is not a FedRAMP Recognized independent assessment service, its assessor ID is NOT-A-REAL-ASSESSOR-ID, and nothing here is a FedRAMP independent assessment. It exists to show the assessor port working end to end. Our rates are very competitive: free.", + "signature": { + "algorithm": "SIGSTORE_KEYLESS_SET", + "value": "807d840be4064f51bc9ab05e8d6814b0611981b42d1fb37b5ba86d78b927b136", + "signed_set": "simulated-assessment.json" + } + } + ] +} diff --git a/tests/fixtures/availability/known-bad-stale-feed.json b/tests/fixtures/availability/known-bad-stale-feed.json new file mode 100644 index 00000000..14961cf8 --- /dev/null +++ b/tests/fixtures/availability/known-bad-stale-feed.json @@ -0,0 +1,2 @@ +{"feed_type": "availability-status", "generated_at": "2026-10-01T00:00:00Z", + "samples": [{"t": "2026-10-01T00:00:00Z", "probed": ["site"], "fail": {}}]} diff --git a/tests/fixtures/cycle/bad/calendar-irregular-gap.json b/tests/fixtures/cycle/bad/calendar-irregular-gap.json new file mode 100644 index 00000000..c4da590d --- /dev/null +++ b/tests/fixtures/cycle/bad/calendar-irregular-gap.json @@ -0,0 +1,60 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-24", + "2027-02-23", + "2027-08-24", + "2027-11-23", + "2028-02-29", + "2028-05-30", + "2028-08-29", + "2028-11-28" + ], + "review_business_days_after_issue": 5, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", + "2026-01-19", + "2026-02-16", + "2026-05-25", + "2026-06-19", + "2026-07-03", + "2026-09-07", + "2026-10-12", + "2026-11-11", + "2026-11-26", + "2026-12-25", + "2027-01-01", + "2027-01-18", + "2027-02-15", + "2027-05-31", + "2027-06-18", + "2027-07-05", + "2027-09-06", + "2027-10-11", + "2027-11-11", + "2027-11-25", + "2027-12-24", + "2027-12-31", + "2028-01-17", + "2028-02-21", + "2028-05-29", + "2028-06-19", + "2028-07-04", + "2028-09-04", + "2028-10-09", + "2028-11-10", + "2028-11-23", + "2028-12-25" + ] + } +} diff --git a/tests/fixtures/cycle/bad/calendar-issue-on-holiday.json b/tests/fixtures/cycle/bad/calendar-issue-on-holiday.json new file mode 100644 index 00000000..a35b794a --- /dev/null +++ b/tests/fixtures/cycle/bad/calendar-issue-on-holiday.json @@ -0,0 +1,61 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-26", + "2027-02-23", + "2027-05-25", + "2027-08-24", + "2027-11-23", + "2028-02-29", + "2028-05-30", + "2028-08-29", + "2028-11-28" + ], + "review_business_days_after_issue": 5, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", + "2026-01-19", + "2026-02-16", + "2026-05-25", + "2026-06-19", + "2026-07-03", + "2026-09-07", + "2026-10-12", + "2026-11-11", + "2026-11-26", + "2026-12-25", + "2027-01-01", + "2027-01-18", + "2027-02-15", + "2027-05-31", + "2027-06-18", + "2027-07-05", + "2027-09-06", + "2027-10-11", + "2027-11-11", + "2027-11-25", + "2027-12-24", + "2027-12-31", + "2028-01-17", + "2028-02-21", + "2028-05-29", + "2028-06-19", + "2028-07-04", + "2028-09-04", + "2028-10-09", + "2028-11-10", + "2028-11-23", + "2028-12-25" + ] + } +} diff --git a/tests/fixtures/cycle/bad/calendar-mid-quarter.json b/tests/fixtures/cycle/bad/calendar-mid-quarter.json new file mode 100644 index 00000000..375090cd --- /dev/null +++ b/tests/fixtures/cycle/bad/calendar-mid-quarter.json @@ -0,0 +1,61 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-24", + "2027-02-16", + "2027-05-25", + "2027-08-24", + "2027-11-23", + "2028-02-29", + "2028-05-30", + "2028-08-29", + "2028-11-28" + ], + "review_business_days_after_issue": 5, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", + "2026-01-19", + "2026-02-16", + "2026-05-25", + "2026-06-19", + "2026-07-03", + "2026-09-07", + "2026-10-12", + "2026-11-11", + "2026-11-26", + "2026-12-25", + "2027-01-01", + "2027-01-18", + "2027-02-15", + "2027-05-31", + "2027-06-18", + "2027-07-05", + "2027-09-06", + "2027-10-11", + "2027-11-11", + "2027-11-25", + "2027-12-24", + "2027-12-31", + "2028-01-17", + "2028-02-21", + "2028-05-29", + "2028-06-19", + "2028-07-04", + "2028-09-04", + "2028-10-09", + "2028-11-10", + "2028-11-23", + "2028-12-25" + ] + } +} diff --git a/tests/fixtures/cycle/bad/calendar-review-too-soon.json b/tests/fixtures/cycle/bad/calendar-review-too-soon.json new file mode 100644 index 00000000..77331df6 --- /dev/null +++ b/tests/fixtures/cycle/bad/calendar-review-too-soon.json @@ -0,0 +1,61 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-24", + "2027-02-23", + "2027-05-25", + "2027-08-24", + "2027-11-23", + "2028-02-29", + "2028-05-30", + "2028-08-29", + "2028-11-28" + ], + "review_business_days_after_issue": 2, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", + "2026-01-19", + "2026-02-16", + "2026-05-25", + "2026-06-19", + "2026-07-03", + "2026-09-07", + "2026-10-12", + "2026-11-11", + "2026-11-26", + "2026-12-25", + "2027-01-01", + "2027-01-18", + "2027-02-15", + "2027-05-31", + "2027-06-18", + "2027-07-05", + "2027-09-06", + "2027-10-11", + "2027-11-11", + "2027-11-25", + "2027-12-24", + "2027-12-31", + "2028-01-17", + "2028-02-21", + "2028-05-29", + "2028-06-19", + "2028-07-04", + "2028-09-04", + "2028-10-09", + "2028-11-10", + "2028-11-23", + "2028-12-25" + ] + } +} diff --git a/tests/fixtures/cycle/bad/calendar-runs-out.json b/tests/fixtures/cycle/bad/calendar-runs-out.json new file mode 100644 index 00000000..8432c746 --- /dev/null +++ b/tests/fixtures/cycle/bad/calendar-runs-out.json @@ -0,0 +1,54 @@ +{ + "$comment": "The quarterly Collaborative Continuous Monitoring calendar (CCM-OCR-SOR, CCM-QTR-SAR). Fixed Ongoing Certification Report issue dates, about 3 months apart, placed late in the second month of each quarter (about day 55), away from the beginning, middle and end of the quarter. Each Quarterly Review is a fixed number of business days after its report, counted over the federal holidays listed here. scripts/_ccm.py validates this file (fail-closed) and every report, the CPO and the review calendar file read their dates from it; nothing computes a date from 'now'. Extend the issue dates and holidays before the calendar runs out: the build fails when fewer than two issue dates lie ahead.", + "schema": "ccm-calendar/1", + "decided_by": "Sam Aydlette", + "decided_on": "2026-11-05", + "review_by": "2027-11-05", + "rationale": "Issue on a Tuesday late in each quarter's middle month: a fixed, predictable cycle that is spread out from the start, middle and end of each quarter, as CCM-OCR-SOR asks. The review follows 5 business days later, inside the 3-to-10 business day window of CCM-QTR-SAR, leaving time to read the report first.", + "ocr_issue_dates": [ + "2026-11-24", + "2027-02-23" + ], + "review_business_days_after_issue": 5, + "review_start_utc": "17:00", + "review_duration_minutes": 45, + "holidays": { + "source": "U.S. federal holidays (5 U.S.C. 6103), observed dates", + "covers_through": "2028-12-31", + "dates": [ + "2026-01-01", + "2026-01-19", + "2026-02-16", + "2026-05-25", + "2026-06-19", + "2026-07-03", + "2026-09-07", + "2026-10-12", + "2026-11-11", + "2026-11-26", + "2026-12-25", + "2027-01-01", + "2027-01-18", + "2027-02-15", + "2027-05-31", + "2027-06-18", + "2027-07-05", + "2027-09-06", + "2027-10-11", + "2027-11-11", + "2027-11-25", + "2027-12-24", + "2027-12-31", + "2028-01-17", + "2028-02-21", + "2028-05-29", + "2028-06-19", + "2028-07-04", + "2028-09-04", + "2028-10-09", + "2028-11-10", + "2028-11-23", + "2028-12-25" + ] + } +} diff --git a/tests/fixtures/cycle/bad/cpo-other-package-id.json b/tests/fixtures/cycle/bad/cpo-other-package-id.json new file mode 100644 index 00000000..910ab6ed --- /dev/null +++ b/tests/fixtures/cycle/bad/cpo-other-package-id.json @@ -0,0 +1,52 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-certification-package-overview-schema-2026-06-24.json", + "serviceIdentification": { + "providerName": "Example Provider", + "serviceName": "Example Docs", + "serviceAcronym": "EXD", + "serviceDescription": "A document service.", + "certificationType": "20x", + "fedRampPackageId": "Someone Else (ELSE)", + "website": "https://example.com", + "logo": "https://example.com/logo.png" + }, + "serviceProperties": { + "serviceType": [ + "SaaS" + ], + "deploymentModel": "Public Cloud", + "businessCategory": [ + "Collaboration" + ], + "trustCenter": { + "repositoryType": [ + "Trust Center" + ], + "url": "https://example.com/trust", + "repositoryDescription": "All certification data.", + "authenticationRequired": false + }, + "nextOngoingCertificationReportDate": "2027-02-01" + }, + "contactInformation": [ + { + "contactType": "Security", + "contactName": "Sec Team", + "contactEmail": "security@example.com" + }, + { + "contactType": "Sales", + "contactName": "Sales Team" + } + ], + "certifiedServices": [ + { + "serviceName": "File preview", + "serviceDescription": "Renders uploads." + } + ], + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "98b0de339ac1bf2eae4bc307716cd57c3078aaf9cfbc8e23fb3c966323ac3366" + } +} diff --git a/tests/fixtures/cycle/bad/cpo-rev5-program.json b/tests/fixtures/cycle/bad/cpo-rev5-program.json new file mode 100644 index 00000000..cb163f0f --- /dev/null +++ b/tests/fixtures/cycle/bad/cpo-rev5-program.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-certification-package-overview-schema-2026-06-24.json", + "serviceIdentification": { + "providerName": "Example Provider", + "serviceName": "Example Docs", + "serviceAcronym": "EXD", + "serviceDescription": "A document service.", + "certificationType": "Rev5", + "fedRampPackageId": "Example Provider (EXD)", + "website": "https://example.com", + "logo": "https://example.com/logo.png" + }, + "serviceProperties": { + "serviceType": [ + "SaaS" + ], + "deploymentModel": "Public Cloud", + "businessCategory": [ + "Collaboration" + ], + "trustCenter": { + "repositoryType": [ + "Trust Center" + ], + "url": "https://example.com/trust", + "repositoryDescription": "All certification data.", + "authenticationRequired": false + }, + "nextOngoingCertificationReportDate": "2027-02-01", + "secureConfigurationGuidance": { + "repositoryType": [ + "Secure Configuration Guidance" + ], + "url": "https://example.com/scg", + "repositoryDescription": "The secure configuration guide.", + "authenticationRequired": false + } + }, + "contactInformation": [ + { + "contactType": "Security", + "contactName": "Sec Team", + "contactEmail": "security@example.com" + }, + { + "contactType": "Sales", + "contactName": "Sales Team" + } + ], + "certifiedServices": [ + { + "serviceName": "File preview", + "serviceDescription": "Renders uploads." + } + ], + "thirdPartyInformationResources": { + "nonCertified": [ + { + "name": "Example CDN", + "provider": "Example Co", + "useCase": "Serves static files." + } + ] + }, + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "98b0de339ac1bf2eae4bc307716cd57c3078aaf9cfbc8e23fb3c966323ac3366", + "independentAssessment": { + "overallSummary": { + "record_id": "X-SUMMARY", + "kind": "summary", + "text": "Overall summary (simulated)." + } + } + } +} diff --git a/tests/fixtures/cycle/bad/cpo-without-assessment-summary.json b/tests/fixtures/cycle/bad/cpo-without-assessment-summary.json new file mode 100644 index 00000000..ea97879f --- /dev/null +++ b/tests/fixtures/cycle/bad/cpo-without-assessment-summary.json @@ -0,0 +1,69 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-certification-package-overview-schema-2026-06-24.json", + "serviceIdentification": { + "providerName": "Example Provider", + "serviceName": "Example Docs", + "serviceAcronym": "EXD", + "serviceDescription": "A document service.", + "certificationType": "20x", + "fedRampPackageId": "Example Provider (EXD)", + "website": "https://example.com", + "logo": "https://example.com/logo.png" + }, + "serviceProperties": { + "serviceType": [ + "SaaS" + ], + "deploymentModel": "Public Cloud", + "businessCategory": [ + "Collaboration" + ], + "trustCenter": { + "repositoryType": [ + "Trust Center" + ], + "url": "https://example.com/trust", + "repositoryDescription": "All certification data.", + "authenticationRequired": false + }, + "nextOngoingCertificationReportDate": "2027-02-01", + "secureConfigurationGuidance": { + "repositoryType": [ + "Secure Configuration Guidance" + ], + "url": "https://example.com/scg", + "repositoryDescription": "The secure configuration guide.", + "authenticationRequired": false + } + }, + "contactInformation": [ + { + "contactType": "Security", + "contactName": "Sec Team", + "contactEmail": "security@example.com" + }, + { + "contactType": "Sales", + "contactName": "Sales Team" + } + ], + "certifiedServices": [ + { + "serviceName": "File preview", + "serviceDescription": "Renders uploads." + } + ], + "thirdPartyInformationResources": { + "nonCertified": [ + { + "name": "Example CDN", + "provider": "Example Co", + "useCase": "Serves static files." + } + ] + }, + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "98b0de339ac1bf2eae4bc307716cd57c3078aaf9cfbc8e23fb3c966323ac3366" + } +} diff --git a/tests/fixtures/cycle/bad/frc-modified/register.json b/tests/fixtures/cycle/bad/frc-modified/register.json new file mode 100644 index 00000000..a1fbd1eb --- /dev/null +++ b/tests/fixtures/cycle/bad/frc-modified/register.json @@ -0,0 +1,12 @@ +{ + "schema": "fedramp-certification-reports/1", + "reports": [ + { + "file": "report.json", + "received_on": "2026-11-05", + "from": "Simulated FedRAMP", + "simulated": true, + "sha256": "eb933c3c8bcc9c86d05a46a1d1a4660d198cab25c1e21bc01151f7672f09d5cc" + } + ] +} diff --git a/tests/fixtures/cycle/bad/frc-modified/report.json b/tests/fixtures/cycle/bad/frc-modified/report.json new file mode 100644 index 00000000..17d98e62 --- /dev/null +++ b/tests/fixtures/cycle/bad/frc-modified/report.json @@ -0,0 +1 @@ +{"report": "as received"} diff --git a/tests/fixtures/cycle/bad/frc-unlisted/extra.json b/tests/fixtures/cycle/bad/frc-unlisted/extra.json new file mode 100644 index 00000000..877bc013 --- /dev/null +++ b/tests/fixtures/cycle/bad/frc-unlisted/extra.json @@ -0,0 +1 @@ +{"not": "registered"} diff --git a/tests/fixtures/cycle/bad/frc-unlisted/register.json b/tests/fixtures/cycle/bad/frc-unlisted/register.json new file mode 100644 index 00000000..ccad3389 --- /dev/null +++ b/tests/fixtures/cycle/bad/frc-unlisted/register.json @@ -0,0 +1,12 @@ +{ + "schema": "fedramp-certification-reports/1", + "reports": [ + { + "file": "report.json", + "received_on": "2026-11-05", + "from": "Simulated FedRAMP", + "simulated": true, + "sha256": "1528242c5c849efe6fcbc94f604866dde5682bdf7c0d720c1030377c935c4f45" + } + ] +} diff --git a/tests/fixtures/cycle/bad/frc-unlisted/report.json b/tests/fixtures/cycle/bad/frc-unlisted/report.json new file mode 100644 index 00000000..17d98e62 --- /dev/null +++ b/tests/fixtures/cycle/bad/frc-unlisted/report.json @@ -0,0 +1 @@ +{"report": "as received"} diff --git a/tests/fixtures/cycle/bad/maintainer-any-branch.json b/tests/fixtures/cycle/bad/maintainer-any-branch.json new file mode 100644 index 00000000..f7f674c2 --- /dev/null +++ b/tests/fixtures/cycle/bad/maintainer-any-branch.json @@ -0,0 +1,14 @@ +{ + "role_arn": "arn:aws:iam::123456789012:role/github-actions-package-maintenance-oidc", + "env_state": "ok", + "environment": { + "deployment_branch_policy": { + "protected_branches": false, + "custom_branch_policies": true + } + }, + "branch_policies": [ + "main", + "*" + ] +} diff --git a/tests/fixtures/cycle/bad/maintainer-no-environment.json b/tests/fixtures/cycle/bad/maintainer-no-environment.json new file mode 100644 index 00000000..1954f347 --- /dev/null +++ b/tests/fixtures/cycle/bad/maintainer-no-environment.json @@ -0,0 +1,6 @@ +{ + "role_arn": "arn:aws:iam::123456789012:role/github-actions-package-maintenance-oidc", + "env_state": "missing", + "environment": null, + "branch_policies": null +} diff --git a/tests/fixtures/cycle/bad/maintainer-no-variable.json b/tests/fixtures/cycle/bad/maintainer-no-variable.json new file mode 100644 index 00000000..ed57b81d --- /dev/null +++ b/tests/fixtures/cycle/bad/maintainer-no-variable.json @@ -0,0 +1,13 @@ +{ + "role_arn": "", + "env_state": "ok", + "environment": { + "deployment_branch_policy": { + "protected_branches": false, + "custom_branch_policies": true + } + }, + "branch_policies": [ + "main" + ] +} diff --git a/tests/fixtures/cycle/bad/maintainer-wrong-role.json b/tests/fixtures/cycle/bad/maintainer-wrong-role.json new file mode 100644 index 00000000..759f04a7 --- /dev/null +++ b/tests/fixtures/cycle/bad/maintainer-wrong-role.json @@ -0,0 +1,13 @@ +{ + "role_arn": "arn:aws:iam::123456789012:role/github-actions-deploy-oidc", + "env_state": "ok", + "environment": { + "deployment_branch_policy": { + "protected_branches": false, + "custom_branch_policies": true + } + }, + "branch_policies": [ + "main" + ] +} diff --git a/tests/fixtures/cycle/bad/ocr-issues-not-a-calendar-date.json b/tests/fixtures/cycle/bad/ocr-issues-not-a-calendar-date.json new file mode 100644 index 00000000..7c7c5342 --- /dev/null +++ b/tests/fixtures/cycle/bad/ocr-issues-not-a-calendar-date.json @@ -0,0 +1,8 @@ +{ + "schema": "ocr-issues/1", + "issues": [ + { + "issueDate": "2026-11-25" + } + ] +} diff --git a/tests/fixtures/cycle/bad/ocr-issues-out-of-order.json b/tests/fixtures/cycle/bad/ocr-issues-out-of-order.json new file mode 100644 index 00000000..3885cf17 --- /dev/null +++ b/tests/fixtures/cycle/bad/ocr-issues-out-of-order.json @@ -0,0 +1,11 @@ +{ + "schema": "ocr-issues/1", + "issues": [ + { + "issueDate": "2027-02-23" + }, + { + "issueDate": "2026-11-24" + } + ] +} diff --git a/tests/fixtures/cycle/bad/ocr-other-fedramp-id.json b/tests/fixtures/cycle/bad/ocr-other-fedramp-id.json new file mode 100644 index 00000000..40f0dc83 --- /dev/null +++ b/tests/fixtures/cycle/bad/ocr-other-fedramp-id.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-ongoing-certification-report-schema-2026-06-24.json", + "certificationPackageOverviewUri": "https://samaydlette.com/.well-known/certification-package-overview.json", + "reportPeriod": { + "from": "2026-08-01", + "to": "2026-10-31" + }, + "certificationDataChanges": [], + "plannedCertificationDataChanges": { + "planningHorizonThrough": "2027-01-31", + "changes": [] + }, + "acceptedVulnerabilities": "None.", + "transformativeChanges": [], + "updatedRecommendations": [], + "activeAgencies": [], + "reportableIncidents": { + "incidents": [] + }, + "providerExtensions": { + "fedRampId": "Someone Else (ELSE)", + "contentSha256": "1541eb3e8db587c701aef2b148933e3581f89a91b4142ec2e422675e01ed2efd" + } +} diff --git a/tests/fixtures/cycle/bad/offering-id-without-provider-name.json b/tests/fixtures/cycle/bad/offering-id-without-provider-name.json new file mode 100644 index 00000000..b5de06e5 --- /dev/null +++ b/tests/fixtures/cycle/bad/offering-id-without-provider-name.json @@ -0,0 +1,129 @@ +{ + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "NOT-A-REAL-FEDRAMP-ID", + "fedramp_id_simulated": "No FedRAMP ID exists or is coming: nothing has been submitted to FedRAMP. FedRAMP's schema says to use the provider's name and acronym until an ID is assigned; the suffix makes sure nobody mistakes it for one.", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "service_model": [ + "SaaS" + ], + "deployment_model": "Public Cloud", + "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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 \u2014 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", + "contact": "https://samaydlette.com/.well-known/security.txt" + }, + "cryptographic_modules": [ + { + "module": "AWS KMS", + "validation": "FIPS 140-3 (CMVP, HSM-backed)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "FIPS-validated cipher suites; TLS 1.2+", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } + ], + "services": [ + { + "name": "samaydlette.com static website", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, + "in_mas_scope": true + }, + { + "name": "Silk Reeling Mirror application", + "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, + "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." + } + ] +} diff --git a/tests/fixtures/cycle/bad/offering-placeholder-id-unflagged.json b/tests/fixtures/cycle/bad/offering-placeholder-id-unflagged.json new file mode 100644 index 00000000..5d3ecb03 --- /dev/null +++ b/tests/fixtures/cycle/bad/offering-placeholder-id-unflagged.json @@ -0,0 +1,128 @@ +{ + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "service_model": [ + "SaaS" + ], + "deployment_model": "Public Cloud", + "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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 \u2014 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", + "contact": "https://samaydlette.com/.well-known/security.txt" + }, + "cryptographic_modules": [ + { + "module": "AWS KMS", + "validation": "FIPS 140-3 (CMVP, HSM-backed)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "FIPS-validated cipher suites; TLS 1.2+", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } + ], + "services": [ + { + "name": "samaydlette.com static website", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, + "in_mas_scope": true + }, + { + "name": "Silk Reeling Mirror application", + "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, + "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." + } + ] +} diff --git a/tests/fixtures/cycle/bad/offering-service-above-system.json b/tests/fixtures/cycle/bad/offering-service-above-system.json new file mode 100644 index 00000000..0b2b439a --- /dev/null +++ b/tests/fixtures/cycle/bad/offering-service-above-system.json @@ -0,0 +1,129 @@ +{ + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "fedramp_id_simulated": "No FedRAMP ID exists or is coming: nothing has been submitted to FedRAMP. FedRAMP's schema says to use the provider's name and acronym until an ID is assigned; the suffix makes sure nobody mistakes it for one.", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "service_model": [ + "SaaS" + ], + "deployment_model": "Public Cloud", + "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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 \u2014 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", + "contact": "https://samaydlette.com/.well-known/security.txt" + }, + "cryptographic_modules": [ + { + "module": "AWS KMS", + "validation": "FIPS 140-3 (CMVP, HSM-backed)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "FIPS-validated cipher suites; TLS 1.2+", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } + ], + "services": [ + { + "name": "samaydlette.com static website", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website" + ], + "security_category": { + "confidentiality": "low", + "integrity": "high", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, + "in_mas_scope": true + }, + { + "name": "Silk Reeling Mirror application", + "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, + "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." + } + ] +} diff --git a/tests/fixtures/cycle/bad/offering-unknown-boundary-group.json b/tests/fixtures/cycle/bad/offering-unknown-boundary-group.json new file mode 100644 index 00000000..8ca2190d --- /dev/null +++ b/tests/fixtures/cycle/bad/offering-unknown-boundary-group.json @@ -0,0 +1,130 @@ +{ + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "fedramp_id_simulated": "No FedRAMP ID exists or is coming: nothing has been submitted to FedRAMP. FedRAMP's schema says to use the provider's name and acronym until an ID is assigned; the suffix makes sure nobody mistakes it for one.", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "service_model": [ + "SaaS" + ], + "deployment_model": "Public Cloud", + "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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 \u2014 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", + "contact": "https://samaydlette.com/.well-known/security.txt" + }, + "cryptographic_modules": [ + { + "module": "AWS KMS", + "validation": "FIPS 140-3 (CMVP, HSM-backed)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "FIPS-validated cipher suites; TLS 1.2+", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } + ], + "services": [ + { + "name": "samaydlette.com static website", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website", + "not-a-boundary-group" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, + "in_mas_scope": true + }, + { + "name": "Silk Reeling Mirror application", + "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, + "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." + } + ] +} diff --git a/tests/fixtures/cycle/bad/sdr-repeats-a-rule.json b/tests/fixtures/cycle/bad/sdr-repeats-a-rule.json new file mode 100644 index 00000000..50f9d92c --- /dev/null +++ b/tests/fixtures/cycle/bad/sdr-repeats-a-rule.json @@ -0,0 +1,64 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-security-decision-record-schema-2026-06-24.json", + "certificationPackageOverviewUri": "https://samaydlette.com/.well-known/certification-package-overview.json", + "metadata": { + "version": "1", + "lastUpdated": "2026-11-05T00:00:00Z", + "updateSource": "pipeline" + }, + "fedRampRequirements": [ + { + "frrID": "VDR-CSO-DET", + "frrImplementationStatus": "Implemented", + "frrImplementation": [ + "Scanners run on every deploy." + ] + }, + { + "frrID": "VDR-CSO-DET", + "frrImplementationStatus": "Implemented", + "frrImplementation": [ + "Scanners run on every deploy." + ] + } + ], + "keySecurityIndicators": [ + { + "ksiId": "KSI-CNA-01", + "ksiImplementation": [ + "x" + ], + "ksiValidation": [ + "y" + ], + "ksiAssessment": [ + "z" + ], + "ksiTests": [ + "t" + ], + "ksiEvidence": [ + { + "evidenceType": "Report", + "evidenceLocation": "https://example.com/e.json" + } + ] + } + ], + "securityControls": [ + { + "controlId": "AC-2", + "controlImplementationStatus": "Implemented", + "parameterValues": [ + { + "parameterId": "ac-02_odp.01", + "parameterValue": "30 days" + } + ] + } + ], + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "6ada229987020103f85b4b3a991a34aed52ed919d01a6c3f0ac1fd40c2093e6e" + } +} diff --git a/tests/fixtures/cycle/bad/sensitive-values.json b/tests/fixtures/cycle/bad/sensitive-values.json new file mode 100644 index 00000000..51f96b26 --- /dev/null +++ b/tests/fixtures/cycle/bad/sensitive-values.json @@ -0,0 +1,17 @@ +{ + "account-id": { + "summary": "Applied to account 123456789012 in us-east-1." + }, + "email": { + "summary": "Asked by jane.doe@example.org about the review." + }, + "ipv4": { + "summary": "Origin 10.20.30.40 was blocked." + }, + "aws-key": { + "summary": "Rotated AKIAIOSFODNN7EXAMPLE after the drill." + }, + "handle": { + "summary": "Question from @some-reviewer answered." + } +} diff --git a/tests/fixtures/cycle/bad/site-file-without-fedramp-id.json b/tests/fixtures/cycle/bad/site-file-without-fedramp-id.json new file mode 100644 index 00000000..51355440 --- /dev/null +++ b/tests/fixtures/cycle/bad/site-file-without-fedramp-id.json @@ -0,0 +1,5 @@ +{ + "$comment": "Known bad: a trust-center site file named to the FedRAMP ID gate with no top-level fedRampId.", + "manifest_type": "fedramp-certification-data-manifest", + "artifacts": [] +} diff --git a/tests/fixtures/cycle/bad/submission-log-malformed.json b/tests/fixtures/cycle/bad/submission-log-malformed.json new file mode 100644 index 00000000..3302e221 --- /dev/null +++ b/tests/fixtures/cycle/bad/submission-log-malformed.json @@ -0,0 +1,8 @@ +{ + "schema": "package-submission-log/1", + "entries": [ + { + "submittedAt": "2026-11-05T00:00:00+00:00" + } + ] +} diff --git a/tests/fixtures/cycle/maintainer-good.json b/tests/fixtures/cycle/maintainer-good.json new file mode 100644 index 00000000..13e48e9f --- /dev/null +++ b/tests/fixtures/cycle/maintainer-good.json @@ -0,0 +1,13 @@ +{ + "role_arn": "arn:aws:iam::123456789012:role/github-actions-package-maintenance-oidc", + "env_state": "ok", + "environment": { + "deployment_branch_policy": { + "protected_branches": false, + "custom_branch_policies": true + } + }, + "branch_policies": [ + "main" + ] +} diff --git a/tests/fixtures/cycle/offering-fsi-url.json b/tests/fixtures/cycle/offering-fsi-url.json new file mode 100644 index 00000000..541a4244 --- /dev/null +++ b/tests/fixtures/cycle/offering-fsi-url.json @@ -0,0 +1,133 @@ +{ + "_note": "Operator-declared editorial values for the Certification Package Overview (CPO-CSO-OVR: CDS-CSO-PUB, CDS-CSO-SVC, CDS-CSO-FID). scripts/build-cpo.py reads this plus the system profile, the CCM calendar and the canonical inventory and writes /.well-known/certification-package-overview.json in FedRAMP's schema. Where a value needs an outside party this proof of concept does not have (a FedRAMP ID, a SAM.gov UEI), the value is SIMULATED, says so, and the CPO flags it under providerExtensions.simulated. No published value here is an email address: contacts point to /.well-known/security.txt or the contact page.", + "provider_name": "Sam Aydlette", + "service_name": "samaydlette.com", + "service_acronym": "SAMCOM", + "fedramp_id": "Sam Aydlette (SAMCOM): PROOF-OF-CONCEPT-NOT-A-REAL-FEDRAMP-ID", + "fedramp_id_simulated": "No FedRAMP ID exists or is coming: nothing has been submitted to FedRAMP. FedRAMP's schema says to use the provider's name and acronym until an ID is assigned; the suffix makes sure nobody mistakes it for one.", + "uei": "NOT-A-REAL-UEI-0000", + "uei_simulated": "Simulated. The operator is not registering on SAM.gov, so there is no Unique Entity Identifier; this value is a placeholder that no SAM.gov lookup will ever find.", + "service_model": [ + "SaaS" + ], + "deployment_model": "Public Cloud", + "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 the contact page: https://samaydlette.com/pages/contact.html" + }, + "security_contact": { + "name": "Sam Aydlette, through the security 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 \u2014 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", + "contact": "https://samaydlette.com/.well-known/security.txt" + }, + "cryptographic_modules": [ + { + "module": "AWS KMS", + "validation": "FIPS 140-3 (CMVP, HSM-backed)", + "role": "key store for all four customer-managed CMKs: at-rest (the compliance and watchdog Lambdas' environments and log groups, the DNS query log, the alert topic), runtime signing (the runtime signal), DNSSEC KSK, and the Silk Reeling app (its Lambda environment and log groups; the app holds no secrets since SCN-2026-006)", + "inherited": true + }, + { + "module": "ACM TLS termination on CloudFront", + "validation": "FIPS-validated cipher suites; TLS 1.2+", + "role": "TLS in transit", + "inherited": true + }, + { + "module": "S3 SSE-S3", + "validation": "AES-256 (AWS-managed keys)", + "role": "at-rest on the public website + log buckets", + "inherited": true + }, + { + "module": "Sigstore Fulcio + Rekor", + "validation": "ECDSA P-256 (FIPS-approved algorithm); the implementations are NOT CMVP-validated modules", + "role": "deploy-time keyless signing", + "inherited": false, + "compensating_control": "trust anchored in the public Rekor transparency log" + } + ], + "services": [ + { + "name": "samaydlette.com static website", + "description": "Public static content (S3 origin behind CloudFront), plus the signed compliance artifacts published under /.well-known/ and the trust center at /trust/.", + "boundary_groups": [ + "website" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Public content: nothing confidential. Integrity is moderate because defacement or tampering of published evidence would mislead readers. Availability is low: a personal site." + }, + "in_mas_scope": true + }, + { + "name": "Silk Reeling Mirror application", + "description": "Cognito-gated HTTP API (API Gateway -> Lambda) serving a browser SPA that coaches Tai Chi; writes feedback text from the scores in the Lambda, with no external interconnection (optional LLM feedback is customer-configurable and disabled here).", + "date_available": "2026-06-03", + "boundary_groups": [ + "app" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "Holds invited users' sign-in accounts and the pose scores they submit, no federal data: confidentiality low. Integrity moderate: wrong coaching or tampered accounts are the harm. Availability low." + }, + "in_mas_scope": true + }, + { + "name": "Continuous compliance evidence (pipeline trust root, runtime KSI emitter, evidence watchdog)", + "description": "The deploy's trust root (OIDC roles, CloudFront, DNSSEC, remote state), the daily runtime re-validation of live configuration (signed runtime KSI signal), the hourly evidence-freshness watchdog with its alarms, and the audit trail and keys behind them. GitHub Actions and Sigstore, which build and sign the evidence, are third-party information resources inside the boundary.", + "boundary_groups": [ + "compliance", + "watchdog", + "audit", + "trust-root" + ], + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low", + "rationale": "The evidence is public by design. Integrity is moderate: false evidence is the harm this system exists to prevent. Availability is low." + }, + "in_mas_scope": true + } + ], + "not_included": [ + { + "name": "Podcast and video audio hosted by third parties", + "why": "Linked from pages, served by their own hosts; not part of the offering." + }, + { + "name": "MediaPipe libraries and models (cdn.jsdelivr.net, storage.googleapis.com)", + "why": "Loaded by the visitor's browser from third-party hosts at run time; listed as third-party information resources, not services of this offering." + }, + { + "name": "Optional LLM coaching feedback", + "why": "Customer-configurable and disabled; no external AI service is called." + }, + { + "name": "Newsletter, RSS and social feeds", + "why": "None is offered under this certification." + } + ], + "fedramp_security_inbox": { + "contact": "https://samaydlette.com/.well-known/security.txt", + "address": "https://samaydlette.com/.well-known/security.txt" + } +} diff --git a/tests/fixtures/cycle/package/cpo.json b/tests/fixtures/cycle/package/cpo.json new file mode 100644 index 00000000..c6849c14 --- /dev/null +++ b/tests/fixtures/cycle/package/cpo.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-certification-package-overview-schema-2026-06-24.json", + "serviceIdentification": { + "providerName": "Example Provider", + "serviceName": "Example Docs", + "serviceAcronym": "EXD", + "serviceDescription": "A document service.", + "certificationType": "20x", + "fedRampPackageId": "Example Provider (EXD)", + "website": "https://example.com", + "logo": "https://example.com/logo.png" + }, + "serviceProperties": { + "serviceType": [ + "SaaS" + ], + "deploymentModel": "Public Cloud", + "businessCategory": [ + "Collaboration" + ], + "trustCenter": { + "repositoryType": [ + "Trust Center" + ], + "url": "https://example.com/trust", + "repositoryDescription": "All certification data.", + "authenticationRequired": false + }, + "nextOngoingCertificationReportDate": "2027-02-01", + "secureConfigurationGuidance": { + "repositoryType": [ + "Secure Configuration Guidance" + ], + "url": "https://example.com/scg", + "repositoryDescription": "The secure configuration guide.", + "authenticationRequired": false + } + }, + "contactInformation": [ + { + "contactType": "Security", + "contactName": "Sec Team", + "contactEmail": "security@example.com" + }, + { + "contactType": "Sales", + "contactName": "Sales Team" + } + ], + "certifiedServices": [ + { + "serviceName": "File preview", + "serviceDescription": "Renders uploads." + } + ], + "thirdPartyInformationResources": { + "nonCertified": [ + { + "name": "Example CDN", + "provider": "Example Co", + "useCase": "Serves static files." + } + ] + }, + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "98b0de339ac1bf2eae4bc307716cd57c3078aaf9cfbc8e23fb3c966323ac3366", + "independentAssessment": { + "overallSummary": { + "record_id": "X-SUMMARY", + "kind": "summary", + "text": "Overall summary (simulated)." + } + } + } +} diff --git a/tests/fixtures/cycle/package/ocr.json b/tests/fixtures/cycle/package/ocr.json new file mode 100644 index 00000000..46dfd1a8 --- /dev/null +++ b/tests/fixtures/cycle/package/ocr.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-ongoing-certification-report-schema-2026-06-24.json", + "certificationPackageOverviewUri": "https://samaydlette.com/.well-known/certification-package-overview.json", + "reportPeriod": { + "from": "2026-08-01", + "to": "2026-10-31" + }, + "certificationDataChanges": [], + "plannedCertificationDataChanges": { + "planningHorizonThrough": "2027-01-31", + "changes": [] + }, + "acceptedVulnerabilities": "None.", + "transformativeChanges": [], + "updatedRecommendations": [], + "activeAgencies": [], + "reportableIncidents": { + "incidents": [] + }, + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "1541eb3e8db587c701aef2b148933e3581f89a91b4142ec2e422675e01ed2efd" + } +} diff --git a/tests/fixtures/cycle/package/sdr.json b/tests/fixtures/cycle/package/sdr.json new file mode 100644 index 00000000..ffb4c6c6 --- /dev/null +++ b/tests/fixtures/cycle/package/sdr.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://fedramp.gov/schemas/fedramp-security-decision-record-schema-2026-06-24.json", + "certificationPackageOverviewUri": "https://samaydlette.com/.well-known/certification-package-overview.json", + "metadata": { + "version": "1", + "lastUpdated": "2026-11-05T00:00:00Z", + "updateSource": "pipeline" + }, + "fedRampRequirements": [ + { + "frrID": "VDR-CSO-DET", + "frrImplementationStatus": "Implemented", + "frrImplementation": [ + "Scanners run on every deploy." + ] + } + ], + "keySecurityIndicators": [ + { + "ksiId": "KSI-CNA-01", + "ksiImplementation": [ + "x" + ], + "ksiValidation": [ + "y" + ], + "ksiAssessment": [ + "z" + ], + "ksiTests": [ + "t" + ], + "ksiEvidence": [ + { + "evidenceType": "Report", + "evidenceLocation": "https://example.com/e.json" + } + ] + } + ], + "securityControls": [ + { + "controlId": "AC-2", + "controlImplementationStatus": "Implemented", + "parameterValues": [ + { + "parameterId": "ac-02_odp.01", + "parameterValue": "30 days" + } + ] + } + ], + "providerExtensions": { + "fedRampId": "Example Provider (EXD)", + "contentSha256": "6ada229987020103f85b4b3a991a34aed52ed919d01a6c3f0ac1fd40c2093e6e" + } +} diff --git a/tests/fixtures/edge-access-logging/delivery-source.json b/tests/fixtures/edge-access-logging/delivery-source.json new file mode 100644 index 00000000..887662fc --- /dev/null +++ b/tests/fixtures/edge-access-logging/delivery-source.json @@ -0,0 +1,2 @@ +{"deliverySource": {"name": "samaydlette-com-edge-access", "logType": "ACCESS_LOGS", "service": "cloudfront", + "resourceArns": ["arn:aws:cloudfront::ACCOUNT:distribution/EXAMPLE"]}} diff --git a/tests/fixtures/edge-access-logging/good-deliveries.json b/tests/fixtures/edge-access-logging/good-deliveries.json new file mode 100644 index 00000000..4fa9b6d8 --- /dev/null +++ b/tests/fixtures/edge-access-logging/good-deliveries.json @@ -0,0 +1,3 @@ +{"deliveries": [{"id": "fixture", "deliverySourceName": "samaydlette-com-edge-access", + "deliveryDestinationType": "S3", + "recordFields": ["date", "time", "x-edge-location", "c-country", "cs-method", "cs-uri-stem", "sc-status", "sc-bytes", "x-edge-result-type"]}]} diff --git a/tests/fixtures/edge-access-logging/known-bad-deliveries.json b/tests/fixtures/edge-access-logging/known-bad-deliveries.json new file mode 100644 index 00000000..3381be4a --- /dev/null +++ b/tests/fixtures/edge-access-logging/known-bad-deliveries.json @@ -0,0 +1,3 @@ +{"deliveries": [{"id": "fixture", "deliverySourceName": "samaydlette-com-edge-access", + "deliveryDestinationType": "S3", + "recordFields": ["date", "time", "c-ip", "cs-uri-stem", "cs-uri-query", "cs(User-Agent)", "sc-status"]}]} diff --git a/tests/fixtures/frr-evidence/failing-cited-test.xml b/tests/fixtures/frr-evidence/failing-cited-test.xml new file mode 100644 index 00000000..16a82665 --- /dev/null +++ b/tests/fixtures/frr-evidence/failing-cited-test.xml @@ -0,0 +1,6 @@ + + + +known-bad: a cited test failed + + diff --git a/tests/fixtures/frr-evidence/passing.xml b/tests/fixtures/frr-evidence/passing.xml new file mode 100644 index 00000000..9bf0cf71 --- /dev/null +++ b/tests/fixtures/frr-evidence/passing.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/tests/fixtures/human-views/original.json b/tests/fixtures/human-views/original.json new file mode 100644 index 00000000..43e7ec18 --- /dev/null +++ b/tests/fixtures/human-views/original.json @@ -0,0 +1 @@ +{"schema": "x/1", "count": 2, "items": [{"id": "A|B", "ok": true}, {"id": "C", "ok": null}], "empty": {}, "list": [], "0": "numeric key"} diff --git a/tests/fixtures/human-views/original.view.tampered.md b/tests/fixtures/human-views/original.view.tampered.md new file mode 100644 index 00000000..e57139e5 --- /dev/null +++ b/tests/fixtures/human-views/original.view.tampered.md @@ -0,0 +1,45 @@ +# original.json: complete human-readable view + +_Every value in `original.json`, under its JSON Pointer path; each value is shown in its JSON encoding. Generated from the signed original by scripts/build-human-views.py, and checked on every build to reproduce it exactly._ + +- **Format:** json + +## schema + +| Path | Value | +|---|---| +| `/schema` | "x/1" | + +## count + +| Path | Value | +|---|---| +| `/count` | 3 | + +## items + +| Path | Value | +|---|---| +| `/items/0/id` | "A\|B" | +| `/items/0/ok` | true | +| `/items/1/id` | "C" | +| `/items/1/ok` | null | + +## empty + +| Path | Value | +|---|---| +| `/empty` | {} | + +## list + +| Path | Value | +|---|---| +| `/list` | [] | + +## 0 + +| Path | Value | +|---|---| +| `/0` | "numeric key" | + diff --git a/tests/fixtures/mas/classification-gaps.json b/tests/fixtures/mas/classification-gaps.json new file mode 100644 index 00000000..88f5f34a --- /dev/null +++ b/tests/fixtures/mas/classification-gaps.json @@ -0,0 +1,6 @@ +{"_note": "Known-bad: flow X names a component the inventory does not have; the log group is in no flow.", + "declared": [{"key": "operator", "label": "Operator", "zone": "outside", "kind": "actor"}], + "flows": [ + {"id": "X", "label": "Operator → a ghost", "path": [{"declared": "operator"}, {"component": "aws::function::ghost"}]}, + {"id": "Y", "label": "Operator → app", "path": [{"declared": "operator"}, {"component": "aws::function::app"}]} + ]} diff --git a/tests/fixtures/mas/csp-unplaced.tf.fixture b/tests/fixtures/mas/csp-unplaced.tf.fixture new file mode 100644 index 00000000..cea2fdf6 --- /dev/null +++ b/tests/fixtures/mas/csp-unplaced.tf.fixture @@ -0,0 +1,11 @@ +# Known-bad: the CSP allows a host no placement covers (MAS-CSO-IIR). +resource "aws_cloudfront_response_headers_policy" "bad" { + security_headers_config { + content_security_policy { + content_security_policy = join("; ", [ + "default-src 'self'", + "script-src 'self' https://cdn.jsdelivr.net/npm/x/ https://unvetted-cdn.example.com/lib.js", + ]) + } + } +} diff --git a/tests/fixtures/mas/csp-unresolved.tf.fixture b/tests/fixtures/mas/csp-unresolved.tf.fixture new file mode 100644 index 00000000..9d2c987f --- /dev/null +++ b/tests/fixtures/mas/csp-unresolved.tf.fixture @@ -0,0 +1,11 @@ +# Known-bad: a CSP source names a local that is not defined, so its host cannot +# be known; the check must fail rather than skip it. +resource "aws_cloudfront_response_headers_policy" "bad" { + security_headers_config { + content_security_policy { + content_security_policy = join("; ", [ + "connect-src 'self' https://${local.not_defined_anywhere}", + ]) + } + } +} diff --git a/tests/fixtures/mas/signal-gaps.json b/tests/fixtures/mas/signal-gaps.json new file mode 100644 index 00000000..0fae7196 --- /dev/null +++ b/tests/fixtures/mas/signal-gaps.json @@ -0,0 +1,11 @@ +{"_note": "Known-bad: a log group with no metadata entry and in no flow, and a component type in no KSI's evidence domain with no whole-set reason.", + "signal_id": "fixture-gaps", + "components": [ + {"component_id": "aws::log_group::brand_new", "type": "log_group", "security_category": {"confidentiality": "low", "integrity": "moderate", "availability": "low"}, "attributes": {"region": "us-east-2"}}, + {"component_id": "aws::mystery::thing", "type": "mystery", "security_category": {"confidentiality": "low", "integrity": "low", "availability": "low"}, "attributes": {}}, + {"component_id": "aws::function::app", "type": "function", "security_category": {"confidentiality": "moderate", "integrity": "moderate", "availability": "low"}, "attributes": {}} + ], + "ksis": [ + {"id": "KSI-AAA-ONE", "method": "policy-validation", "status": "pass", "evidence": {"component_refs": ["aws::function::app", "aws::log_group::brand_new"]}}, + {"id": "KSI-PIY-ALL", "method": "inventory-attestation", "status": "pass", "evidence": {"component_refs": ["aws::function::app", "aws::log_group::brand_new", "aws::mystery::thing"]}} + ]} diff --git a/tests/fixtures/mas/signal.json b/tests/fixtures/mas/signal.json new file mode 100644 index 00000000..c591642d --- /dev/null +++ b/tests/fixtures/mas/signal.json @@ -0,0 +1,2254 @@ +{ + "_note": "test fixture: the non-package components of the 2026-11-05 inventory plus the external services this change adds, attributes trimmed; one package and one page keep their types represented", + "signal_id": "fixture", + "components": [ + { + "component_id": "aws::tls_certificate::website", + "type": "tls_certificate", + "security_category": { + "confidentiality": "not-applicable", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-1", + "function": "Public TLS certificate for the CDN" + } + }, + { + "component_id": "aws::cdn_distribution::website", + "type": "cdn_distribution", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Public content delivery (TLS 1.2+, OAC to origin)" + } + }, + { + "component_id": "aws::dns_zone::website", + "type": "dns_zone", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Authoritative DNS for the public domain" + } + }, + { + "component_id": "aws::object_store::website", + "type": "object_store", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Origin storage for static site content and /.well-known/ artifacts" + } + }, + { + "component_id": "aws::api_gateway::silk_reeling", + "type": "api_gateway", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "HTTP API fronting the Silk Reeling app Lambda (TLS termination, request routing, throttling)" + } + }, + { + "component_id": "aws::audit_log_trail::management", + "type": "audit_log_trail", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Account-wide management-event audit (CloudTrail)" + } + }, + { + "component_id": "aws::event_schedule::evidence_watchdog", + "type": "event_schedule", + "security_category": { + "confidentiality": "not-applicable", + "integrity": "low", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Hourly trigger for the evidence SLA watchdog Lambda" + } + }, + { + "component_id": "aws::event_schedule::opa_compliance", + "type": "event_schedule", + "security_category": { + "confidentiality": "not-applicable", + "integrity": "low", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Daily trigger for the runtime KSI emitter Lambda" + } + }, + { + "component_id": "aws::log_group::evidence_watchdog", + "type": "log_group", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "CloudWatch log group for Lambda execution / Route 53 query logs" + } + }, + { + "component_id": "aws::log_group::opa_compliance", + "type": "log_group", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "CloudWatch log group for Lambda execution / Route 53 query logs" + } + }, + { + "component_id": "aws::log_group::silk_apigw", + "type": "log_group", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "CloudWatch log group for the Silk Reeling API Gateway access logs" + } + }, + { + "component_id": "aws::log_group::silk_reeling", + "type": "log_group", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "CloudWatch log group for Lambda execution / Route 53 query logs" + } + }, + { + "component_id": "aws::metric_alarm::evidence[artifact-stale]", + "type": "metric_alarm", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Evidence SLA alarm on a watchdog metric (VDR age, runtime-signal age, nightly result)" + } + }, + { + "component_id": "aws::metric_alarm::evidence[nightly-failed]", + "type": "metric_alarm", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Evidence SLA alarm on a watchdog metric (VDR age, runtime-signal age, nightly result)" + } + }, + { + "component_id": "aws::metric_alarm::evidence[runtime-age]", + "type": "metric_alarm", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Evidence SLA alarm on a watchdog metric (VDR age, runtime-signal age, nightly result)" + } + }, + { + "component_id": "aws::metric_alarm::evidence[vdr-age]", + "type": "metric_alarm", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Evidence SLA alarm on a watchdog metric (VDR age, runtime-signal age, nightly result)" + } + }, + { + "component_id": "aws::identity_provider::silk_reeling", + "type": "identity_provider", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Cognito user pool gating the Silk Reeling app (admin-create users, required TOTP MFA, OAuth2 PKCE Hosted UI; issues the JWTs the API Gateway authorizer validates)" + } + }, + { + "component_id": "aws::iam_role::evidence_watchdog", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "IAM role assumed by the evidence SLA watchdog Lambda" + } + }, + { + "component_id": "aws::iam_role::lambda_opa", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "IAM role assumed by the runtime KSI emitter Lambda" + } + }, + { + "component_id": "aws::iam_role::silk_reeling", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "IAM role assumed by the Silk Reeling app Lambda" + } + }, + { + "component_id": "aws::iam_policy::evidence_watchdog", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role samaydlette-com-evidence-watchdog-role" + } + }, + { + "component_id": "aws::iam_policy::lambda_opa", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role samaydlette-com-lambda-opa-role" + } + }, + { + "component_id": "aws::iam_policy::silk_reeling", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role samaydlette-com-silk-reeling-role" + } + }, + { + "component_id": "aws::kms_key::at_rest", + "type": "kms_key", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Customer-managed KMS key for at-rest encryption / asymmetric signing" + } + }, + { + "component_id": "aws::kms_key::dnssec_ksk", + "type": "kms_key", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-1", + "function": "Customer-managed KMS key for at-rest encryption / asymmetric signing" + } + }, + { + "component_id": "aws::kms_key::runtime_signing", + "type": "kms_key", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Customer-managed KMS key for at-rest encryption / asymmetric signing" + } + }, + { + "component_id": "aws::kms_key::silk_reeling", + "type": "kms_key", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Customer-managed KMS key for at-rest encryption / asymmetric signing" + } + }, + { + "component_id": "aws::function::evidence_watchdog", + "type": "function", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Hourly evidence SLA watchdog; publishes evidence-age and nightly-result metrics for the alarms" + } + }, + { + "component_id": "aws::function::opa_compliance", + "type": "function", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Daily runtime KSI emitter; revalidates live AWS configuration" + } + }, + { + "component_id": "aws::function::silk_reeling", + "type": "function", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Silk Reeling Mirror application backend (Cognito-gated Tai Chi coaching API)" + } + }, + { + "component_id": "aws::object_store::cloudtrail", + "type": "object_store", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Delivery bucket for the account's CloudTrail management-event trail" + } + }, + { + "component_id": "aws::object_store::logs", + "type": "object_store", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Access-log bucket for the site bucket and CDN" + } + }, + { + "component_id": "aws::notification_topic::evidence_alerts", + "type": "notification_topic", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Evidence-alert topic: delivers CloudWatch alarm state changes to the operator by email" + } + }, + { + "component_id": "aws::message_queue::compliance_dlq", + "type": "message_queue", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Dead-letter queue for failed asynchronous invocations of the compliance and watchdog Lambdas" + } + }, + { + "component_id": "aws::kv_table::tflock", + "type": "kv_table", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Terraform state lock for the application and bootstrap stacks (one lock item per run; no state contents)" + } + }, + { + "component_id": "aws::iam_group::operators", + "type": "iam_group", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "IAM group for the human operator(s); holds IAM administration privileges (POAM-026)" + } + }, + { + "component_id": "aws::iam_group::read_only", + "type": "iam_group", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "IAM group granting read-only access (ReadOnlyAccess, with denies on secret values and CMK decryption)" + } + }, + { + "component_id": "aws::oidc_provider::github", + "type": "oidc_provider", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "GitHub Actions OIDC identity provider trusted by the CI/CD deploy role (workload identity; replaced long-lived keys per POAM-001)" + } + }, + { + "component_id": "aws::iam_role::deploy", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "CI deploy role (reviewer-gated prod environment)" + } + }, + { + "component_id": "aws::iam_role::evidence_nightly", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Nightly evidence workflow role" + } + }, + { + "component_id": "aws::iam_role::plan", + "type": "iam_role", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Read-only plan role for pull-request and main-branch checks" + } + }, + { + "component_id": "aws::iam_policy::cloudtrail_management", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::cognito_management", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::compliance_dlq", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::compliance_kms", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::compliance_logs", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::dnssec_management", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::evidence_nightly_cdn", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-evidence-nightly-oidc" + } + }, + { + "component_id": "aws::iam_policy::evidence_nightly_publish", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-evidence-nightly-oidc" + } + }, + { + "component_id": "aws::iam_policy::evidence_nightly_reconcile_reads", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-evidence-nightly-oidc" + } + }, + { + "component_id": "aws::iam_policy::evidence_watchdog_management", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::log_bucket_management", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::plan_access", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-plan-oidc" + } + }, + { + "component_id": "aws::iam_policy::reconcile_reads", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::iam_policy::tfstate_backend", + "type": "iam_policy", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Inline policy on role github-actions-deploy-oidc" + } + }, + { + "component_id": "aws::object_store::tfstate", + "type": "object_store", + "security_category": { + "confidentiality": "moderate", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "region": "us-east-2", + "function": "Remote Terraform state for the application and bootstrap stacks" + } + }, + { + "component_id": "ext::sigstore-fulcio", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "Sigstore Fulcio" + } + }, + { + "component_id": "ext::sigstore-rekor", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "Sigstore Rekor" + } + }, + { + "component_id": "ext::github-oidc", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "GitHub Actions OIDC token issuer" + } + }, + { + "component_id": "ext::github-repo", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "GitHub repository + Actions" + } + }, + { + "component_id": "ext::duo-mfa", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "Duo (operator MFA)" + } + }, + { + "component_id": "ext::github-advisory-db", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "GitHub Advisory Database" + } + }, + { + "component_id": "ext::cisa-kev", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "CISA Known Exploited Vulnerabilities catalog" + } + }, + { + "component_id": "ext::first-epss", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "FIRST Exploit Prediction Scoring System (EPSS) scores" + } + }, + { + "component_id": "ext::anchore-grype-db", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "Grype vulnerability database (Anchore)" + } + }, + { + "component_id": "ext::jsdelivr", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "jsDelivr CDN (MediaPipe Tasks Vision runtime)" + } + }, + { + "component_id": "ext::google-cloud-storage", + "type": "external_service", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "External service in boundary per ROT #2 (affects CIA without separate FedRAMP ATO)", + "name": "Google Cloud Storage (MediaPipe model bucket)" + } + }, + { + "component_id": "npm::@aws-sdk/checksums@3.1001.6", + "type": "npm_package", + "security_category": { + "confidentiality": "not-applicable", + "integrity": "moderate", + "availability": "not-applicable" + }, + "attributes": { + "function": "Runtime dependency of the compliance/KSI Lambda (npm)", + "name": "@aws-sdk/checksums" + } + }, + { + "component_id": "pypi::annotated-doc@0.0.5", + "type": "pypi_package", + "security_category": { + "confidentiality": "not-applicable", + "integrity": "moderate", + "availability": "not-applicable" + }, + "attributes": { + "function": "Dependency of the Silk Reeling application Lambda (PyPI)", + "name": "annotated-doc" + } + }, + { + "component_id": "html::404.html", + "type": "html_artifact", + "security_category": { + "confidentiality": "low", + "integrity": "moderate", + "availability": "low" + }, + "attributes": { + "function": "Public site content" + } + } + ], + "ksis": [ + { + "id": "KSI-CED-RAT", + "method": "documentation", + "status": "pass", + "evidence": { + "component_refs": [] + } + }, + { + "id": "KSI-CMT-LMC", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::cdn_distribution::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling" + ] + } + }, + { + "id": "KSI-CMT-RMV", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::cdn_distribution::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling" + ] + } + }, + { + "id": "KSI-CMT-RVP", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::cdn_distribution::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling" + ] + } + }, + { + "id": "KSI-CMT-VTD", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::cdn_distribution::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling" + ] + } + }, + { + "id": "KSI-CNA-DFP", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-EIS", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-IBP", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-MAT", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-OFA", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-RNT", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-RVP", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-CNA-ULN", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::identity_provider::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::dns_zone::website" + ] + } + }, + { + "id": "KSI-IAM-AAM", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-IAM-APM", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-IAM-ELP", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-IAM-JIT", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-IAM-SNU", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-IAM-SUS", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::identity_provider::silk_reeling", + "aws::oidc_provider::github", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::iam_group::operators", + "aws::iam_group::read_only" + ] + } + }, + { + "id": "KSI-INR-AAR", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::notification_topic::evidence_alerts" + ] + } + }, + { + "id": "KSI-INR-RIR", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::notification_topic::evidence_alerts" + ] + } + }, + { + "id": "KSI-INR-RPI", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::notification_topic::evidence_alerts" + ] + } + }, + { + "id": "KSI-MLA-ALA", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::message_queue::compliance_dlq", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::cdn_distribution::website", + "aws::notification_topic::evidence_alerts", + "aws::audit_log_trail::management" + ] + } + }, + { + "id": "KSI-MLA-EVC", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::message_queue::compliance_dlq", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::cdn_distribution::website", + "aws::notification_topic::evidence_alerts", + "aws::audit_log_trail::management" + ] + } + }, + { + "id": "KSI-MLA-LET", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::message_queue::compliance_dlq", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::cdn_distribution::website", + "aws::notification_topic::evidence_alerts", + "aws::audit_log_trail::management" + ] + } + }, + { + "id": "KSI-MLA-OSM", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::message_queue::compliance_dlq", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::cdn_distribution::website", + "aws::notification_topic::evidence_alerts", + "aws::audit_log_trail::management" + ] + } + }, + { + "id": "KSI-MLA-RVL", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::message_queue::compliance_dlq", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::cdn_distribution::website", + "aws::notification_topic::evidence_alerts", + "aws::audit_log_trail::management" + ] + } + }, + { + "id": "KSI-PIY-GIV", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::tls_certificate::website", + "aws::cdn_distribution::website", + "aws::dns_zone::website", + "aws::object_store::website", + "aws::api_gateway::silk_reeling", + "aws::audit_log_trail::management", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::identity_provider::silk_reeling", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::notification_topic::evidence_alerts", + "aws::message_queue::compliance_dlq", + "aws::kv_table::tflock", + "aws::iam_group::operators", + "aws::iam_group::read_only", + "aws::oidc_provider::github", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::object_store::tfstate", + "npm::@aws-sdk/checksums@3.1001.6", + "pypi::annotated-doc@0.0.5", + "html::404.html", + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage" + ] + } + }, + { + "id": "KSI-PIY-RES", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::tls_certificate::website", + "aws::cdn_distribution::website", + "aws::dns_zone::website", + "aws::object_store::website", + "aws::api_gateway::silk_reeling", + "aws::audit_log_trail::management", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::identity_provider::silk_reeling", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::notification_topic::evidence_alerts", + "aws::message_queue::compliance_dlq", + "aws::kv_table::tflock", + "aws::iam_group::operators", + "aws::iam_group::read_only", + "aws::oidc_provider::github", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::object_store::tfstate", + "npm::@aws-sdk/checksums@3.1001.6", + "pypi::annotated-doc@0.0.5", + "html::404.html", + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage" + ] + } + }, + { + "id": "KSI-PIY-RIS", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::tls_certificate::website", + "aws::cdn_distribution::website", + "aws::dns_zone::website", + "aws::object_store::website", + "aws::api_gateway::silk_reeling", + "aws::audit_log_trail::management", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::identity_provider::silk_reeling", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::notification_topic::evidence_alerts", + "aws::message_queue::compliance_dlq", + "aws::kv_table::tflock", + "aws::iam_group::operators", + "aws::iam_group::read_only", + "aws::oidc_provider::github", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::object_store::tfstate", + "npm::@aws-sdk/checksums@3.1001.6", + "pypi::annotated-doc@0.0.5", + "html::404.html", + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage" + ] + } + }, + { + "id": "KSI-PIY-RSD", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::tls_certificate::website", + "aws::cdn_distribution::website", + "aws::dns_zone::website", + "aws::object_store::website", + "aws::api_gateway::silk_reeling", + "aws::audit_log_trail::management", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::identity_provider::silk_reeling", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::notification_topic::evidence_alerts", + "aws::message_queue::compliance_dlq", + "aws::kv_table::tflock", + "aws::iam_group::operators", + "aws::iam_group::read_only", + "aws::oidc_provider::github", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::object_store::tfstate", + "npm::@aws-sdk/checksums@3.1001.6", + "pypi::annotated-doc@0.0.5", + "html::404.html", + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage" + ] + } + }, + { + "id": "KSI-PIY-RVD", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::tls_certificate::website", + "aws::cdn_distribution::website", + "aws::dns_zone::website", + "aws::object_store::website", + "aws::api_gateway::silk_reeling", + "aws::audit_log_trail::management", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::log_group::evidence_watchdog", + "aws::log_group::opa_compliance", + "aws::log_group::silk_apigw", + "aws::log_group::silk_reeling", + "aws::metric_alarm::evidence[artifact-stale]", + "aws::metric_alarm::evidence[nightly-failed]", + "aws::metric_alarm::evidence[runtime-age]", + "aws::metric_alarm::evidence[vdr-age]", + "aws::identity_provider::silk_reeling", + "aws::iam_role::evidence_watchdog", + "aws::iam_role::lambda_opa", + "aws::iam_role::silk_reeling", + "aws::iam_policy::evidence_watchdog", + "aws::iam_policy::lambda_opa", + "aws::iam_policy::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::notification_topic::evidence_alerts", + "aws::message_queue::compliance_dlq", + "aws::kv_table::tflock", + "aws::iam_group::operators", + "aws::iam_group::read_only", + "aws::oidc_provider::github", + "aws::iam_role::deploy", + "aws::iam_role::evidence_nightly", + "aws::iam_role::plan", + "aws::iam_policy::cloudtrail_management", + "aws::iam_policy::cognito_management", + "aws::iam_policy::compliance_dlq", + "aws::iam_policy::compliance_kms", + "aws::iam_policy::compliance_logs", + "aws::iam_policy::dnssec_management", + "aws::iam_policy::evidence_nightly_cdn", + "aws::iam_policy::evidence_nightly_publish", + "aws::iam_policy::evidence_nightly_reconcile_reads", + "aws::iam_policy::evidence_watchdog_management", + "aws::iam_policy::log_bucket_management", + "aws::iam_policy::plan_access", + "aws::iam_policy::reconcile_reads", + "aws::iam_policy::tfstate_backend", + "aws::object_store::tfstate", + "npm::@aws-sdk/checksums@3.1001.6", + "pypi::annotated-doc@0.0.5", + "html::404.html", + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage" + ] + } + }, + { + "id": "KSI-RPL-ABO", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate" + ] + } + }, + { + "id": "KSI-RPL-ARP", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate" + ] + } + }, + { + "id": "KSI-RPL-RRO", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate" + ] + } + }, + { + "id": "KSI-RPL-TRC", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate" + ] + } + }, + { + "id": "KSI-SCR-MIT", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage", + "pypi::annotated-doc@0.0.5", + "npm::@aws-sdk/checksums@3.1001.6" + ] + } + }, + { + "id": "KSI-SCR-MON", + "method": "inventory-attestation", + "status": "pass", + "evidence": { + "component_refs": [ + "ext::sigstore-fulcio", + "ext::sigstore-rekor", + "ext::github-oidc", + "ext::github-repo", + "ext::duo-mfa", + "ext::github-advisory-db", + "ext::cisa-kev", + "ext::first-epss", + "ext::anchore-grype-db", + "ext::jsdelivr", + "ext::google-cloud-storage", + "pypi::annotated-doc@0.0.5", + "npm::@aws-sdk/checksums@3.1001.6" + ] + } + }, + { + "id": "KSI-SVC-ACM", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-ASM", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-EIS", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-PRR", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-RUD", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-SIN", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-VCM", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + }, + { + "id": "KSI-SVC-VRI", + "method": "policy-validation", + "status": "pass", + "evidence": { + "component_refs": [ + "aws::api_gateway::silk_reeling", + "aws::cdn_distribution::website", + "aws::tls_certificate::website", + "aws::event_schedule::evidence_watchdog", + "aws::event_schedule::opa_compliance", + "aws::object_store::website", + "aws::object_store::cloudtrail", + "aws::object_store::logs", + "aws::object_store::tfstate", + "aws::function::evidence_watchdog", + "aws::function::opa_compliance", + "aws::function::silk_reeling", + "aws::kms_key::at_rest", + "aws::kms_key::dnssec_ksk", + "aws::kms_key::runtime_signing", + "aws::kms_key::silk_reeling" + ] + } + } + ] +} diff --git a/tests/fixtures/migration/ksi-catalog-2026-11-05.json b/tests/fixtures/migration/ksi-catalog-2026-11-05.json new file mode 100644 index 00000000..7353e477 --- /dev/null +++ b/tests/fixtures/migration/ksi-catalog-2026-11-05.json @@ -0,0 +1,2206 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "FedRAMP.schema.json", + "info": { + "name": "Key Security Indicators", + "short_name": "KSI", + "effective": { + "rev5": { + "is": "no" + }, + "20x": { + "is": "required", + "signup_url": "https://www.fedramp.gov/20x/phase-two/participate/", + "current_status": "Phase 2 Pilot", + "start_date": "2025-11-18", + "end_date": "2026-03-31", + "comments": [ + "Phase 1 pilot authorizations have one year from authorization to fully address this process but must demonstrate continuous quarterly progress.", + "Phase 2 Pilot participants must demonstrate significant progress towards addressing this process prior to submission for authorization review." + ] + } + }, + "releases": [ + { + "id": "26.06", + "published_date": "2026-06-24", + "description": "Consolidated Rules for 2026 (official launch). Key Security Indicators renumbered to mnemonic IDs; the AFR (Authorization by FedRAMP) family was retired and TPR (Third-Party) was renamed SCR (Supply Chain Risk). Rebuilt from the published markdown corpus by scripts/staged/build-ksi-catalog.py." + }, + { + "id": "25.12A", + "published_date": "2025-12-29", + "description": "This release updates a significant number of KSIs to improve clarity and expectations; in general the measures required to meet each KSI remain unchanged but these updates should make it easier to address them. In additional, some KSIs have been retired.", + "public_comment": false + }, + { + "id": "25.11C", + "published_date": "2025-12-01", + "description": "No effective/material changes; adjusted some KSI-AFR indcators to reference \"process\" instead of \"standard\" and added a note to KSI-AFR-02 addressing the potential infinite loop.", + "public_comment": false, + "machine_readable_link": "https://raw.githubusercontent.com/FedRAMP/docs/ced2160b22455ed26a11bf697be8f0ae3e1e5dff/data/FRMR.KSI.key-security-indicators.json" + }, + { + "id": "25.11B", + "published_date": "2025-11-24", + "description": "No material changes to content; updated JSON structure with additional information about Rev5 application added.", + "public_comment": false, + "machine_readable_link": "https://raw.githubusercontent.com/FedRAMP/docs/a37618fccf49d6b3406d90edf2125dc6cfcba140/data/FRMR.KSI.key-security-indicators.json" + }, + { + "id": "25.11A", + "published_date": "2025-11-18", + "description": "Updates Key Security Indicators for the FedRAMP 20x Phase Two pilot, including underlying structural changes to machine-readable docs; Renamed KSI \"indicator\" property to \"theme\" and KSI \"requirements\" property to \"indicators\" to match current naming conventions..", + "public_comment": true, + "related_rfcs": [ + { + "start_date": "2025-09-10", + "end_date": "2025-11-17", + "id": "0015", + "url": "https://www.fedramp.gov/rfcs/0015/", + "discussion_url": "https://github.com/FedRAMP/community/discussions/84", + "short_name": "rfc-0015-recommended-secure-configuration", + "full_name": "FedRAMP RFC-0015: Recommended Secure Configuration Standard" + } + ], + "machine_readable_link": "https://raw.githubusercontent.com/FedRAMP/docs/3291fa1952f5b68eaf1a815a8ef1846ae8ca9e2f/data/FRMR.KSI.key-security-indicators.json" + }, + { + "id": "25.10A", + "published_date": "2025-10-17", + "description": "Minor updates to improve clarity; switch from federal information to federal customer data; add impact level metadata; no substantive changes.", + "public_comment": false, + "machine_readable_link": null + }, + { + "id": "25.05D", + "published_date": "2025-08-24", + "description": "Minor non-breaking updates to align term definitions and highlighted terms across updated materials (no changes to KSIs, definitions are now in FRD-ALL).", + "public_comment": false, + "machine_readable_link": null + }, + { + "id": "25.05C", + "published_date": "2025-06-28", + "description": "Key Security Indicators in this release are unchanged from previously releases. 25.05C adds references for each KSI to underlying SP 800-53 controls.", + "public_comment": false, + "machine_readable_link": null + }, + { + "id": "25.05B", + "published_date": "2025-06-18", + "description": "Initial release of Key Security Indicators from 25.05; the previous 25.05A release contained errors during conversion to JSON that are fixed in this release, the KSIs should now be identical to the original 25.05 paper release of the KSIs released on 2025-05-30. FRR-KSI-AY rules were converted to FRR-KSI rules, but otherwise unchanged.", + "public_comment": false, + "machine_readable_link": null + }, + { + "id": "25.05A", + "published_date": "2025-05-30", + "description": "Initial release of Key Security Indicators", + "public_comment": true, + "related_rfcs": [ + { + "start_date": "2025-04-24", + "end_date": "2025-05-24", + "id": "0006", + "url": "https://www.fedramp.gov/rfcs/0006/", + "discussion_url": "https://github.com/FedRAMP/community/discussions/3", + "short_name": "rfc-0006-key-security-indicators", + "full_name": "FedRAMP RFC-0006: 20x Phase One Key Security Indicators" + } + ], + "machine_readable_link": null + } + ], + "front_matter": { + "authority": [ + { + "reference": "OMB Circular A-130", + "reference_url": "https://whitehouse.gov/wp-content/uploads/legacy_drupal_files/omb/circulars/A130/a130revised.pdf", + "description": "Appendix I states \"Agencies may also develop overlays for specific types of information or communities of interest (e.g., all web-based applications, all health care-related systems) as part of the security control selection process. Overlays provide a specification of security or privacy controls, control enhancements, supplemental guidance, and other supporting information as part of the tailoring process, that is intended to complement (and further refine) security control baselines. The overlay may be more stringent or less stringent than the original security control baseline and can be applied to multiple information systems.\"" + }, + { + "reference": "NIST SP 800-53B", + "reference_url": "https://csrc.nist.gov/pubs/sp/800/53/b/upd1/final", + "description": "Section 2.5 states \"As the number of controls in [SP 800-53] grows in response to an increasingly sophisticated threat space, it is important for organizations to have the ability to describe key capabilities needed to protect organizational missions and business functions, and to subsequently select controls that\u2014if properly designed, developed, and implemented\u2014produce such capabilities. The use of capabilities simplifies how the protection problem is viewed conceptually. Using the construct of a capability provides a method of grouping controls that are employed for a common purpose or to achieve a common objective.\" This section later states \"Ultimately, authorization decisions (i.e., risk acceptance decisions) are made based on the degree to which the desired capabilities have been effectively achieved.\"" + }, + { + "reference": "NIST SP 800-53A", + "reference_url": "https://csrc.nist.gov/pubs/sp/800/53/a/r5/final", + "description": "Section 3.5 states \"When organizations employ the concept of capabilities, automated and manual assessments account for all security and privacy controls that comprise the security and privacy capabilities. Assessors are aware of how the controls work together to provide such capabilities.\"" + }, + { + "reference": "FedRAMP Authorization Act (44 USC \u00a7 3609 (a) (1))", + "reference_url": "https://fedramp.gov/docs/authority/law/#a-roles-and-responsibilities", + "description": "requires that the Administrator of the General Services Administration shall \"in consultation with the [DHS] Secretary, develop, coordinate, and implement a process to support agency review, reuse, and standardization, where appropriate, of security assessments of cloud computing products and services...\" 44 USC \u00a7 3609 (c) (2) further states that \"the [GSA] Administrator shall establish a means for the automation of security assessments and reviews.\"", + "delegation": "These responsibilities are delegated to the FedRAMP Director", + "delegation_url": "https://www.gsa.gov/directives-library/gsa-delegations-of-authority-fedramp" + } + ], + "purpose": "Modern cloud services use automated or code-driven configuration management and control planes to ensure predictable, repeatable, reliable, and secure outcomes during deployment and operation. The majority of a service security assessment can take place continuously via automated validation for simple cloud-native services if the need for a traditional control-by-control narrative approach is removed.", + "expected_outcomes": [ + "Cloud service providers following commercial security best practices will be able to meet and validate FedRAMP security requirements with the application of simple changes and automated capabilities", + "Third-party independent assessors will have a simpler framework to assess security and implementation decisions based on engineering decisions in context", + "Federal agencies will be able to easily, quickly, and effectively review and consume security information about the service to make informed risk-based authorization to operate decisions based on their planned use case" + ] + } + }, + "FRR.KSI": {}, + "KSI": { + "CED": { + "id": "KSI-CED", + "name": "Cybersecurity Education", + "indicators": [ + { + "id": "KSI-CED-RAT", + "name": "Reviewing All Training", + "statement": "The effectiveness of relevant cybersecurity education and training is persistently reviewed, including at least general training for all employees, role-specific training for employees in high risk roles, training for development and engineering staff on secure software delivery, and training for staff involved with incident response or disaster recovery.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cp-3", + "title": "Contingency Training" + }, + { + "control_id": "ir-2", + "title": "Incident Response Training" + }, + { + "control_id": "ps-6", + "title": "Access Agreements" + }, + { + "control_id": "at-2", + "title": "Literacy Training and Awareness" + }, + { + "control_id": "at-2.2", + "title": "Insider Threat" + }, + { + "control_id": "at-2.3", + "title": "Social Engineering and Mining" + }, + { + "control_id": "at-3.5", + "title": "Processing Personally Identifiable Information" + }, + { + "control_id": "at-4", + "title": "Training Records" + }, + { + "control_id": "ir-2.3", + "title": "Breach" + }, + { + "control_id": "at-3", + "title": "Role-based Training" + }, + { + "control_id": "sr-11.1", + "title": "Anti-counterfeit Training" + } + ] + } + ] + }, + "CMT": { + "id": "KSI-CMT", + "name": "Change Management", + "indicators": [ + { + "id": "KSI-CMT-LMC", + "name": "Logging Changes", + "statement": "Modifications to the cloud service offering are logged and monitored.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "au-2", + "title": "Event Logging" + }, + { + "control_id": "cm-3", + "title": "Configuration Change Control" + }, + { + "control_id": "cm-3.2", + "title": "Testing, Validation, and Documentation of Changes" + }, + { + "control_id": "cm-4.2", + "title": "Verification of Controls" + }, + { + "control_id": "cm-6", + "title": "Configuration Settings" + }, + { + "control_id": "cm-8.3", + "title": "Automated Unauthorized Component Detection" + }, + { + "control_id": "ma-2", + "title": "Controlled Maintenance" + } + ] + }, + { + "id": "KSI-CMT-RMV", + "name": "Redeploying vs Modifying", + "statement": "Changes to machine-based information resources are executed through the redeployment of version controlled resources rather than direct modification wherever reasonable.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-2", + "title": "Baseline Configuration" + }, + { + "control_id": "cm-3", + "title": "Configuration Change Control" + }, + { + "control_id": "cm-5", + "title": "Access Restrictions for Change" + }, + { + "control_id": "cm-6", + "title": "Configuration Settings" + }, + { + "control_id": "cm-7", + "title": "Least Functionality" + }, + { + "control_id": "cm-8.1", + "title": "Updates During Installation and Removal" + }, + { + "control_id": "si-3", + "title": "Malicious Code Protection" + } + ] + }, + { + "id": "KSI-CMT-RVP", + "name": "Reviewing Change Procedures", + "statement": "The effectiveness of documented change management procedures is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-3", + "title": "Configuration Change Control" + }, + { + "control_id": "cm-3.2", + "title": "Testing, Validation, and Documentation of Changes" + }, + { + "control_id": "cm-3.4", + "title": "Security and Privacy Representatives" + }, + { + "control_id": "cm-5", + "title": "Access Restrictions for Change" + }, + { + "control_id": "cm-7.1", + "title": "Periodic Review" + }, + { + "control_id": "cm-9", + "title": "Configuration Management Plan" + } + ] + }, + { + "id": "KSI-CMT-VTD", + "name": "Validating Throughout Deployment", + "statement": "Persistent testing and validation of changes throughout deployment is automated.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-3", + "title": "Configuration Change Control" + }, + { + "control_id": "cm-3.2", + "title": "Testing, Validation, and Documentation of Changes" + }, + { + "control_id": "cm-4.2", + "title": "Verification of Controls" + }, + { + "control_id": "si-2", + "title": "Flaw Remediation" + } + ] + } + ] + }, + "CNA": { + "id": "KSI-CNA", + "name": "Cloud Native Architecture", + "indicators": [ + { + "id": "KSI-CNA-DFP", + "name": "Defining Functionality and Privileges", + "statement": "The functionality and privileges for infrastructure and services are strictly defined.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-2", + "title": "Baseline Configuration" + }, + { + "control_id": "si-3", + "title": "Malicious Code Protection" + } + ] + }, + { + "id": "KSI-CNA-EIS", + "name": "Enforcing Intended State", + "statement": "Automated services are used to persistently assess the security of all machine-based information resources and automatically enforce their intended operational state.", + "impact": { + "low": false, + "moderate": true + }, + "controls": [ + { + "control_id": "ca-2.1", + "title": "Independent Assessors" + }, + { + "control_id": "ca-7.1", + "title": "Independent Assessment" + } + ] + }, + { + "id": "KSI-CNA-IBP", + "name": "Implementing Best Practices", + "statement": "The use and configuration of third-party machine-based information resources is persistently compared against the original provider's best practices and guidance.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-17.3", + "title": "Managed Access Control Points" + }, + { + "control_id": "cm-2", + "title": "Baseline Configuration" + }, + { + "control_id": "pl-10", + "title": "Baseline Selection" + } + ] + }, + { + "id": "KSI-CNA-MAT", + "name": "Minimizing Attack Surface", + "statement": "Machine-based information resources are persistently reviewed to ensure they have a minimal attack surface and that lateral movement is minimized if compromised.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-17.3", + "title": "Managed Access Control Points" + }, + { + "control_id": "ac-18.1", + "title": "Authentication and Encryption" + }, + { + "control_id": "ac-18.3", + "title": "Disable Wireless Networking" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "ca-9", + "title": "Internal System Connections" + }, + { + "control_id": "sc-7.3", + "title": "Access Points" + }, + { + "control_id": "sc-7.4", + "title": "External Telecommunications Services" + }, + { + "control_id": "sc-7.5", + "title": "Deny by Default \u2014 Allow by Exception" + }, + { + "control_id": "sc-7.8", + "title": "Route Traffic to Authenticated Proxy Servers" + }, + { + "control_id": "sc-8", + "title": "Transmission Confidentiality and Integrity" + }, + { + "control_id": "sc-10", + "title": "Network Disconnect" + }, + { + "control_id": "si-10", + "title": "Information Input Validation" + }, + { + "control_id": "si-11", + "title": "Error Handling" + }, + { + "control_id": "si-16", + "title": "Memory Protection" + } + ] + }, + { + "id": "KSI-CNA-OFA", + "name": "Optimizing for Availability", + "statement": "Machine-based information resources are persistently reviewed to ensure they are appropriately optimized for high availability and rapid recovery.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [] + }, + { + "id": "KSI-CNA-RNT", + "name": "Restricting Network Traffic", + "statement": "Machine-based information resources are persistently reviewed to ensure they are appropriately configured to limit inbound and outbound network traffic.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-17.3", + "title": "Managed Access Control Points" + }, + { + "control_id": "ca-9", + "title": "Internal System Connections" + }, + { + "control_id": "cm-7.1", + "title": "Periodic Review" + }, + { + "control_id": "sc-7.5", + "title": "Deny by Default \u2014 Allow by Exception" + }, + { + "control_id": "si-8", + "title": "Spam Protection" + } + ] + }, + { + "id": "KSI-CNA-RVP", + "name": "Reviewing Protections", + "statement": "The effectiveness of protection against denial of service attacks and other unwanted activity for machine-based information resources is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "sc-5", + "title": "Denial-of-service Protection" + }, + { + "control_id": "si-8", + "title": "Spam Protection" + }, + { + "control_id": "si-8.2", + "title": "Automatic Updates" + } + ] + }, + { + "id": "KSI-CNA-ULN", + "name": "Using Logical Networking", + "statement": "Logical networking and related capabilities are used and persistently reviewed to enforce traffic flow controls.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-12", + "title": "Session Termination" + }, + { + "control_id": "ac-17.3", + "title": "Managed Access Control Points" + }, + { + "control_id": "ca-9", + "title": "Internal System Connections" + }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, + { + "control_id": "sc-7", + "title": "Boundary Protection" + }, + { + "control_id": "sc-7.7", + "title": "Split Tunneling for Remote Devices" + }, + { + "control_id": "sc-8", + "title": "Transmission Confidentiality and Integrity" + }, + { + "control_id": "sc-10", + "title": "Network Disconnect" + } + ] + } + ] + }, + "IAM": { + "id": "KSI-IAM", + "name": "Identity and Access Management", + "indicators": [ + { + "id": "KSI-IAM-AAM", + "name": "Automating Account Management", + "statement": "The lifecycle and privileges of all accounts, roles, and groups are securely managed using automation.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2.2", + "title": "Automated Temporary and Emergency Account Management" + }, + { + "control_id": "ac-2.3", + "title": "Disable Accounts" + }, + { + "control_id": "ac-2.13", + "title": "Disable Accounts for High-risk Individuals" + }, + { + "control_id": "ac-6.7", + "title": "Review of User Privileges" + }, + { + "control_id": "ia-4.4", + "title": "Identify User Status" + }, + { + "control_id": "ia-12", + "title": "Identity Proofing" + }, + { + "control_id": "ia-12.2", + "title": "Identity Evidence" + }, + { + "control_id": "ia-12.3", + "title": "Identity Evidence Validation and Verification" + }, + { + "control_id": "ia-12.5", + "title": "Address Confirmation" + } + ] + }, + { + "id": "KSI-IAM-APM", + "name": "Adopting Passwordless Methods", + "statement": "Secure passwordless methods are used for user authentication and authorization when feasible, otherwise strong passwords with phishing-resistant MFA is used.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-3", + "title": "Access Enforcement" + }, + { + "control_id": "ia-5.1", + "title": "Password-based Authentication" + }, + { + "control_id": "ia-5.2", + "title": "Public Key-based Authentication" + }, + { + "control_id": "ia-5.6", + "title": "Protection of Authenticators" + }, + { + "control_id": "ia-6", + "title": "Authentication Feedback" + }, + { + "control_id": "ac-2", + "title": "Account Management" + }, + { + "control_id": "ia-2", + "title": "Identification and Authentication (Organizational Users)" + }, + { + "control_id": "ia-2.1", + "title": "Multi-factor Authentication to Privileged Accounts" + }, + { + "control_id": "ia-2.2", + "title": "Multi-factor Authentication to Non-privileged Accounts" + }, + { + "control_id": "ia-2.8", + "title": "Access to Accounts \u2014 Replay Resistant" + }, + { + "control_id": "ia-5", + "title": "Authenticator Management" + }, + { + "control_id": "ia-8", + "title": "Identification and Authentication (Non-organizational Users)" + }, + { + "control_id": "sc-23", + "title": "Session Authenticity" + } + ] + }, + { + "id": "KSI-IAM-ELP", + "name": "Ensuring Least Privilege", + "statement": "Identity and access management measures are used and persistently reviewed to ensure each user or device can only access the resources they need.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2.5", + "title": "Inactivity Logout" + }, + { + "control_id": "ac-2.6", + "title": "Dynamic Privilege Management" + }, + { + "control_id": "ac-3", + "title": "Access Enforcement" + }, + { + "control_id": "ac-4", + "title": "Information Flow Enforcement" + }, + { + "control_id": "ac-6", + "title": "Least Privilege" + }, + { + "control_id": "ac-12", + "title": "Session Termination" + }, + { + "control_id": "ac-14", + "title": "Permitted Actions Without Identification or Authentication" + }, + { + "control_id": "ac-17", + "title": "Remote Access" + }, + { + "control_id": "ac-17.1", + "title": "Monitoring and Control" + }, + { + "control_id": "ac-17.2", + "title": "Protection of Confidentiality and Integrity Using Encryption" + }, + { + "control_id": "ac-17.3", + "title": "Managed Access Control Points" + }, + { + "control_id": "ac-20", + "title": "Use of External Systems" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "cm-2.7", + "title": "Configure Systems and Components for High-risk Areas" + }, + { + "control_id": "cm-9", + "title": "Configuration Management Plan" + }, + { + "control_id": "ia-2", + "title": "Identification and Authentication (Organizational Users)" + }, + { + "control_id": "ia-3", + "title": "Device Identification and Authentication" + }, + { + "control_id": "ia-4", + "title": "Identifier Management" + }, + { + "control_id": "ia-4.4", + "title": "Identify User Status" + }, + { + "control_id": "ia-5.2", + "title": "Public Key-based Authentication" + }, + { + "control_id": "ia-5.6", + "title": "Protection of Authenticators" + }, + { + "control_id": "ia-11", + "title": "Re-authentication" + }, + { + "control_id": "ps-2", + "title": "Position Risk Designation" + }, + { + "control_id": "ps-3", + "title": "Personnel Screening" + }, + { + "control_id": "ps-4", + "title": "Personnel Termination" + }, + { + "control_id": "ps-5", + "title": "Personnel Transfer" + }, + { + "control_id": "ps-6", + "title": "Access Agreements" + }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, + { + "control_id": "sc-20", + "title": "Secure Name/Address Resolution Service (Authoritative Source)" + }, + { + "control_id": "sc-21", + "title": "Secure Name/Address Resolution Service (Recursive or Caching Resolver)" + }, + { + "control_id": "sc-22", + "title": "Architecture and Provisioning for Name/Address Resolution Service" + }, + { + "control_id": "sc-23", + "title": "Session Authenticity" + }, + { + "control_id": "sc-39", + "title": "Process Isolation" + }, + { + "control_id": "si-3", + "title": "Malicious Code Protection" + } + ] + }, + { + "id": "KSI-IAM-JIT", + "name": "Authorizing Just-in-Time", + "statement": "A least-privileged, role and attribute-based, and just-in-time security authorization model is used and persistently reviewed for all user and non-user accounts and services.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2", + "title": "Account Management" + }, + { + "control_id": "ac-2.1", + "title": "Automated System Account Management" + }, + { + "control_id": "ac-2.2", + "title": "Automated Temporary and Emergency Account Management" + }, + { + "control_id": "ac-2.3", + "title": "Disable Accounts" + }, + { + "control_id": "ac-2.4", + "title": "Automated Audit Actions" + }, + { + "control_id": "ac-2.6", + "title": "Dynamic Privilege Management" + }, + { + "control_id": "ac-3", + "title": "Access Enforcement" + }, + { + "control_id": "ac-4", + "title": "Information Flow Enforcement" + }, + { + "control_id": "ac-5", + "title": "Separation of Duties" + }, + { + "control_id": "ac-6", + "title": "Least Privilege" + }, + { + "control_id": "ac-6.1", + "title": "Authorize Access to Security Functions" + }, + { + "control_id": "ac-6.2", + "title": "Non-privileged Access for Nonsecurity Functions" + }, + { + "control_id": "ac-6.5", + "title": "Privileged Accounts" + }, + { + "control_id": "ac-6.7", + "title": "Review of User Privileges" + }, + { + "control_id": "ac-6.9", + "title": "Log Use of Privileged Functions" + }, + { + "control_id": "ac-6.10", + "title": "Prohibit Non-privileged Users from Executing Privileged Functions" + }, + { + "control_id": "ac-7", + "title": "Unsuccessful Logon Attempts" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "ac-17", + "title": "Remote Access" + }, + { + "control_id": "au-9.4", + "title": "Access by Subset of Privileged Users" + }, + { + "control_id": "cm-5", + "title": "Access Restrictions for Change" + }, + { + "control_id": "cm-7", + "title": "Least Functionality" + }, + { + "control_id": "cm-7.2", + "title": "Prevent Program Execution" + }, + { + "control_id": "cm-7.5", + "title": "Authorized Software \u2014 Allow-by-exception" + }, + { + "control_id": "cm-9", + "title": "Configuration Management Plan" + }, + { + "control_id": "ia-4", + "title": "Identifier Management" + }, + { + "control_id": "ia-4.4", + "title": "Identify User Status" + }, + { + "control_id": "ia-7", + "title": "Cryptographic Module Authentication" + }, + { + "control_id": "ps-2", + "title": "Position Risk Designation" + }, + { + "control_id": "ps-3", + "title": "Personnel Screening" + }, + { + "control_id": "ps-4", + "title": "Personnel Termination" + }, + { + "control_id": "ps-5", + "title": "Personnel Transfer" + }, + { + "control_id": "ps-6", + "title": "Access Agreements" + }, + { + "control_id": "ps-9", + "title": "Position Descriptions" + }, + { + "control_id": "ra-5.5", + "title": "Privileged Access" + }, + { + "control_id": "sc-2", + "title": "Separation of System and User Functionality" + }, + { + "control_id": "sc-23", + "title": "Session Authenticity" + }, + { + "control_id": "sc-39", + "title": "Process Isolation" + } + ] + }, + { + "id": "KSI-IAM-SNU", + "name": "Securing Non-User Authentication", + "statement": "Appropriately secure authentication methods are used and persistently reviewed for non-user accounts and services.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2", + "title": "Account Management" + }, + { + "control_id": "ac-2.2", + "title": "Automated Temporary and Emergency Account Management" + }, + { + "control_id": "ac-4", + "title": "Information Flow Enforcement" + }, + { + "control_id": "ac-6.5", + "title": "Privileged Accounts" + }, + { + "control_id": "ia-3", + "title": "Device Identification and Authentication" + }, + { + "control_id": "ia-5.2", + "title": "Public Key-based Authentication" + }, + { + "control_id": "ra-5.5", + "title": "Privileged Access" + } + ] + }, + { + "id": "KSI-IAM-SUS", + "name": "Responding to Suspicious Activity", + "statement": "Accounts with privileged access are disabled or otherwise secured in response to suspicious activity.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2", + "title": "Account Management" + }, + { + "control_id": "ac-2.1", + "title": "Automated System Account Management" + }, + { + "control_id": "ac-2.3", + "title": "Disable Accounts" + }, + { + "control_id": "ac-2.13", + "title": "Disable Accounts for High-risk Individuals" + }, + { + "control_id": "ac-7", + "title": "Unsuccessful Logon Attempts" + }, + { + "control_id": "ps-4", + "title": "Personnel Termination" + }, + { + "control_id": "ps-8", + "title": "Personnel Sanctions" + } + ] + } + ] + }, + "INR": { + "id": "KSI-INR", + "name": "Incident Response", + "indicators": [ + { + "id": "KSI-INR-AAR", + "name": "Generating After Action Reports", + "statement": "Incident after action reports are generated and lessons learned are persistently incorporated.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ir-3", + "title": "Incident Response Testing" + }, + { + "control_id": "ir-4", + "title": "Incident Handling" + }, + { + "control_id": "ir-4.1", + "title": "Automated Incident Handling Processes" + }, + { + "control_id": "ir-8", + "title": "Incident Response Plan" + } + ] + }, + { + "id": "KSI-INR-RIR", + "name": "Reviewing Incident Response Procedures", + "statement": "The effectiveness of documented incident response procedures is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ir-4", + "title": "Incident Handling" + }, + { + "control_id": "ir-4.1", + "title": "Automated Incident Handling Processes" + }, + { + "control_id": "ir-6", + "title": "Incident Reporting" + }, + { + "control_id": "ir-6.1", + "title": "Automated Reporting" + }, + { + "control_id": "ir-6.3", + "title": "Supply Chain Coordination" + }, + { + "control_id": "ir-7", + "title": "Incident Response Assistance" + }, + { + "control_id": "ir-7.1", + "title": "Automation Support for Availability of Information and Support" + }, + { + "control_id": "ir-8", + "title": "Incident Response Plan" + }, + { + "control_id": "ir-8.1", + "title": "Breaches" + }, + { + "control_id": "si-4.5", + "title": "System-generated Alerts" + } + ] + }, + { + "id": "KSI-INR-RPI", + "name": "Reviewing Past Incidents", + "statement": "Past incidents are persistently reviewed for patterns or vulnerabilities that were not previously apparent or identified.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ir-3", + "title": "Incident Response Testing" + }, + { + "control_id": "ir-4", + "title": "Incident Handling" + }, + { + "control_id": "ir-4.1", + "title": "Automated Incident Handling Processes" + }, + { + "control_id": "ir-5", + "title": "Incident Monitoring" + }, + { + "control_id": "ir-8", + "title": "Incident Response Plan" + } + ] + } + ] + }, + "MLA": { + "id": "KSI-MLA", + "name": "Monitoring, Logging, and Auditing", + "indicators": [ + { + "id": "KSI-MLA-ALA", + "name": "Authorizing Log Access", + "statement": "A least-privileged, role and attribute-based, and just-in-time access authorization model is used and persistently reviewed for access to log data based on organizationally defined data sensitivity.", + "impact": { + "low": false, + "moderate": true + }, + "controls": [ + { + "control_id": "si-11", + "title": "Error Handling" + } + ] + }, + { + "id": "KSI-MLA-EVC", + "name": "Evaluating Configurations", + "statement": "The configuration of machine-based information resources, especially infrastructure as code, is persistently evaluated and tested.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ca-7", + "title": "Continuous Monitoring" + }, + { + "control_id": "cm-2", + "title": "Baseline Configuration" + }, + { + "control_id": "cm-6", + "title": "Configuration Settings" + }, + { + "control_id": "si-7.7", + "title": "Integration of Detection and Response" + } + ] + }, + { + "id": "KSI-MLA-LET", + "name": "Logging Event Types", + "statement": "A list of information resources and event types that will be logged, monitored, and audited is maintained and persistently reviewed to ensure these activities occur.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2.4", + "title": "Automated Audit Actions" + }, + { + "control_id": "ac-6.9", + "title": "Log Use of Privileged Functions" + }, + { + "control_id": "ac-17.1", + "title": "Monitoring and Control" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "au-2", + "title": "Event Logging" + }, + { + "control_id": "au-7.1", + "title": "Automatic Processing" + }, + { + "control_id": "au-12", + "title": "Audit Record Generation" + }, + { + "control_id": "si-4.4", + "title": "Inbound and Outbound Communications Traffic" + }, + { + "control_id": "si-4.5", + "title": "System-generated Alerts" + }, + { + "control_id": "si-7.7", + "title": "Integration of Detection and Response" + } + ] + }, + { + "id": "KSI-MLA-OSM", + "name": "Operating SIEM Capability", + "statement": "A Security Information and Event Management (SIEM) or similar system(s) is used and persistently reviewed for centralized, tamper-resistant logging of events, activities, and changes.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-17.1", + "title": "Monitoring and Control" + }, + { + "control_id": "ac-20.1", + "title": "Limits on Authorized Use" + }, + { + "control_id": "au-2", + "title": "Event Logging" + }, + { + "control_id": "au-3", + "title": "Content of Audit Records" + }, + { + "control_id": "au-3.1", + "title": "Additional Audit Information" + }, + { + "control_id": "au-4", + "title": "Audit Log Storage Capacity" + }, + { + "control_id": "au-5", + "title": "Response to Audit Logging Process Failures" + }, + { + "control_id": "au-6.1", + "title": "Automated Process Integration" + }, + { + "control_id": "au-6.3", + "title": "Correlate Audit Record Repositories" + }, + { + "control_id": "au-7", + "title": "Audit Record Reduction and Report Generation" + }, + { + "control_id": "au-7.1", + "title": "Automatic Processing" + }, + { + "control_id": "au-8", + "title": "Time Stamps" + }, + { + "control_id": "au-9", + "title": "Protection of Audit Information" + }, + { + "control_id": "au-11", + "title": "Audit Record Retention" + }, + { + "control_id": "ir-4.1", + "title": "Automated Incident Handling Processes" + }, + { + "control_id": "si-4.2", + "title": "Automated Tools and Mechanisms for Real-time Analysis" + }, + { + "control_id": "si-4.4", + "title": "Inbound and Outbound Communications Traffic" + }, + { + "control_id": "si-7.7", + "title": "Integration of Detection and Response" + } + ] + }, + { + "id": "KSI-MLA-RVL", + "name": "Reviewing Logs", + "statement": "Logs are persistently reviewed and audited.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2.4", + "title": "Automated Audit Actions" + }, + { + "control_id": "ac-6.9", + "title": "Log Use of Privileged Functions" + }, + { + "control_id": "au-2", + "title": "Event Logging" + }, + { + "control_id": "au-6", + "title": "Audit Record Review, Analysis, and Reporting" + }, + { + "control_id": "au-6.1", + "title": "Automated Process Integration" + }, + { + "control_id": "si-4", + "title": "System Monitoring" + }, + { + "control_id": "si-4.4", + "title": "Inbound and Outbound Communications Traffic" + } + ] + } + ] + }, + "PIY": { + "id": "KSI-PIY", + "name": "Policy and Inventory", + "indicators": [ + { + "id": "KSI-PIY-GIV", + "name": "Generating Inventories", + "statement": "Authoritative sources are used to automatically generate real-time inventories of all information resources when needed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-2.2", + "title": "Automation Support for Accuracy and Currency" + }, + { + "control_id": "cm-7.5", + "title": "Authorized Software \u2014 Allow-by-exception" + }, + { + "control_id": "cm-8", + "title": "System Component Inventory" + }, + { + "control_id": "cm-8.1", + "title": "Updates During Installation and Removal" + }, + { + "control_id": "cm-12", + "title": "Information Location" + }, + { + "control_id": "cm-12.1", + "title": "Automated Tools to Support Information Location" + }, + { + "control_id": "cp-2.8", + "title": "Identify Critical Assets" + } + ] + }, + { + "id": "KSI-PIY-RES", + "name": "Reviewing Executive Support", + "statement": "Executive support for achieving the provider's security goals is persistently reviewed and demonstrated.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [] + }, + { + "id": "KSI-PIY-RIS", + "name": "Reviewing Investments in Security", + "statement": "The effectiveness of the provider's investments in achieving security goals is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-5", + "title": "Separation of Duties" + }, + { + "control_id": "ca-2", + "title": "Control Assessments" + }, + { + "control_id": "cp-2.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "cp-4.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "ir-3.2", + "title": "Coordination with Related Plans" + }, + { + "control_id": "pm-3", + "title": "Information Security and Privacy Resources" + }, + { + "control_id": "sa-2", + "title": "Allocation of Resources" + }, + { + "control_id": "sa-3", + "title": "System Development Life Cycle" + }, + { + "control_id": "sr-2.1", + "title": "Establish SCRM Team" + } + ] + }, + { + "id": "KSI-PIY-RSD", + "name": "Reviewing Security in the SDLC", + "statement": "The effectiveness of building security and privacy considerations into the Software Development Lifecycle and aligning with CISA Secure By Design principles is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-5", + "title": "Separation of Duties" + }, + { + "control_id": "au-3.3", + "title": "Limit Personally Identifiable Information Elements" + }, + { + "control_id": "cm-3.4", + "title": "Security and Privacy Representatives" + }, + { + "control_id": "pl-8", + "title": "Security and Privacy Architectures" + }, + { + "control_id": "pm-7", + "title": "Enterprise Architecture" + }, + { + "control_id": "sa-3", + "title": "System Development Life Cycle" + }, + { + "control_id": "sa-8", + "title": "Security and Privacy Engineering Principles" + }, + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + }, + { + "control_id": "sc-18", + "title": "Mobile Code" + }, + { + "control_id": "si-10", + "title": "Information Input Validation" + }, + { + "control_id": "si-11", + "title": "Error Handling" + }, + { + "control_id": "si-16", + "title": "Memory Protection" + } + ] + }, + { + "id": "KSI-PIY-RVD", + "name": "Reviewing Vulnerability Disclosures", + "statement": "The effectiveness of the provider's vulnerability disclosure program is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ra-5.11", + "title": "Public Disclosure Program" + } + ] + } + ] + }, + "RPL": { + "id": "KSI-RPL", + "name": "Recovery Planning", + "indicators": [ + { + "id": "KSI-RPL-ABO", + "name": "Aligning Backups with Objectives", + "statement": "The alignment of machine-based information resource backups with defined recovery objectives is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-2.3", + "title": "Retention of Previous Configurations" + }, + { + "control_id": "cp-6", + "title": "Alternate Storage Site" + }, + { + "control_id": "cp-9", + "title": "System Backup" + }, + { + "control_id": "cp-10", + "title": "System Recovery and Reconstitution" + }, + { + "control_id": "cp-10.2", + "title": "Transaction Recovery" + }, + { + "control_id": "si-12", + "title": "Information Management and Retention" + } + ] + }, + { + "id": "KSI-RPL-ARP", + "name": "Aligning Recovery Plan", + "statement": "The alignment of recovery plans with defined recovery objectives is persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cp-2", + "title": "Contingency Plan" + }, + { + "control_id": "cp-2.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "cp-2.3", + "title": "Resume Mission and Business Functions" + }, + { + "control_id": "cp-4.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "cp-6", + "title": "Alternate Storage Site" + }, + { + "control_id": "cp-6.1", + "title": "Separation from Primary Site" + }, + { + "control_id": "cp-6.3", + "title": "Accessibility" + }, + { + "control_id": "cp-7", + "title": "Alternate Processing Site" + }, + { + "control_id": "cp-7.1", + "title": "Separation from Primary Site" + }, + { + "control_id": "cp-7.2", + "title": "Accessibility" + }, + { + "control_id": "cp-7.3", + "title": "Priority of Service" + }, + { + "control_id": "cp-8", + "title": "Telecommunications Services" + }, + { + "control_id": "cp-8.1", + "title": "Priority of Service Provisions" + }, + { + "control_id": "cp-8.2", + "title": "Single Points of Failure" + }, + { + "control_id": "cp-10", + "title": "System Recovery and Reconstitution" + }, + { + "control_id": "cp-10.2", + "title": "Transaction Recovery" + } + ] + }, + { + "id": "KSI-RPL-RRO", + "name": "Reviewing Recovery Objectives", + "statement": "The desired Recovery Time Objectives (RTO) and Recovery Point Objectives (RPO) are defined and persistently reviewed for alignment with the provider's business needs and capabilities.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cp-2.3", + "title": "Resume Mission and Business Functions" + }, + { + "control_id": "cp-10", + "title": "System Recovery and Reconstitution" + } + ] + }, + { + "id": "KSI-RPL-TRC", + "name": "Testing Recovery Capabilities", + "statement": "The capability to recover from incidents and contingencies aligned with defined recovery objectives is persistently tested.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cp-2.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "cp-2.3", + "title": "Resume Mission and Business Functions" + }, + { + "control_id": "cp-4", + "title": "Contingency Plan Testing" + }, + { + "control_id": "cp-4.1", + "title": "Coordinate with Related Plans" + }, + { + "control_id": "cp-6", + "title": "Alternate Storage Site" + }, + { + "control_id": "cp-6.1", + "title": "Separation from Primary Site" + }, + { + "control_id": "cp-9.1", + "title": "Testing for Reliability and Integrity" + }, + { + "control_id": "cp-10", + "title": "System Recovery and Reconstitution" + }, + { + "control_id": "ir-3", + "title": "Incident Response Testing" + }, + { + "control_id": "ir-3.2", + "title": "Coordination with Related Plans" + } + ] + } + ] + }, + "SCR": { + "id": "KSI-SCR", + "name": "Supply Chain Risk", + "indicators": [ + { + "id": "KSI-SCR-MIT", + "name": "Mitigating Supply Chain Risk", + "statement": "Persistently identify, review, and mitigate potential supply chain risks.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-20", + "title": "Use of External Systems" + }, + { + "control_id": "ra-3.1", + "title": "Supply Chain Risk Assessment" + }, + { + "control_id": "sa-9", + "title": "External System Services" + }, + { + "control_id": "sa-10", + "title": "Developer Configuration Management" + }, + { + "control_id": "sa-11", + "title": "Developer Testing and Evaluation" + }, + { + "control_id": "sa-15.3", + "title": "Criticality Analysis" + }, + { + "control_id": "sa-22", + "title": "Unsupported System Components" + }, + { + "control_id": "si-7.1", + "title": "Integrity Checks" + }, + { + "control_id": "sr-5", + "title": "Acquisition Strategies, Tools, and Methods" + }, + { + "control_id": "sr-6", + "title": "Supplier Assessments and Reviews" + }, + { + "control_id": "ca-7.4", + "title": "Risk Monitoring" + }, + { + "control_id": "sc-18", + "title": "Mobile Code" + } + ] + }, + { + "id": "KSI-SCR-MON", + "name": "Monitoring Supply Chain Risk", + "statement": "Third party software information resources are automatically monitored for upstream vulnerabilities using mechanisms that may include contractual notification requirements or active monitoring services.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-20", + "title": "Use of External Systems" + }, + { + "control_id": "ca-3", + "title": "Information Exchange" + }, + { + "control_id": "ir-6.3", + "title": "Supply Chain Coordination" + }, + { + "control_id": "ps-7", + "title": "External Personnel Security" + }, + { + "control_id": "ra-5", + "title": "Vulnerability Monitoring and Scanning" + }, + { + "control_id": "sa-9", + "title": "External System Services" + }, + { + "control_id": "si-5", + "title": "Security Alerts, Advisories, and Directives" + }, + { + "control_id": "sr-5", + "title": "Acquisition Strategies, Tools, and Methods" + }, + { + "control_id": "sr-6", + "title": "Supplier Assessments and Reviews" + }, + { + "control_id": "sr-8", + "title": "Notification Agreements" + } + ] + } + ] + }, + "SVC": { + "id": "KSI-SVC", + "name": "Service Configuration", + "indicators": [ + { + "id": "KSI-SVC-ACM", + "name": "Automating Configuration Management", + "statement": "The configuration of machine-based information resources is managed using automation and persistently reviewed for drift.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-2.4", + "title": "Automated Audit Actions" + }, + { + "control_id": "cm-2", + "title": "Baseline Configuration" + }, + { + "control_id": "cm-2.2", + "title": "Automation Support for Accuracy and Currency" + }, + { + "control_id": "cm-2.3", + "title": "Retention of Previous Configurations" + }, + { + "control_id": "cm-6", + "title": "Configuration Settings" + }, + { + "control_id": "cm-7.1", + "title": "Periodic Review" + }, + { + "control_id": "pl-9", + "title": "Central Management" + }, + { + "control_id": "pl-10", + "title": "Baseline Selection" + }, + { + "control_id": "sa-5", + "title": "System Documentation" + }, + { + "control_id": "si-5", + "title": "Security Alerts, Advisories, and Directives" + }, + { + "control_id": "sr-10", + "title": "Inspection of Systems or Components" + } + ] + }, + { + "id": "KSI-SVC-ASM", + "name": "Automating Secret Management", + "statement": "Management, protection, and regular rotation of digital keys, certificates, and other secrets is automated and persistently reviewed.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-17.2", + "title": "Protection of Confidentiality and Integrity Using Encryption" + }, + { + "control_id": "ia-5.2", + "title": "Public Key-based Authentication" + }, + { + "control_id": "ia-5.6", + "title": "Protection of Authenticators" + }, + { + "control_id": "sc-12", + "title": "Cryptographic Key Establishment and Management" + }, + { + "control_id": "sc-17", + "title": "Public Key Infrastructure Certificates" + } + ] + }, + { + "id": "KSI-SVC-EIS", + "name": "Evaluating and Improving Security", + "statement": "Information resources are persistently evaluated for opportunities to improve security and those improvements are persistently made.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-7.1", + "title": "Periodic Review" + }, + { + "control_id": "cm-12.1", + "title": "Automated Tools to Support Information Location" + }, + { + "control_id": "ma-2", + "title": "Controlled Maintenance" + }, + { + "control_id": "pl-8", + "title": "Security and Privacy Architectures" + }, + { + "control_id": "sc-7", + "title": "Boundary Protection" + }, + { + "control_id": "sc-39", + "title": "Process Isolation" + }, + { + "control_id": "si-2.2", + "title": "Automated Flaw Remediation Status" + }, + { + "control_id": "si-4", + "title": "System Monitoring" + }, + { + "control_id": "sr-10", + "title": "Inspection of Systems or Components" + } + ] + }, + { + "id": "KSI-SVC-PRR", + "name": "Preventing Residual Risk", + "statement": "Plans, procedures, and the state of information resources are persistently reviewed after making changes to limit and remove unwanted residual elements that would likely negatively affect the confidentiality, integrity, or availability of federal customer data.", + "impact": { + "low": false, + "moderate": true + }, + "controls": [ + { + "control_id": "sc-4", + "title": "Information in Shared System Resources" + } + ] + }, + { + "id": "KSI-SVC-RUD", + "name": "Removing Unwanted Data", + "statement": "Unwanted federal customer data is removed promptly when requested by an agency in alignment with customer agreements, including from backups if appropriate; this typically applies when a customer spills information or when a customer seeks to remove information from a service due to a change in usage.", + "impact": { + "low": false, + "moderate": true + }, + "controls": [ + { + "control_id": "si-12.3", + "title": "Information Disposal" + }, + { + "control_id": "si-18.4", + "title": "Individual Requests" + } + ] + }, + { + "id": "KSI-SVC-SIN", + "name": "Securing Information", + "statement": "Information is encrypted or otherwise secured from unwanted access or modification.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "ac-1", + "title": "Policy and Procedures" + }, + { + "control_id": "ac-17.2", + "title": "Protection of Confidentiality and Integrity Using Encryption" + }, + { + "control_id": "cp-9.8", + "title": "Cryptographic Protection" + }, + { + "control_id": "sc-8", + "title": "Transmission Confidentiality and Integrity" + }, + { + "control_id": "sc-8.1", + "title": "Cryptographic Protection" + }, + { + "control_id": "sc-13", + "title": "Cryptographic Protection" + }, + { + "control_id": "sc-20", + "title": "Secure Name/Address Resolution Service (Authoritative Source)" + }, + { + "control_id": "sc-21", + "title": "Secure Name/Address Resolution Service (Recursive or Caching Resolver)" + }, + { + "control_id": "sc-22", + "title": "Architecture and Provisioning for Name/Address Resolution Service" + }, + { + "control_id": "sc-23", + "title": "Session Authenticity" + }, + { + "control_id": "sc-28", + "title": "Protection of Information at Rest" + }, + { + "control_id": "sc-28.1", + "title": "Cryptographic Protection" + } + ] + }, + { + "id": "KSI-SVC-VCM", + "name": "Validating Communications", + "statement": "The authenticity and integrity of communications between machine-based information resources is persistently validated using automation.", + "impact": { + "low": false, + "moderate": true + }, + "controls": [ + { + "control_id": "sc-23", + "title": "Session Authenticity" + }, + { + "control_id": "si-7.1", + "title": "Integrity Checks" + } + ] + }, + { + "id": "KSI-SVC-VRI", + "name": "Validating Resource Integrity", + "statement": "Use cryptographic methods to validate the integrity of machine-based information resources.", + "impact": { + "low": true, + "moderate": true + }, + "controls": [ + { + "control_id": "cm-2.2", + "title": "Automation Support for Accuracy and Currency" + }, + { + "control_id": "cm-8.3", + "title": "Automated Unauthorized Component Detection" + }, + { + "control_id": "sc-13", + "title": "Cryptographic Protection" + }, + { + "control_id": "sc-23", + "title": "Session Authenticity" + }, + { + "control_id": "si-7", + "title": "Software, Firmware, and Information Integrity" + }, + { + "control_id": "si-7.1", + "title": "Integrity Checks" + }, + { + "control_id": "sr-10", + "title": "Inspection of Systems or Components" + } + ] + } + ] + } + } +} diff --git a/tests/fixtures/scg/aws-bad.json b/tests/fixtures/scg/aws-bad.json new file mode 100644 index 00000000..cc048588 --- /dev/null +++ b/tests/fixtures/scg/aws-bad.json @@ -0,0 +1,227 @@ +{ + "$comment": "Known-bad: the root user has an access key and a collector user holds a write permission; neither is covered by a decision, so the comparison must fail the deploy.", + "responses": { + "iam get-account-summary": { + "SummaryMap": { + "AccountMFAEnabled": 1, + "AccountAccessKeysPresent": 1 + } + }, + "iam list-virtual-mfa-devices --assignment-status Assigned": { + "VirtualMFADevices": [ + { + "User": { + "Arn": "arn:aws:iam::123456789012:root" + } + }, + { + "User": { + "Arn": "arn:aws:iam::123456789012:user/op-user-not-for-publication" + } + } + ] + }, + "iam get-account-password-policy": { + "PasswordPolicy": { + "MinimumPasswordLength": 14, + "RequireSymbols": true, + "RequireNumbers": true, + "RequireUppercaseCharacters": true, + "RequireLowercaseCharacters": true, + "PasswordReusePrevention": 24, + "MaxPasswordAge": 90 + } + }, + "sts get-caller-identity": { + "Account": "123456789012" + }, + "s3control get-public-access-block --account-id 123456789012": { + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "IgnorePublicAcls": true, + "BlockPublicPolicy": true, + "RestrictPublicBuckets": true + } + }, + "iam list-users": { + "Users": [ + { + "UserName": "op-user-not-for-publication" + }, + { + "UserName": "collector" + }, + { + "UserName": "inert" + } + ] + }, + "iam list-groups-for-user --user-name op-user-not-for-publication": { + "Groups": [ + { + "GroupName": "operators" + } + ] + }, + "iam list-groups-for-user --user-name collector": { + "Groups": [ + { + "GroupName": "read-only" + } + ] + }, + "iam list-groups-for-user --user-name inert": { + "Groups": [] + }, + "iam get-login-profile --user-name collector": { + "error": "NoSuchEntity" + }, + "iam get-login-profile --user-name inert": { + "error": "NoSuchEntity" + }, + "iam get-login-profile --user-name op-user-not-for-publication": { + "error": "NoSuchEntity" + }, + "iam list-attached-user-policies --user-name collector": { + "AttachedPolicies": [ + { + "PolicyName": "SecurityAudit" + } + ] + }, + "iam list-user-policies --user-name collector": { + "PolicyNames": [ + "supplement" + ] + }, + "iam get-user-policy --user-name collector --policy-name supplement": { + "PolicyDocument": { + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "iam:PutUserPolicy" + ], + "Resource": "*" + } + ] + } + }, + "iam list-attached-group-policies --group-name read-only": { + "AttachedPolicies": [ + { + "PolicyName": "ReadOnlyAccess" + } + ] + }, + "iam list-group-policies --group-name read-only": { + "PolicyNames": [ + "deny-secrets" + ] + }, + "iam get-group-policy --group-name read-only --policy-name deny-secrets": { + "PolicyDocument": { + "Statement": [ + { + "Effect": "Deny", + "Action": [ + "secretsmanager:GetSecretValue", + "kms:Decrypt" + ], + "Resource": "*" + } + ] + } + }, + "iam list-attached-user-policies --user-name inert": { + "AttachedPolicies": [] + }, + "iam list-user-policies --user-name inert": { + "PolicyNames": [] + }, + "iam list-mfa-devices --user-name op-user-not-for-publication": { + "MFADevices": [ + { + "SerialNumber": "x" + } + ] + }, + "iam list-access-keys --user-name op-user-not-for-publication": { + "AccessKeyMetadata": [ + { + "Status": "Active", + "CreateDate": "2026-10-01T00:00:00Z" + }, + { + "Status": "Inactive", + "CreateDate": "2025-01-01T00:00:00Z" + } + ] + }, + "iam get-role --role-name github-actions-deploy-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringLike": { + "token.actions.githubusercontent.com:sub": "repo:sam-aydlette/samaydlette.com:environment:prod" + } + } + } + ] + } + } + }, + "iam get-role --role-name github-actions-plan-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringLike": { + "token.actions.githubusercontent.com:sub": [ + "repo:sam-aydlette/samaydlette.com:pull_request", + "repo:sam-aydlette/samaydlette.com:ref:refs/heads/main" + ] + } + } + } + ] + } + } + }, + "iam get-role --role-name github-actions-evidence-nightly-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringEquals": { + "token.actions.githubusercontent.com:sub": "repo:sam-aydlette/samaydlette.com:environment:evidence-nightly" + } + } + } + ] + } + } + }, + "cognito-idp describe-user-pool --region us-east-2 --user-pool-id pool-1": { + "UserPool": { + "MfaConfiguration": "ON", + "AdminCreateUserConfig": { + "AllowAdminCreateUserOnly": true + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": 14, + "RequireUppercase": true, + "RequireLowercase": true, + "RequireNumbers": true, + "RequireSymbols": true + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/fixtures/scg/aws-good.json b/tests/fixtures/scg/aws-good.json new file mode 100644 index 00000000..76f811e3 --- /dev/null +++ b/tests/fixtures/scg/aws-good.json @@ -0,0 +1,229 @@ +{ + "$comment": "Fake read-only AWS responses for tests/test_secure_configuration.py: every setting matches the guide, and root and operator MFA are virtual TOTP (the deviation DEC-150 accepts). Account number is AWS's documentation example.", + "responses": { + "iam get-account-summary": { + "SummaryMap": { + "AccountMFAEnabled": 1, + "AccountAccessKeysPresent": 0 + } + }, + "iam list-virtual-mfa-devices --assignment-status Assigned": { + "VirtualMFADevices": [ + { + "User": { + "Arn": "arn:aws:iam::123456789012:root" + } + }, + { + "User": { + "Arn": "arn:aws:iam::123456789012:user/op-user-not-for-publication" + } + } + ] + }, + "iam get-account-password-policy": { + "PasswordPolicy": { + "MinimumPasswordLength": 14, + "RequireSymbols": true, + "RequireNumbers": true, + "RequireUppercaseCharacters": true, + "RequireLowercaseCharacters": true, + "PasswordReusePrevention": 24, + "MaxPasswordAge": 90 + } + }, + "sts get-caller-identity": { + "Account": "123456789012" + }, + "s3control get-public-access-block --account-id 123456789012": { + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "IgnorePublicAcls": true, + "BlockPublicPolicy": true, + "RestrictPublicBuckets": true + } + }, + "iam list-users": { + "Users": [ + { + "UserName": "op-user-not-for-publication" + }, + { + "UserName": "collector" + }, + { + "UserName": "inert" + } + ] + }, + "iam list-groups-for-user --user-name op-user-not-for-publication": { + "Groups": [ + { + "GroupName": "operators" + } + ] + }, + "iam list-groups-for-user --user-name collector": { + "Groups": [ + { + "GroupName": "read-only" + } + ] + }, + "iam list-groups-for-user --user-name inert": { + "Groups": [] + }, + "iam get-login-profile --user-name collector": { + "error": "NoSuchEntity" + }, + "iam get-login-profile --user-name inert": { + "error": "NoSuchEntity" + }, + "iam get-login-profile --user-name op-user-not-for-publication": { + "error": "NoSuchEntity" + }, + "iam list-attached-user-policies --user-name collector": { + "AttachedPolicies": [ + { + "PolicyName": "SecurityAudit" + } + ] + }, + "iam list-user-policies --user-name collector": { + "PolicyNames": [ + "supplement" + ] + }, + "iam get-user-policy --user-name collector --policy-name supplement": { + "PolicyDocument": { + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "kms:List*", + "apigateway:GET", + "cognito-idp:Describe*" + ], + "Resource": "*" + } + ] + } + }, + "iam list-attached-group-policies --group-name read-only": { + "AttachedPolicies": [ + { + "PolicyName": "ReadOnlyAccess" + } + ] + }, + "iam list-group-policies --group-name read-only": { + "PolicyNames": [ + "deny-secrets" + ] + }, + "iam get-group-policy --group-name read-only --policy-name deny-secrets": { + "PolicyDocument": { + "Statement": [ + { + "Effect": "Deny", + "Action": [ + "secretsmanager:GetSecretValue", + "kms:Decrypt" + ], + "Resource": "*" + } + ] + } + }, + "iam list-attached-user-policies --user-name inert": { + "AttachedPolicies": [] + }, + "iam list-user-policies --user-name inert": { + "PolicyNames": [] + }, + "iam list-mfa-devices --user-name op-user-not-for-publication": { + "MFADevices": [ + { + "SerialNumber": "x" + } + ] + }, + "iam list-access-keys --user-name op-user-not-for-publication": { + "AccessKeyMetadata": [ + { + "Status": "Active", + "CreateDate": "2026-10-01T00:00:00Z" + }, + { + "Status": "Inactive", + "CreateDate": "2025-01-01T00:00:00Z" + } + ] + }, + "iam get-role --role-name github-actions-deploy-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringLike": { + "token.actions.githubusercontent.com:sub": "repo:sam-aydlette/samaydlette.com:environment:prod" + } + } + } + ] + } + } + }, + "iam get-role --role-name github-actions-plan-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringLike": { + "token.actions.githubusercontent.com:sub": [ + "repo:sam-aydlette/samaydlette.com:pull_request", + "repo:sam-aydlette/samaydlette.com:ref:refs/heads/main" + ] + } + } + } + ] + } + } + }, + "iam get-role --role-name github-actions-evidence-nightly-oidc": { + "Role": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Condition": { + "StringEquals": { + "token.actions.githubusercontent.com:sub": "repo:sam-aydlette/samaydlette.com:environment:evidence-nightly" + } + } + } + ] + } + } + }, + "cognito-idp describe-user-pool --region us-east-2 --user-pool-id pool-1": { + "UserPool": { + "MfaConfiguration": "ON", + "AdminCreateUserConfig": { + "AllowAdminCreateUserOnly": true + }, + "Policies": { + "PasswordPolicy": { + "MinimumLength": 14, + "RequireUppercase": true, + "RequireLowercase": true, + "RequireNumbers": true, + "RequireSymbols": true + } + } + } + } + } +} \ No newline at end of file diff --git a/tests/fixtures/scg/github-good.json b/tests/fixtures/scg/github-good.json new file mode 100644 index 00000000..0ee0cbb6 --- /dev/null +++ b/tests/fixtures/scg/github-good.json @@ -0,0 +1,23 @@ +{ + "schema": "manual-settings/1", + "checks": [ + { + "id": "github_settings", + "status": "ok", + "detail": "", + "facts": { + "prod_required_reviewers": 1, + "evidence_nightly_branches": [ + "main" + ], + "main_required_checks": [ + "OPA Compliance Check", + "Security Scan", + "Unit tests (pytest + opa test)", + "scn-tag" + ], + "main_checks_enforced_for": "everyone" + } + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/scg/retired-mechanism.json b/tests/fixtures/scg/retired-mechanism.json new file mode 100644 index 00000000..7ce0a0e8 --- /dev/null +++ b/tests/fixtures/scg/retired-mechanism.json @@ -0,0 +1,335 @@ +{ + "schema": "secure-configuration/1", + "$comment": "Known-bad: the guide describes a retired mechanism (the old shared app credential); scripts/build-scg.py must refuse it.", + "title": "Secure Configuration Guide: samaydlette.com", + "version": "2.0.0", + "obtain_and_use": [ + "Obtain: the guide is public. Human-readable: https://samaydlette.com/.well-known/secure-configuration-guide.md. Machine-readable: https://samaydlette.com/.well-known/secure-configuration-guide.json, signed (secure-configuration-guide.bundle; verify with cosign verify-blob against the deploy workflow's identity, as https://samaydlette.com/trust/ shows). No account or request is needed.", + "Use: each setting names the account that operates it, the recommended value, why it matters, and the API or CLI call that reads and changes it. Compare a system's live values with `recommended`; the operator's own comparison, run on every deploy, is published at https://samaydlette.com/.well-known/security-settings.json (current values, the result per setting, and the decision record that covers any accepted deviation).", + "Change: every setting here is changed only through a reviewed pull request (Terraform for AWS resources, the repository settings for GitHub), never by hand in a console, except the root and owner settings that AWS and GitHub expose only to those accounts, which the operator applies and the deploy then checks." + ], + "accounts": [ + { + "id": "aws-root", + "level": "top-level", + "name": "AWS root user", + "how_named": "The root user of the single AWS account that holds every production resource. It signs in with the account's email address, which is not published. AWS calls it the root user; this guide calls it aws-root.", + "access": "Console only, with MFA, from the operator's own device. No access keys. Used only for the tasks AWS reserves to the root user (account settings, closing the account, restoring IAM administrator access); day-to-day work never uses it.", + "configure": "The settings below under aws-root. AWS exposes the root user's own credentials (MFA device, access keys) only to the root user.", + "operate": "Sign in only for a root-only task, finish it, and sign out. CloudTrail records every root sign-in and action in the account's management trail.", + "decommission": "To retire the system: delete the deployed resources through Terraform, remove the root user's MFA device and any access keys, then close the account from the root user's account settings. Closing the account ends access for every IAM principal in it." + }, + { + "id": "github-owner", + "level": "top-level", + "name": "GitHub repository owner", + "how_named": "The operator's personal GitHub account, which owns the repository sam-aydlette/samaydlette.com and so holds every repository and Actions setting, the environments and their reviewers, and the secrets.", + "access": "github.com sign-in with two-factor authentication. Local git pushes go to branches, never to main; main changes only through pull requests that pass the required checks.", + "configure": "The settings below under github-owner, in the repository's Settings (Branches, Environments, Actions, Code security).", + "operate": "Review and merge pull requests; approve each production deploy in the prod environment. The deploy's checks re-read the environment and branch settings every run.", + "decommission": "Transfer the repository with GitHub's transfer flow, or archive it. Before either, remove the AWS OIDC trust (infrastructure/bootstrap) so no workflow can assume an AWS role afterwards." + }, + { + "id": "aws-operator-user", + "level": "privileged", + "name": "Operator IAM user", + "how_named": "The one IAM user that belongs to the IAM group `operators`. It is the operator's day-to-day administrative identity (bootstrap applies, read-only verification). Its user name is not published; this guide calls it aws-operator-user.", + "access": "Signs in with the Basic Auth credential.", + "configure": "Membership of the `operators` group gives its permissions; the settings below under aws-operator-user.", + "operate": "Used for the bootstrap stack (applied by hand) and read-only checks. Production changes to the main stack go through the reviewed deploy, never this user.", + "decommission": "Deactivate and delete its access keys, remove its MFA device and group membership, then delete the user." + }, + { + "id": "ci-roles", + "level": "privileged", + "name": "CI roles (deploy, plan, nightly)", + "how_named": "Three IAM roles that GitHub Actions assumes through OIDC: the deploy role (aws_iam_role.deploy), the plan role (aws_iam_role.plan) and the nightly evidence role (aws_iam_role.evidence_nightly), all in infrastructure/bootstrap. No long-lived credential exists for any of them.", + "access": "Only through GitHub's OIDC token, and only for the workflow subjects in each role's trust policy.", + "configure": "infrastructure/bootstrap (operator-applied, reviewed). The settings below under ci-roles.", + "operate": "The deploy role exists only inside an approved prod deploy; the plan role is read-only; the nightly role writes only .well-known/vdr-* objects.", + "decommission": "Delete the roles and the OIDC provider from infrastructure/bootstrap and apply." + }, + { + "id": "cognito-admin", + "level": "privileged", + "name": "Silk Reeling user-pool administration", + "how_named": "Administration of the Silk Reeling Cognito user pool (aws_cognito_user_pool.silk_reeling): creating users, and the pool's sign-in policy. Only the deploy role (through Terraform) and the operator user can administer it; app users cannot sign themselves up.", + "access": "Through Terraform in the reviewed deploy, or the operator user's CLI for creating an app user.", + "configure": "infrastructure/cognito.tf. The settings below under cognito-admin.", + "operate": "Create an app user with `aws cognito-idp admin-create-user`; the user sets a password meeting the policy and enrolls TOTP MFA at first sign-in.", + "decommission": "Delete the app users, then remove the pool from Terraform." + } + ], + "settings": [ + { + "id": "aws-root.mfa-enabled", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "MFA on the root user", + "recommended": true, + "implication": "Without MFA, the root user's password alone controls the whole account, including closing it.", + "read": "aws iam get-account-summary (SummaryMap.AccountMFAEnabled)", + "change": "Root user console: Security credentials, Assign MFA device.", + "check": "aws-root-mfa-enabled" + }, + { + "id": "aws-root.mfa-phishing-resistant", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "A TOTP code can be relayed by a phishing site in real time; a FIDO2 credential is bound to the AWS sign-in origin and cannot be.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (a root entry means virtual TOTP)", + "change": "Root user console: Security credentials, Assign MFA device, Passkey or security key; then remove the virtual device.", + "check": "aws-root-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-root.access-keys", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user access keys", + "recommended": 0, + "implication": "A root access key is an unrestricted, long-lived credential that no IAM policy can limit.", + "read": "aws iam get-account-summary (SummaryMap.AccountAccessKeysPresent)", + "change": "Root user console: Security credentials, Access keys, Delete.", + "check": "aws-root-access-keys" + }, + { + "id": "aws-account.password-policy", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account password policy for IAM users", + "recommended": { + "MinimumPasswordLength": { + "at_least": 14 + }, + "RequireSymbols": true, + "RequireNumbers": true, + "RequireUppercaseCharacters": true, + "RequireLowercaseCharacters": true, + "PasswordReusePrevention": { + "at_least": 24 + }, + "MaxPasswordAge": { + "at_most": 90 + } + }, + "implication": "Applies to any IAM user given a console password; weaker values make guessed or reused passwords work.", + "read": "aws iam get-account-password-policy", + "change": "aws iam update-account-password-policy", + "check": "aws-account-password-policy" + }, + { + "id": "aws-account.s3-block-public-access", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account-level S3 Block Public Access", + "recommended": { + "BlockPublicAcls": true, + "IgnorePublicAcls": true, + "BlockPublicPolicy": true, + "RestrictPublicBuckets": true + }, + "implication": "Stops any bucket in the account being made public by an ACL or bucket policy, whatever its own settings. The site is served through CloudFront's origin access control, never a public bucket.", + "read": "aws s3control get-public-access-block --account-id ", + "change": "aws s3control put-public-access-block --account-id --public-access-block-configuration ...", + "check": "aws-account-s3-bpa" + }, + { + "id": "aws-account.iam-users", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "IAM users other than the operator user hold no write permission and no console password", + "recommended": 0, + "implication": "Every other IAM user is a read-only collector (an AWS read-only or SecurityAudit policy) or has no permissions and no credentials. A second user with write access would be an unreviewed administrative path.", + "read": "aws iam list-users; for each: list-groups-for-user, list-attached-user-policies, list-user-policies, get-login-profile", + "change": "aws iam detach-user-policy / remove-user-from-group / delete-login-profile (operator user)", + "check": "aws-iam-users" + }, + { + "id": "github.prod-reviewer", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The prod environment requires a reviewer before a deploy", + "recommended": { + "at_least": 1 + }, + "implication": "Without a reviewer, a merged change would apply Terraform to production unattended.", + "read": "GET /repos/{owner}/{repo}/environments", + "change": "Repository Settings, Environments, prod, Required reviewers (or PUT /repos/{owner}/{repo}/environments/prod)", + "check": "github-prod-reviewer" + }, + { + "id": "github.nightly-main-only", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The evidence-nightly environment deploys only from main", + "recommended": [ + "main" + ], + "implication": "The nightly role writes published evidence unattended; another branch must not be able to use it.", + "read": "GET /repos/{owner}/{repo}/environments/evidence-nightly/deployment-branch-policies", + "change": "Repository Settings, Environments, evidence-nightly, Deployment branches", + "check": "github-nightly-branches" + }, + { + "id": "github.main-required-checks", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "main requires the four gate checks, for administrators too", + "recommended": { + "required": [ + "OPA Compliance Check", + "Security Scan", + "Unit tests (pytest + opa test)", + "scn-tag" + ], + "enforced_for": "everyone" + }, + "implication": "These checks are the policy, test, scanner and change-classification gates; without them a change could reach main unchecked.", + "read": "GET /repos/{owner}/{repo}/branches/main", + "change": "Repository Settings, Branches, main (or PUT /repos/{owner}/{repo}/branches/main/protection)", + "check": "github-main-checks" + }, + { + "id": "github.owner-2fa", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "Two-factor authentication on the owner account, no classic personal access tokens", + "recommended": true, + "implication": "The owner account can change every setting above and the workflows that hold AWS trust.", + "read": "Not readable by the deploy's token (GitHub exposes a user's 2FA and tokens only to that user); the operator attests it (DEC-151).", + "change": "github.com Settings, Password and authentication; Developer settings, Personal access tokens.", + "check": "attested", + "attested_by": "DEC-151" + }, + { + "id": "aws-operator-user.mfa-enabled", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "MFA on the operator user", + "recommended": true, + "implication": "The operator user can administer IAM; its access key alone must not be enough.", + "read": "aws iam list-mfa-devices --user-name ", + "change": "aws iam enable-mfa-device", + "check": "operator-mfa-enabled" + }, + { + "id": "aws-operator-user.mfa-phishing-resistant", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "Operator user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "As for the root user: a TOTP code can be relayed by a phishing site; a FIDO2 credential cannot.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (an entry for the user means virtual TOTP)", + "change": "IAM console: the user's Security credentials, Assign MFA device, Passkey or security key.", + "check": "operator-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-operator-user.console-password", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "No console password on the operator user", + "recommended": false, + "implication": "The operator works from the CLI; a console password would add a second sign-in path to protect.", + "read": "aws iam get-login-profile --user-name (NoSuchEntity means none)", + "change": "aws iam delete-login-profile", + "check": "operator-console-password" + }, + { + "id": "aws-operator-user.access-keys", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "At most one active access key, no older than 90 days", + "recommended": { + "active": { + "at_most": 1 + }, + "oldest_age_days": { + "at_most": 90 + } + }, + "implication": "A long-lived key is the operator user's standing credential; rotating it every 90 days bounds the life of a leaked key.", + "read": "aws iam list-access-keys --user-name ", + "change": "aws iam create-access-key, then update-access-key --status Inactive and delete-access-key for the old one", + "check": "operator-access-keys" + }, + { + "id": "ci-roles.deploy-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The deploy role trusts only this repository's prod environment", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:environment:prod" + ], + "implication": "The prod environment requires a reviewer, so deploy credentials exist only inside an approved deploy.", + "read": "aws iam get-role (AssumeRolePolicyDocument, token.actions.githubusercontent.com:sub)", + "change": "infrastructure/bootstrap/main.tf, data.aws_iam_policy_document.trust; operator-applied", + "check": "role-trust-deploy" + }, + { + "id": "ci-roles.plan-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The read-only plan role trusts only this repository's pull requests and main", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:pull_request", + "repo:sam-aydlette/samaydlette.com:ref:refs/heads/main" + ], + "implication": "Pull request runs get read-only credentials, never deploy permissions.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/plan-role.tf; operator-applied", + "check": "role-trust-plan" + }, + { + "id": "ci-roles.nightly-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The nightly role trusts only this repository's evidence-nightly environment", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:environment:evidence-nightly" + ], + "implication": "The unattended write path stays limited to the one environment that deploys only from main.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/evidence-nightly.tf; operator-applied", + "check": "role-trust-nightly" + }, + { + "id": "cognito-admin.sign-in-policy", + "account": "cognito-admin", + "operable_by": "ci-roles (Terraform) and aws-operator-user", + "setting": "Silk Reeling user pool: MFA required, admin-created users only, 14-character passwords with every character class", + "recommended": { + "MfaConfiguration": "ON", + "AllowAdminCreateUserOnly": true, + "MinimumLength": { + "at_least": 14 + }, + "RequireUppercase": true, + "RequireLowercase": true, + "RequireNumbers": true, + "RequireSymbols": true + }, + "implication": "App users cannot sign themselves up, and every app user signs in with a strong password and TOTP MFA.", + "read": "aws cognito-idp describe-user-pool --user-pool-id ", + "change": "infrastructure/cognito.tf (reviewed deploy)", + "check": "cognito-pool-policy" + } + ], + "changelog": [ + { + "version": "2.0.0", + "date": "2026-11-05", + "changes": [ + "First machine-readable release, replacing the prose guide in docs/policies.", + "Root and operator MFA stated as it is: virtual TOTP, an accepted deviation from the phishing-resistant default (DEC-150).", + "Deployer access-key rotation removed: CI uses OIDC roles and has no access key.", + "The retired Silk Reeling shared credential removed: app users sign in through Cognito with MFA.", + "Added the account-level settings, the operator user, the CI roles and the user-pool administration, each with the call that reads and changes it." + ], + "defaults_sha256": "a21ebfa28dc9e0b8b12a2f0029e163d782d92848c422b85702bec6de65352727" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/scg/signal-mapped.json b/tests/fixtures/scg/signal-mapped.json new file mode 100644 index 00000000..e3708b1c --- /dev/null +++ b/tests/fixtures/scg/signal-mapped.json @@ -0,0 +1,29 @@ +{ + "signal_id": "fixture", + "components": [ + { + "component_id": "x::kms_key", + "type": "kms_key" + }, + { + "component_id": "x::function", + "type": "function" + }, + { + "component_id": "x::object_store", + "type": "object_store" + }, + { + "component_id": "x::npm_package", + "type": "npm_package" + }, + { + "component_id": "x::cdn_distribution", + "type": "cdn_distribution" + }, + { + "component_id": "x::external_service", + "type": "external_service" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/scg/signal-unmapped-type.json b/tests/fixtures/scg/signal-unmapped-type.json new file mode 100644 index 00000000..150db442 --- /dev/null +++ b/tests/fixtures/scg/signal-unmapped-type.json @@ -0,0 +1,14 @@ +{ + "$comment": "Known-bad: an inventory with a component type no cryptographic module mapping covers (CMU-CSO-CMD).", + "signal_id": "fixture", + "components": [ + { + "component_id": "aws::kms_key::k", + "type": "kms_key" + }, + { + "component_id": "aws::vector_db::v", + "type": "vector_database" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/scg/unreleased-default.json b/tests/fixtures/scg/unreleased-default.json new file mode 100644 index 00000000..53a6e4a2 --- /dev/null +++ b/tests/fixtures/scg/unreleased-default.json @@ -0,0 +1,335 @@ +{ + "schema": "secure-configuration/1", + "$comment": "Known-bad: a recommended default (MaxPasswordAge) weakened without a new version or changelog entry; scripts/build-scg.py must refuse it (SCG-ENH-VRH).", + "title": "Secure Configuration Guide: samaydlette.com", + "version": "2.0.0", + "obtain_and_use": [ + "Obtain: the guide is public. Human-readable: https://samaydlette.com/.well-known/secure-configuration-guide.md. Machine-readable: https://samaydlette.com/.well-known/secure-configuration-guide.json, signed (secure-configuration-guide.bundle; verify with cosign verify-blob against the deploy workflow's identity, as https://samaydlette.com/trust/ shows). No account or request is needed.", + "Use: each setting names the account that operates it, the recommended value, why it matters, and the API or CLI call that reads and changes it. Compare a system's live values with `recommended`; the operator's own comparison, run on every deploy, is published at https://samaydlette.com/.well-known/security-settings.json (current values, the result per setting, and the decision record that covers any accepted deviation).", + "Change: every setting here is changed only through a reviewed pull request (Terraform for AWS resources, the repository settings for GitHub), never by hand in a console, except the root and owner settings that AWS and GitHub expose only to those accounts, which the operator applies and the deploy then checks." + ], + "accounts": [ + { + "id": "aws-root", + "level": "top-level", + "name": "AWS root user", + "how_named": "The root user of the single AWS account that holds every production resource. It signs in with the account's email address, which is not published. AWS calls it the root user; this guide calls it aws-root.", + "access": "Console only, with MFA, from the operator's own device. No access keys. Used only for the tasks AWS reserves to the root user (account settings, closing the account, restoring IAM administrator access); day-to-day work never uses it.", + "configure": "The settings below under aws-root. AWS exposes the root user's own credentials (MFA device, access keys) only to the root user.", + "operate": "Sign in only for a root-only task, finish it, and sign out. CloudTrail records every root sign-in and action in the account's management trail.", + "decommission": "To retire the system: delete the deployed resources through Terraform, remove the root user's MFA device and any access keys, then close the account from the root user's account settings. Closing the account ends access for every IAM principal in it." + }, + { + "id": "github-owner", + "level": "top-level", + "name": "GitHub repository owner", + "how_named": "The operator's personal GitHub account, which owns the repository sam-aydlette/samaydlette.com and so holds every repository and Actions setting, the environments and their reviewers, and the secrets.", + "access": "github.com sign-in with two-factor authentication. Local git pushes go to branches, never to main; main changes only through pull requests that pass the required checks.", + "configure": "The settings below under github-owner, in the repository's Settings (Branches, Environments, Actions, Code security).", + "operate": "Review and merge pull requests; approve each production deploy in the prod environment. The deploy's checks re-read the environment and branch settings every run.", + "decommission": "Transfer the repository with GitHub's transfer flow, or archive it. Before either, remove the AWS OIDC trust (infrastructure/bootstrap) so no workflow can assume an AWS role afterwards." + }, + { + "id": "aws-operator-user", + "level": "privileged", + "name": "Operator IAM user", + "how_named": "The one IAM user that belongs to the IAM group `operators`. It is the operator's day-to-day administrative identity (bootstrap applies, read-only verification). Its user name is not published; this guide calls it aws-operator-user.", + "access": "AWS CLI with an access key; the user also has an MFA device, and no console password.", + "configure": "Membership of the `operators` group gives its permissions; the settings below under aws-operator-user.", + "operate": "Used for the bootstrap stack (applied by hand) and read-only checks. Production changes to the main stack go through the reviewed deploy, never this user.", + "decommission": "Deactivate and delete its access keys, remove its MFA device and group membership, then delete the user." + }, + { + "id": "ci-roles", + "level": "privileged", + "name": "CI roles (deploy, plan, nightly)", + "how_named": "Three IAM roles that GitHub Actions assumes through OIDC: the deploy role (aws_iam_role.deploy), the plan role (aws_iam_role.plan) and the nightly evidence role (aws_iam_role.evidence_nightly), all in infrastructure/bootstrap. No long-lived credential exists for any of them.", + "access": "Only through GitHub's OIDC token, and only for the workflow subjects in each role's trust policy.", + "configure": "infrastructure/bootstrap (operator-applied, reviewed). The settings below under ci-roles.", + "operate": "The deploy role exists only inside an approved prod deploy; the plan role is read-only; the nightly role writes only .well-known/vdr-* objects.", + "decommission": "Delete the roles and the OIDC provider from infrastructure/bootstrap and apply." + }, + { + "id": "cognito-admin", + "level": "privileged", + "name": "Silk Reeling user-pool administration", + "how_named": "Administration of the Silk Reeling Cognito user pool (aws_cognito_user_pool.silk_reeling): creating users, and the pool's sign-in policy. Only the deploy role (through Terraform) and the operator user can administer it; app users cannot sign themselves up.", + "access": "Through Terraform in the reviewed deploy, or the operator user's CLI for creating an app user.", + "configure": "infrastructure/cognito.tf. The settings below under cognito-admin.", + "operate": "Create an app user with `aws cognito-idp admin-create-user`; the user sets a password meeting the policy and enrolls TOTP MFA at first sign-in.", + "decommission": "Delete the app users, then remove the pool from Terraform." + } + ], + "settings": [ + { + "id": "aws-root.mfa-enabled", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "MFA on the root user", + "recommended": true, + "implication": "Without MFA, the root user's password alone controls the whole account, including closing it.", + "read": "aws iam get-account-summary (SummaryMap.AccountMFAEnabled)", + "change": "Root user console: Security credentials, Assign MFA device.", + "check": "aws-root-mfa-enabled" + }, + { + "id": "aws-root.mfa-phishing-resistant", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "A TOTP code can be relayed by a phishing site in real time; a FIDO2 credential is bound to the AWS sign-in origin and cannot be.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (a root entry means virtual TOTP)", + "change": "Root user console: Security credentials, Assign MFA device, Passkey or security key; then remove the virtual device.", + "check": "aws-root-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-root.access-keys", + "account": "aws-root", + "operable_by": "aws-root only", + "setting": "Root user access keys", + "recommended": 0, + "implication": "A root access key is an unrestricted, long-lived credential that no IAM policy can limit.", + "read": "aws iam get-account-summary (SummaryMap.AccountAccessKeysPresent)", + "change": "Root user console: Security credentials, Access keys, Delete.", + "check": "aws-root-access-keys" + }, + { + "id": "aws-account.password-policy", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account password policy for IAM users", + "recommended": { + "MinimumPasswordLength": { + "at_least": 14 + }, + "RequireSymbols": true, + "RequireNumbers": true, + "RequireUppercaseCharacters": true, + "RequireLowercaseCharacters": true, + "PasswordReusePrevention": { + "at_least": 24 + }, + "MaxPasswordAge": { + "at_most": 365 + } + }, + "implication": "Applies to any IAM user given a console password; weaker values make guessed or reused passwords work.", + "read": "aws iam get-account-password-policy", + "change": "aws iam update-account-password-policy", + "check": "aws-account-password-policy" + }, + { + "id": "aws-account.s3-block-public-access", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "Account-level S3 Block Public Access", + "recommended": { + "BlockPublicAcls": true, + "IgnorePublicAcls": true, + "BlockPublicPolicy": true, + "RestrictPublicBuckets": true + }, + "implication": "Stops any bucket in the account being made public by an ACL or bucket policy, whatever its own settings. The site is served through CloudFront's origin access control, never a public bucket.", + "read": "aws s3control get-public-access-block --account-id ", + "change": "aws s3control put-public-access-block --account-id --public-access-block-configuration ...", + "check": "aws-account-s3-bpa" + }, + { + "id": "aws-account.iam-users", + "account": "aws-root", + "operable_by": "aws-root and aws-operator-user", + "setting": "IAM users other than the operator user hold no write permission and no console password", + "recommended": 0, + "implication": "Every other IAM user is a read-only collector (an AWS read-only or SecurityAudit policy) or has no permissions and no credentials. A second user with write access would be an unreviewed administrative path.", + "read": "aws iam list-users; for each: list-groups-for-user, list-attached-user-policies, list-user-policies, get-login-profile", + "change": "aws iam detach-user-policy / remove-user-from-group / delete-login-profile (operator user)", + "check": "aws-iam-users" + }, + { + "id": "github.prod-reviewer", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The prod environment requires a reviewer before a deploy", + "recommended": { + "at_least": 1 + }, + "implication": "Without a reviewer, a merged change would apply Terraform to production unattended.", + "read": "GET /repos/{owner}/{repo}/environments", + "change": "Repository Settings, Environments, prod, Required reviewers (or PUT /repos/{owner}/{repo}/environments/prod)", + "check": "github-prod-reviewer" + }, + { + "id": "github.nightly-main-only", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "The evidence-nightly environment deploys only from main", + "recommended": [ + "main" + ], + "implication": "The nightly role writes published evidence unattended; another branch must not be able to use it.", + "read": "GET /repos/{owner}/{repo}/environments/evidence-nightly/deployment-branch-policies", + "change": "Repository Settings, Environments, evidence-nightly, Deployment branches", + "check": "github-nightly-branches" + }, + { + "id": "github.main-required-checks", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "main requires the four gate checks, for administrators too", + "recommended": { + "required": [ + "OPA Compliance Check", + "Security Scan", + "Unit tests (pytest + opa test)", + "scn-tag" + ], + "enforced_for": "everyone" + }, + "implication": "These checks are the policy, test, scanner and change-classification gates; without them a change could reach main unchecked.", + "read": "GET /repos/{owner}/{repo}/branches/main", + "change": "Repository Settings, Branches, main (or PUT /repos/{owner}/{repo}/branches/main/protection)", + "check": "github-main-checks" + }, + { + "id": "github.owner-2fa", + "account": "github-owner", + "operable_by": "github-owner only", + "setting": "Two-factor authentication on the owner account, no classic personal access tokens", + "recommended": true, + "implication": "The owner account can change every setting above and the workflows that hold AWS trust.", + "read": "Not readable by the deploy's token (GitHub exposes a user's 2FA and tokens only to that user); the operator attests it (DEC-151).", + "change": "github.com Settings, Password and authentication; Developer settings, Personal access tokens.", + "check": "attested", + "attested_by": "DEC-151" + }, + { + "id": "aws-operator-user.mfa-enabled", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "MFA on the operator user", + "recommended": true, + "implication": "The operator user can administer IAM; its access key alone must not be enough.", + "read": "aws iam list-mfa-devices --user-name ", + "change": "aws iam enable-mfa-device", + "check": "operator-mfa-enabled" + }, + { + "id": "aws-operator-user.mfa-phishing-resistant", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "Operator user MFA is phishing-resistant (FIDO2 security key or passkey)", + "recommended": true, + "implication": "As for the root user: a TOTP code can be relayed by a phishing site; a FIDO2 credential cannot.", + "read": "aws iam list-virtual-mfa-devices --assignment-status Assigned (an entry for the user means virtual TOTP)", + "change": "IAM console: the user's Security credentials, Assign MFA device, Passkey or security key.", + "check": "operator-mfa-type", + "accepted_deviation": "DEC-150" + }, + { + "id": "aws-operator-user.console-password", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "No console password on the operator user", + "recommended": false, + "implication": "The operator works from the CLI; a console password would add a second sign-in path to protect.", + "read": "aws iam get-login-profile --user-name (NoSuchEntity means none)", + "change": "aws iam delete-login-profile", + "check": "operator-console-password" + }, + { + "id": "aws-operator-user.access-keys", + "account": "aws-operator-user", + "operable_by": "aws-operator-user and aws-root", + "setting": "At most one active access key, no older than 90 days", + "recommended": { + "active": { + "at_most": 1 + }, + "oldest_age_days": { + "at_most": 90 + } + }, + "implication": "A long-lived key is the operator user's standing credential; rotating it every 90 days bounds the life of a leaked key.", + "read": "aws iam list-access-keys --user-name ", + "change": "aws iam create-access-key, then update-access-key --status Inactive and delete-access-key for the old one", + "check": "operator-access-keys" + }, + { + "id": "ci-roles.deploy-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The deploy role trusts only this repository's prod environment", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:environment:prod" + ], + "implication": "The prod environment requires a reviewer, so deploy credentials exist only inside an approved deploy.", + "read": "aws iam get-role (AssumeRolePolicyDocument, token.actions.githubusercontent.com:sub)", + "change": "infrastructure/bootstrap/main.tf, data.aws_iam_policy_document.trust; operator-applied", + "check": "role-trust-deploy" + }, + { + "id": "ci-roles.plan-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The read-only plan role trusts only this repository's pull requests and main", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:pull_request", + "repo:sam-aydlette/samaydlette.com:ref:refs/heads/main" + ], + "implication": "Pull request runs get read-only credentials, never deploy permissions.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/plan-role.tf; operator-applied", + "check": "role-trust-plan" + }, + { + "id": "ci-roles.nightly-trust", + "account": "ci-roles", + "operable_by": "aws-operator-user (bootstrap apply)", + "setting": "The nightly role trusts only this repository's evidence-nightly environment", + "recommended": [ + "repo:sam-aydlette/samaydlette.com:environment:evidence-nightly" + ], + "implication": "The unattended write path stays limited to the one environment that deploys only from main.", + "read": "aws iam get-role (AssumeRolePolicyDocument)", + "change": "infrastructure/bootstrap/evidence-nightly.tf; operator-applied", + "check": "role-trust-nightly" + }, + { + "id": "cognito-admin.sign-in-policy", + "account": "cognito-admin", + "operable_by": "ci-roles (Terraform) and aws-operator-user", + "setting": "Silk Reeling user pool: MFA required, admin-created users only, 14-character passwords with every character class", + "recommended": { + "MfaConfiguration": "ON", + "AllowAdminCreateUserOnly": true, + "MinimumLength": { + "at_least": 14 + }, + "RequireUppercase": true, + "RequireLowercase": true, + "RequireNumbers": true, + "RequireSymbols": true + }, + "implication": "App users cannot sign themselves up, and every app user signs in with a strong password and TOTP MFA.", + "read": "aws cognito-idp describe-user-pool --user-pool-id ", + "change": "infrastructure/cognito.tf (reviewed deploy)", + "check": "cognito-pool-policy" + } + ], + "changelog": [ + { + "version": "2.0.0", + "date": "2026-11-05", + "changes": [ + "First machine-readable release, replacing the prose guide in docs/policies.", + "Root and operator MFA stated as it is: virtual TOTP, an accepted deviation from the phishing-resistant default (DEC-150).", + "Deployer access-key rotation removed: CI uses OIDC roles and has no access key.", + "The retired Silk Reeling shared credential removed: app users sign in through Cognito with MFA.", + "Added the account-level settings, the operator user, the CI roles and the user-pool administration, each with the call that reads and changes it." + ], + "defaults_sha256": "a21ebfa28dc9e0b8b12a2f0029e163d782d92848c422b85702bec6de65352727" + } + ] +} \ No newline at end of file diff --git a/tests/fixtures/third-party/decided-without-tpr-fields.json b/tests/fixtures/third-party/decided-without-tpr-fields.json new file mode 100644 index 00000000..52e276b3 --- /dev/null +++ b/tests/fixtures/third-party/decided-without-tpr-fields.json @@ -0,0 +1,19 @@ +{ + "_note": "Known-bad (MAS-CSO-TPR): a decided record without the four fields FedRAMP requires.", + "components": { + "ext::cisa-kev": { + "upstream_offering": "CISA Known Exploited Vulnerabilities catalog (JSON feed)", + "upstream_component_id": "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json", + "responsibility_split": { + "upstream_runs": "the catalog and its feed", + "provider_configures": "the fetch and its failure handling" + }, + "evidence": [ + "test fixture" + ], + "decided_by": "Operator", + "decided_on": "2026-11-03", + "usage_and_configuration": "fixture usage" + } + } +} diff --git a/tests/fixtures/third-party/decided.json b/tests/fixtures/third-party/decided.json index 73739eef..7e3162da 100644 --- a/tests/fixtures/third-party/decided.json +++ b/tests/fixtures/third-party/decided.json @@ -1,8 +1,22 @@ -{"_note": "test fixture", "components": { +{ + "_note": "test fixture", + "components": { "ext::cisa-kev": { - "upstream_offering": "CISA Known Exploited Vulnerabilities catalog (JSON feed)", - "upstream_component_id": "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json", - "responsibility_split": {"upstream_runs": "the catalog and its feed", "provider_configures": "the fetch and its failure handling"}, - "evidence": ["test fixture"], - "decided_by": "Operator", "decided_on": "2026-11-03"} -}} + "upstream_offering": "CISA Known Exploited Vulnerabilities catalog (JSON feed)", + "upstream_component_id": "https://www.cisa.gov/sites/default/files/feeds/known_exploited_vulnerabilities.json", + "responsibility_split": { + "upstream_runs": "the catalog and its feed", + "provider_configures": "the fetch and its failure handling" + }, + "evidence": [ + "test fixture" + ], + "decided_by": "Operator", + "decided_on": "2026-11-03", + "usage_and_configuration": "fixture usage", + "justification": "fixture justification", + "mitigations": "fixture mitigations", + "compensating_controls": "fixture compensating controls" + } + } +} diff --git a/tests/fixtures/wellknown-headers/known-bad.json b/tests/fixtures/wellknown-headers/known-bad.json new file mode 100644 index 00000000..f5e93822 --- /dev/null +++ b/tests/fixtures/wellknown-headers/known-bad.json @@ -0,0 +1,4 @@ +{ + "ksi-signal.json": {"Content-Type": "application/json", "X-Content-Type-Options": "nosniff"}, + "security-decision-record.json": {"Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "X-Content-Type-Options": "nosniff"} +} diff --git a/tests/fixtures/wellknown-headers/known-good.json b/tests/fixtures/wellknown-headers/known-good.json new file mode 100644 index 00000000..19a9e4f3 --- /dev/null +++ b/tests/fixtures/wellknown-headers/known-good.json @@ -0,0 +1,4 @@ +{ + "ksi-signal.json": {"content-type": "application/json", "access-control-allow-origin": "*", "x-content-type-options": "nosniff"}, + "ksi-signal.schema.json": {"Content-Type": "application/schema+json", "Access-Control-Allow-Origin": "*", "X-Content-Type-Options": "nosniff"} +} diff --git a/tests/test_agency_access.py b/tests/test_agency_access.py new file mode 100644 index 00000000..a564b1f8 --- /dev/null +++ b/tests/test_agency_access.py @@ -0,0 +1,100 @@ +"""Agency access: inventory and history (CDS-TRC-AAI), self-service request and +withdrawal (CDS-TRC-SSM), access on request (CDS-UTC-AGA), and the +five-business-day denial notice to FedRAMP (CDS-UTC-AAD), exercised with +plainly fictional agencies.""" +import copy +import importlib.util +import json +from datetime import date +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +FIX = REPO / "tests" / "fixtures" / "agency-access" +spec = importlib.util.spec_from_file_location("agency_access", REPO / "scripts" / "agency-access.py") +aa = importlib.util.module_from_spec(spec) +spec.loader.exec_module(aa) + + +@pytest.mark.parametrize("start,n,expected", [ + (date(2026, 11, 25), 5, date(2026, 12, 3)), # Thanksgiving (Thu 26 Nov) is skipped + (date(2026, 12, 23), 5, date(2026, 12, 31)), # Christmas (Fri 25 Dec) + (date(2027, 7, 1), 2, date(2027, 7, 6)), # 4 July 2027 is a Sunday, observed Monday 5 July + (date(2026, 11, 6), 1, date(2026, 11, 9)), # Friday to Monday +]) +def test_business_days_skip_weekends_and_federal_holidays(start, n, expected): + assert aa.add_business_days(start, n) == expected + + +def test_known_bad_an_unnotified_denial_past_five_business_days_fails(): + doc = aa.load(FIX / "overdue-denial.json") + assert aa.process(doc, date(2026, 11, 9))["problems"] == [] # last day of the window + assert aa.process(doc, date(2026, 11, 10))["problems"] == [ + "AAR-B01: FedRAMP denial notice overdue (deadline 2026-11-09)"] + with pytest.raises(SystemExit): + aa.main(["validate", "--register", str(FIX / "overdue-denial.json"), "--today", "2026-11-10"]) + + +def test_known_bad_the_register_never_names_a_person(): + with pytest.raises(SystemExit, match="not people"): + aa.load(FIX / "person-in-register.json") + + +def test_inventory_and_history_follow_grants_and_withdrawals(): + doc = aa.validate({"schema": "agency-access/1", "requests": [ + {"id": "AAR-T1", "agency": "A (simulated)", "system": "S1", "kind": "access", "channel": "form", + "received_on": "2026-11-02", "decision": "granted", "decided_on": "2026-11-03", "decided_by": "Operator"}, + {"id": "AAR-T2", "agency": "A (simulated)", "kind": "withdrawal", "channel": "form", + "received_on": "2026-11-04", "withdraws": "AAR-T1"}]}, "t") + r = aa.process(doc, date(2026, 11, 5)) + assert r["inventory"] == [] + assert [h["event"] for h in r["history"]] == ["access received", "granted", "access withdrawn", + "withdrawal received"] + + +@pytest.mark.parametrize("bad", [ + {"decision": "denied"}, # a denial with no reason or date + {"decision": "granted", "decided_on": "2026-11-01"}, # decided before received + {"fedramp_notified_on": "2026-11-03"}, # notice with no denial +]) +def test_invalid_records_fail(bad): + rec = {"id": "AAR-T1", "agency": "A (simulated)", "kind": "access", "channel": "form", + "received_on": "2026-11-02", "decided_by": "Operator", **bad} + with pytest.raises(SystemExit): + aa.validate({"schema": "agency-access/1", "requests": [rec]}, "t") + + +@pytest.mark.parametrize("today", ["2026-11-05", "2026-11-27", "2026-12-28", "2027-01-04", "2027-07-06"]) +def test_the_exercise_observes_every_expected_outcome_on_any_day(today): + scenario = json.loads(aa.SCENARIO.read_text()) + _, _, mismatches = aa.exercise(scenario, date.fromisoformat(today)) + assert mismatches == [] + + +def test_the_exercise_fails_when_an_outcome_is_not_the_expected_one(): + scenario = copy.deepcopy(json.loads(aa.SCENARIO.read_text())) + scenario["expected"]["AAR-X07"] = "denial notice on time" # the clock must catch it + _, _, mismatches = aa.exercise(scenario, date(2026, 11, 5)) + assert mismatches == ["AAR-X07: expected 'denial notice on time', observed 'denial notice overdue'"] + + +def test_the_exercise_agencies_are_obviously_fictional(): + scenario = json.loads(aa.SCENARIO.read_text()) + assert all(r["agency"].endswith("(simulated)") for r in scenario["requests"]) + assert "SIMULATED" in scenario["disclaimer"] and "nothing is sent" in scenario["disclaimer"] + + +def test_the_committed_register_is_valid_and_has_nothing_overdue(): + doc = aa.load(aa.REGISTER) + assert aa.process(doc, date(2026, 11, 5))["problems"] == [] + + +def test_the_exercise_writes_a_log_that_says_it_is_simulated(tmp_path): + out, md = tmp_path / "log.json", tmp_path / "log.md" + assert aa.main(["exercise", "--output", str(out), "--md-output", str(md), "--today", "2026-11-05"]) == 0 + log = json.loads(out.read_text()) + assert log["simulated"] is True and log["counterparty"] == "agency" + assert {n["state"] for n in log["denial_notices"]} == {"on time", "pending", "late", "overdue"} + assert all("nothing is sent" in n["to"] for n in log["denial_notices"]) + assert "Agency access exercise (simulated)" in md.read_text() diff --git a/tests/test_assessor_guide.py b/tests/test_assessor_guide.py new file mode 100644 index 00000000..9ca10f69 --- /dev/null +++ b/tests/test_assessor_guide.py @@ -0,0 +1,75 @@ +"""The assessor guide (IVV-CSO-STE) and the sampling statement (IVV-CSO-DUS): +every rule and KSI, every piece of evidence with a command to reproduce it and +the same check in machine form, generated from the rule records.""" +import importlib.util +import json +import sys +from datetime import datetime, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(REPO / "scripts")) +import _freshness # noqa: E402 +import _frr # noqa: E402 +import _rules # noqa: E402 + +spec = importlib.util.spec_from_file_location("assessor_guide", REPO / "scripts" / "build-assessor-guide.py") +ag = importlib.util.module_from_spec(spec) +spec.loader.exec_module(ag) + +FRESH = {x["path"]: x for x in _freshness.load_freshness_config( + REPO / "infrastructure" / "schemas" / "freshness-config.json")["artifacts"]} +CATALOG = json.loads((REPO / "infrastructure" / "schemas" / "ksi-catalog.json").read_text()) +NOW = datetime(2026, 11, 5, tzinfo=timezone.utc) + + +def _guide(): + return ag.build(_frr.load(_frr.DEFAULT_PATH), _rules.applicable_provider_rules(), CATALOG, FRESH, NOW, "abc") + + +def test_every_rule_and_ksi_is_in_the_guide_with_a_reproducible_check(): + g = _guide() + assert {r["rule_id"] for r in g["rules"]} == set(_rules.applicable_provider_rules()) + ksis = {i["id"] for f in CATALOG["KSI"].values() for i in f["indicators"]} + assert {k["ksi_id"] for k in g["ksis"]} == ksis + for r in g["rules"]: + assert r["statement"] and r["explanation"] + for ev in r["evidence"]: + assert ev["how_to_reproduce"] and set(ev["check"]) in ({"pytest"}, {"workflow", "step"}, {"artifact"}, {"decision"}) + + +def test_signed_artifacts_name_the_identity_that_signed_them(): + g = _guide() + checks = [ev["check"]["artifact"] for r in g["rules"] for ev in r["evidence"] if ev["kind"] == "artifact"] + assert checks + for c in checks: + assert c["url"].startswith("https://samaydlette.com/.well-known/") + assert all(i in g["identities"] for i in c["identities"]) + sim = ag._artifact_check(".well-known/simulated-assessment.json", FRESH) + assert sim["identities"] == ["assessor"] and sim["bundle_url"] + + +def test_the_guide_states_that_no_samples_are_used(): + g = _guide() + assert "No representative samples" in g["sampling"] + assert "## Sampling (IVV-CSO-DUS)" in ag.render_markdown(g) + + +def test_known_bad_unknown_evidence_kind_fails(): + records = json.loads((REPO / "tests" / "fixtures" / "assessor-guide" / "unknown-evidence-kind.json").read_text()) + with pytest.raises(SystemExit, match="unknown evidence kind"): + ag.build(records, _rules.applicable_provider_rules(), CATALOG, FRESH, NOW) + + +def test_an_artifact_outside_the_freshness_config_fails_closed(): + with pytest.raises(SystemExit, match="not in the freshness config"): + ag.reproduce({"kind": "artifact", "ref": ".well-known/not-governed.json"}, FRESH) + + +def test_the_deploy_builds_the_guide_and_the_assessor_follows_it(): + deploy = (REPO / ".github" / "workflows" / "deploy-with-opa.yml").read_text() + assessor = (REPO / ".github" / "workflows" / "simulated-assessor.yml").read_text() + assert "- name: Build the assessor guide" in deploy + assert "build-assessor-guide.py" in assessor and "assess.py --guide assessor-guide.json" in assessor diff --git a/tests/test_assessor_records.py b/tests/test_assessor_records.py index 894b6bca..dc0a816e 100644 --- a/tests/test_assessor_records.py +++ b/tests/test_assessor_records.py @@ -153,11 +153,25 @@ def test_t74_output_dropping_a_signed_record_fails(tmp_path): def test_sdr_markdown_states_no_assessor_record(): - sdr = {"note": "n", "class": "C", "impact_level": "low", "ksi_signal_id": "s", - "metadata": {"version": "v", "last_updated": "t", "source_of_update": "s"}, - "metrics": {"current": {"ksi_in_scope": 0, "controls_in_scope": 0, "signal_validations": 0, - "signal_failing": 0, "vdr_total": 0, "vdr_blocking": 0, - "vdr_accepted": 0, "vdr_kev": 0}, - "daily_metric_data": []}, - "rule_records": [], "assessor_records": {"status": "no assessor record", "records": []}} + sdr = {"metadata": {"version": "1.0.0", "lastUpdated": "t", "updateSource": "s"}, + "fedRampRequirements": [], "keySecurityIndicators": [], "securityControls": [], + "providerExtensions": {"certification": "c", "ksi_signal_id": "s", + "rules": {"version": "v", "commit": "0" * 40}, + "summary": {"fedRampRequirements": {}, "keySecurityIndicators": {}, + "securityControlsModerate": {}, "securityControlsBeyondModerate": {}}, + "assessorRecords": {"status": "no assessor record", "records": []}, + "assessorCommentResponses": {}}} assert "No assessor record" in sdr_mod.render_markdown(sdr) + + +def test_t74_reads_the_schema_shaped_sdr(tmp_path): + recs = _assessor.load_records(_dir_with(tmp_path, "genuine.json"), PIN) + rules = _rules("KSI-TEST-01") + block = _assessor.attach(rules, recs) + by_rule = {r["rule_id"]: r["assessor_comment_responses"] for r in rules if r["assessor_comment_responses"]} + sdr = {"providerExtensions": {"assessorRecords": block, "assessorCommentResponses": by_rule}} + _assessor.verify_output(sdr, recs) + bad = copy.deepcopy(sdr) + next(iter(bad["providerExtensions"]["assessorCommentResponses"].values()))[0]["text"] = "Softened." + with pytest.raises(SystemExit): + _assessor.verify_output(bad, recs) diff --git a/tests/test_availability_probe.py b/tests/test_availability_probe.py new file mode 100644 index 00000000..32a1c4af --- /dev/null +++ b/tests/test_availability_probe.py @@ -0,0 +1,126 @@ +"""CDS-CSO-AVR / CDS-TRC-USH: availability is measured outside AWS, with +incidents, and the deploy refuses a missing or stale independent feed.""" +import importlib.util +import json +from datetime import datetime, timedelta, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent + + +def _load(name, file): + spec = importlib.util.spec_from_file_location(name, REPO / "scripts" / file) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +probe = _load("availability_probe_t", "availability-probe.py") +avail = _load("build_availability_t", "build-availability.py") +NOW = datetime(2026, 11, 5, 12, tzinfo=timezone.utc) +KEYS = [k for k, *_ in probe.TARGETS] + + +def _sample(t, fail=None): + return {"t": probe._iso(t), "probed": KEYS, "fail": fail or {}} + + +def test_core_services_are_probed_including_the_app_and_its_sign_in(): + urls = {u for _k, _s, u, _ok in probe.TARGETS} + assert any(u.endswith("/silk-reeling/") for u in urls) + assert any("amazoncognito.com" in u for u in urls) + assert any("/.well-known/" in u for u in urls) and any(u.endswith("/trust/") for u in urls) + assert all(u.startswith("https://") for u in urls) + + +def test_a_failed_probe_records_the_status(): + s = probe.probe_once(lambda url: 503 if "trust" in url else 200, NOW) + assert s["fail"] == {"trust-center": "HTTP 503"} + + +def test_consecutive_failures_make_an_incident_and_a_single_one_is_transient(): + t = [NOW - timedelta(minutes=15 * i) for i in range(6, 0, -1)] + samples = [_sample(t[0]), _sample(t[1], {"site": "HTTP 503"}), _sample(t[2], {"site": "HTTP 503"}), + _sample(t[3]), _sample(t[4], {"trust-center": "no response (timeout)"}), _sample(t[5])] + incs, transient = probe.incidents(samples) + assert incs == [{"service": "site", "service_name": "Website", "start": probe._iso(t[1]), + "end": probe._iso(t[3]), "failed_probes": 2, "failing_check": "HTTP 503"}] + assert transient == {"trust-center": 1} + + +def test_an_ongoing_incident_has_no_end(): + samples = [_sample(NOW - timedelta(minutes=30), {"site": "HTTP 500"}), _sample(NOW, {"site": "HTTP 500"})] + (inc,), _ = probe.incidents(samples) + assert inc["end"] is None + + +def test_history_is_kept_35_days_and_its_start_is_carried(): + old = [_sample(NOW - timedelta(days=d)) for d in (40, 34, 1)] + prev = {"feed_type": "availability-status", "history_began": "2026-09-01T00:00:00Z", "samples": old} + doc = probe.build(prev, _sample(NOW), NOW) + assert len(doc["samples"]) == 3 and doc["history_began"] == "2026-09-01T00:00:00Z" + assert doc["availability"]["site"]["probes"] == 2 # 30-day window: day 1 and now + + +def test_availability_percent_counts_failures(): + prev = {"feed_type": "availability-status", "samples": [_sample(NOW - timedelta(hours=1), {"site": "HTTP 502"})]} + doc = probe.build(prev, _sample(NOW), NOW) + assert doc["availability"]["site"]["availability_percent"] == 50.0 + assert doc["current"]["site"] == "up" + + +def test_the_known_bad_stale_feed_fails_the_deploy_guard(): + why = probe.check_fresh(REPO / "tests" / "fixtures" / "availability" / "known-bad-stale-feed.json", 2, NOW) + assert why and "not running" in why[0] + + +def test_a_missing_feed_fails_the_deploy_guard(tmp_path): + assert probe.check_fresh(tmp_path / "absent.json", 2, NOW) + + +def test_the_onsite_feed_is_built_from_the_independent_one_never_from_a_deploy(tmp_path): + feed = probe.build({}, _sample(datetime.now(timezone.utc)), datetime.now(timezone.utc)) + (tmp_path / "f.json").write_text(json.dumps(feed)) + assert avail.main(["--probe-feed", str(tmp_path / "f.json"), "--ksi-signal", str(tmp_path / "none.json"), + "--output", str(tmp_path / "a.json"), "--md-output", str(tmp_path / "a.md")]) == 0 + doc = json.loads((tmp_path / "a.json").read_text()) + assert doc["independent_service"]["json"].startswith("https://raw.githubusercontent.com/") + assert "deploy" not in json.dumps(doc["daily"]) and doc["measured_at"] == feed["generated_at"] + assert "Independent status page" in (tmp_path / "a.md").read_text() + + +def test_the_onsite_builder_refuses_a_stale_feed(tmp_path): + with pytest.raises(SystemExit): + avail.main(["--probe-feed", str(REPO / "tests" / "fixtures" / "availability" / "known-bad-stale-feed.json"), + "--output", str(tmp_path / "a.json"), "--md-output", str(tmp_path / "a.md")]) + + +def test_the_monitor_runs_outside_aws_on_a_schedule_and_pushes_only_its_branch(): + wf = (REPO / ".github" / "workflows" / "availability-probe.yml").read_text() + assert "cron: '*/15 * * * *'" in wf + assert "permissions: {}" in wf and "contents: write" in wf + assert "aws-actions" not in wf and "id-token" not in wf + assert "HEAD:refs/heads/availability-status" in wf + assert wf.count("git -c http.extraheader") == 1 and "push --quiet --force" in wf + + +def test_the_deploy_reads_the_independent_feed_before_the_sdr(): + wf = (REPO / ".github" / "workflows" / "deploy-with-opa.yml").read_text() + step = wf.index("- name: Read the independent availability feed (fails when missing or stale)") + assert step < wf.index("- name: Build Security Decision Record") + assert "--check-fresh availability-probe.json --max-age-hours 2" in wf[step:step + 600] + assert "--probe-feed availability-probe.json" in wf + + +def test_an_ongoing_incident_fails_the_monitor_run_after_publishing(tmp_path): + samples = [_sample(NOW - timedelta(minutes=15), {"site": "HTTP 500"})] + doc = probe.build({"feed_type": "availability-status", "samples": samples}, _sample(NOW, {"site": "HTTP 500"}), NOW) + (tmp_path / "f.json").write_text(json.dumps(doc)) + assert probe.main(["--fail-on-incident", str(tmp_path / "f.json")]) == 1 + ok = probe.build({}, _sample(NOW), NOW) + (tmp_path / "g.json").write_text(json.dumps(ok)) + assert probe.main(["--fail-on-incident", str(tmp_path / "g.json")]) == 0 + wf = (REPO / ".github" / "workflows" / "availability-probe.yml").read_text() + assert wf.index("Publish the status feed") < wf.index("--fail-on-incident") diff --git a/tests/test_build_trust_center.py b/tests/test_build_trust_center.py index d636aa3c..1e69003a 100644 --- a/tests/test_build_trust_center.py +++ b/tests/test_build_trust_center.py @@ -410,3 +410,8 @@ def test_the_output_records_the_governed_freshness_config(): assert doc["freshness_windows_hours"]["corroboration"] == fc["windows_hours"][".well-known/boundary-corroboration.json"] sources = {t["name"]: t["source"] for t in doc["policy_catalog"]["thresholds"]["items"]} assert sources["Vulnerability evidence freshness"] == fc["source"] + + +def test_the_trust_center_carries_the_offerings_fedramp_id(): + import _offering + assert build()["fedRampId"] == _offering.fedramp_id() diff --git a/tests/test_certification_cycle.py b/tests/test_certification_cycle.py new file mode 100644 index 00000000..f473a866 --- /dev/null +++ b/tests/test_certification_cycle.py @@ -0,0 +1,575 @@ +"""The certification package and its quarterly cycle: the CPO in FedRAMP's +schema, the CCM calendar, the Ongoing Certification Report (rolling and +issued), snapshots, FedRAMP Certification Reports, the simulated package +submission, the FedRAMP ID gate and the unattended package maintainer. + +Each gate here has a committed known-bad fixture under tests/fixtures/cycle/bad/ +that fails for the reason the test names.""" + +import argparse +import copy +import fnmatch +import importlib.util +import json +import re +import sys +from datetime import date, datetime, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(REPO / "scripts")) +import _assessor # noqa: E402 +import _ccm # noqa: E402 +import _decisions # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 +import _sensitivity # noqa: E402 + +FIX = REPO / "tests" / "fixtures" / "cycle" +BAD = FIX / "bad" +NOW = datetime(2026, 11, 5, 12, tzinfo=timezone.utc) +ISSUE_DAY = datetime(2026, 11, 24, 12, tzinfo=timezone.utc) +SIGNAL = json.loads((REPO / "tests" / "fixtures" / "clean" / "ksi-signal.json").read_text()) +PROFILE = json.loads((REPO / "data" / "system-profile.json").read_text()) +# The simulated assessor's signed set (signature check stubbed; tested in test_simulated_assessor.py). +def _assessment(): + import tempfile + with tempfile.TemporaryDirectory() as d: + s = Path(d) / "simulated-assessment.json" + s.write_text((REPO / "tests" / "fixtures" / "assessor" / "simulated-set.json").read_text()) + return _assessor.load_assessment(s, s, verifier=lambda *_a: True) + + +ASSESSMENT = _assessment() + + +def _load(name, script): + spec = importlib.util.spec_from_file_location(name, REPO / "scripts" / script) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +cpo = _load("build_cpo", "build-cpo.py") +ocr = _load("build_ocr", "build-ocr.py") +issue_ocr = _load("issue_ocr", "issue-ocr.py") +frc = _load("publish_frc", "publish-certification-reports.py") +submit = _load("submit_package", "submit-package.py") +fid_gate = _load("check_fedramp_id", "check-fedramp-id.py") +maint = _load("check_package_maintainer", "check-package-maintainer.py") + + +def _json(p): + return json.loads(Path(p).read_text()) + + +def _cal(today=None, path=_ccm.CALENDAR_PATH): + return _ccm.load(path, today or NOW.date()) + + +def _off(path=_offering.OFFERING_PATH): + return _offering.load(path) + + +def _cpo(off=None, prev=None, now=NOW): + return cpo.build(off or _off(), PROFILE, SIGNAL, _cal(now.date()), prev or {}, now, cpo.boundary_groups(), + ASSESSMENT) + + +def _ocr(now=NOW, issue=None, incidents=None, feedback=None, scn_rows=(), prev=None, decisions=None): + return ocr.build(_cal(now.date()), now.date(), None, decisions or _decisions.load(), list(scn_rows), incidents, + feedback or {"schema": "ocr-feedback/1", "summaries": []}, SIGNAL, PROFILE, _off(), + prev or {}, now, issue) + + +# --- the CCM calendar (CCM-OCR-SOR, CCM-QTR-SAR, CCM-OCR-NRD, CCM-QTR-NRD) ----------- + +def test_the_committed_calendar_is_valid(): + cal = _cal() + assert len(cal.issues) >= 4 + + +def test_the_review_is_five_business_days_after_issue_skipping_thanksgiving(): + cal = _cal() + # 2026-11-24 (Tue) + 5 business days, Thanksgiving (Thu 26th) excluded. + assert cal.review_date(date(2026, 11, 24)) == date(2026, 12, 2) + for d in cal.issues: + r = cal.review_date(d) + days = [x for x in (date.fromordinal(o) for o in range(d.toordinal() + 1, r.toordinal() + 1)) + if cal.is_business_day(x)] + assert len(days) == cal.offset and 3 <= cal.offset <= 10 + + +@pytest.mark.parametrize("fixture,today,reason", [ + ("calendar-mid-quarter.json", None, "beginning, middle or end of its quarter"), + ("calendar-irregular-gap.json", None, "not a regular 3-month cycle"), + ("calendar-review-too-soon.json", None, "must be 3 to 10"), + ("calendar-runs-out.json", date(2026, 12, 1), "fewer than 2 issue dates"), + ("calendar-issue-on-holiday.json", None, "is not a business day"), +]) +def test_a_bad_calendar_fails_closed(fixture, today, reason): + with pytest.raises(SystemExit, match=reason): + _ccm.load(BAD / fixture, today or NOW.date()) + + +def test_next_dates_hold_steady_between_issues_and_move_on_the_issue_date(): + cal = _cal() + before = [_ccm.dates_summary(cal, date(2026, 11, d)) for d in (5, 12, 23)] + assert all(b == before[0] for b in before) + assert before[0]["nextOngoingCertificationReportDate"] == "2026-11-24" + assert before[0]["nextQuarterlyReviewDate"] == "2026-12-02" + on = _ccm.dates_summary(cal, date(2026, 11, 24)) + assert on["nextOngoingCertificationReportDate"] == "2027-02-23" + assert on["nextQuarterlyReviewDate"] == "2026-12-02" # the review of the report just issued + + +def test_the_review_calendar_file_is_rfc5545(): + text = _ccm.ics(_cal(), NOW.date()) + assert text.startswith("BEGIN:VCALENDAR\r\n") and text.endswith("END:VCALENDAR\r\n") + assert "\n" not in text.replace("\r\n", "") + assert all(len(line.encode()) <= 75 for line in text.split("\r\n")) + assert text.count("BEGIN:VEVENT") == len(_cal().issues) + assert "DTSTART:20261202T170000Z" in text + unfolded = text.replace("\r\n ", "") + assert f"URL:{_ccm.REGISTRATION_URL}" in unfolded + assert _ccm.ics(_cal(), NOW.date()) == text # deterministic + + +# --- the CPO (CPO-CSO-OVR, CPO-CSO-MTD, CDS-CSO-SVC, CDS-CSO-FID, FRC-CSO-POP) ------- + +@pytest.fixture(scope="module") +def built_cpo(): + return _cpo() + + +def test_the_cpo_validates_against_fedramps_schema(built_cpo): + assert fs.validate(built_cpo, "cpo") == [] + + +def test_the_cpo_seeks_20x_only(built_cpo): + assert built_cpo["serviceIdentification"]["certificationType"] == "20x" + assert "Rev5" not in built_cpo["providerExtensions"]["certification"].replace(" ", "") + assert "Rev 5" not in built_cpo["providerExtensions"]["certification"] + + +def test_no_cpo_or_ocr_label_names_rev5_as_a_program(built_cpo, rolling): + """FRC-CSO-POP (DEC-107). The only Rev5 the package names is the Moderate + control baseline the SDR maps 20x evidence onto, never a certification.""" + for text in (json.dumps(built_cpo), cpo.render_markdown(built_cpo), json.dumps(rolling), ocr.render_markdown(rolling)): + assert re.findall(r"Rev ?5(?! Moderate control)", text) == [] + + +def test_the_fedramp_id_and_uei_are_the_offerings_and_flagged_simulated(built_cpo): + off = _off() + si = built_cpo["serviceIdentification"] + assert si["fedRampPackageId"] == off["fedramp_id"] == built_cpo["providerExtensions"]["fedRampId"] + assert off["provider_name"] in si["fedRampPackageId"] and off["service_acronym"] in si["fedRampPackageId"] + assert "NOT-A-REAL" in si["fedRampPackageId"] and "NOT-A-REAL" in si["ueiNumber"] + sim = {s["field"]: s["counterparty"] for s in built_cpo["providerExtensions"]["simulated"]} + assert sim == {"serviceIdentification.fedRampPackageId": "fedramp", "serviceIdentification.ueiNumber": "sam-gov", + "providerExtensions.independentAssessment.overallSummary": "assessor"} + + +@pytest.mark.parametrize("fixture,reason", [ + ("offering-placeholder-id-unflagged.json", "fedramp_id_simulated"), + ("offering-id-without-provider-name.json", "provider name and acronym"), +]) +def test_a_bad_fedramp_id_in_the_offering_fails(fixture, reason): + with pytest.raises(SystemExit, match=reason): + _offering.load(BAD / fixture) + + +def test_each_service_has_its_own_category_and_the_list_says_what_is_not_included(built_cpo): + services = built_cpo["providerExtensions"]["services"] + assert len(services) == len(built_cpo["certifiedServices"]) >= 2 + cats = {json.dumps(s["securityCategory"], sort_keys=True) for s in services} + assert len(cats) == len(services) # not one uniform label + assert all(s["boundaryGroups"] for s in services) + assert built_cpo["providerExtensions"]["notIncluded"] + + +@pytest.mark.parametrize("fixture,reason", [ + ("offering-service-above-system.json", "exceeds the system's"), + ("offering-unknown-boundary-group.json", "not in the boundary classification"), +]) +def test_a_bad_service_list_fails(fixture, reason): + with pytest.raises(SystemExit, match=reason): + _cpo(off=_off(BAD / fixture)) + + +def test_no_contact_email_field_holds_anything_but_an_address(built_cpo): + fsi = _cpo(off=_off(FIX / "offering-fsi-url.json")) + for doc in (built_cpo, fsi): + for c in doc["contactInformation"]: + if "contactEmail" in c: + assert re.fullmatch(r"[^@\s/]+@[^@\s/]+\.[a-z]+", c["contactEmail"]) + entry = next(c for c in fsi["contactInformation"] if c["contactType"] == "FedRAMP Security Inbox") + assert "contactEmail" not in entry + good = _off(FIX / "offering-fsi-url.json") + good["fedramp_security_inbox"]["address"] = "security@samaydlette.com" + entry = next(c for c in _cpo(off=good)["contactInformation"] if c["contactType"] == "FedRAMP Security Inbox") + assert entry["contactEmail"] == "security@samaydlette.com" + + +def test_the_cpo_version_is_semver_and_bumps_only_on_change(built_cpo): + md = built_cpo["metadata"] + assert md["version"] == "1.0.0" and md["lastUpdated"] == NOW.isoformat() and md["updateSource"] + later = datetime(2026, 11, 6, 12, tzinfo=timezone.utc) + assert _cpo(prev=built_cpo, now=later)["metadata"]["version"] == "1.0.0" + prev = copy.deepcopy(built_cpo) + prev["metadata"]["version"] = "1.0.4" + prev["providerExtensions"]["contentSha256"] = "0" * 64 + assert _cpo(prev=prev)["metadata"]["version"] == "1.0.5" + + +def test_the_cpo_publishes_the_fixed_cycle_dates(built_cpo): + cal = _cal() + assert built_cpo["serviceProperties"]["nextOngoingCertificationReportDate"] == cal.next_issue(NOW.date()).isoformat() + cm = built_cpo["providerExtensions"]["continuousMonitoring"] + assert cm["quarterlyReviewCalendar"] == _ccm.ICS_URL and cm["quarterlyReviewRegistration"] == _ccm.REGISTRATION_URL + + +# --- the OCR (CCM-OCR-*, CCM-QTR-*) --------------------------------------------------- + +@pytest.fixture(scope="module") +def rolling(): + return _ocr() + + +def test_the_rolling_ocr_validates_and_carries_the_cycle(rolling): + assert fs.validate(rolling, "ocr") == [] + pe = rolling["providerExtensions"] + assert pe["report"]["kind"] == "rolling" + assert pe["fedRampId"] == _offering.fedramp_id() + assert pe["continuousMonitoring"]["nextOngoingCertificationReportDate"] == "2026-11-24" + assert pe["quarterlyReview"]["date"] == "2026-12-02" + assert pe["quarterlyReview"]["agenda"] == ocr.STANDING_AGENDA and len(ocr.STANDING_AGENDA) >= 3 + assert pe["publicRelease"]["decision"] == ocr.PUBLIC_RELEASE_DECISION + assert pe["feedback"]["channel"].startswith(_ccm.REPO_URL + "/issues/new?template=ocr-feedback.yml") + assert pe["sensitivityScreen"] == {"checks": list(_sensitivity.CHECKS), "findings": 0} + + +def test_the_decisions_the_ocr_cites_are_in_force(): + ids = {d["id"] for d in _decisions.in_force(_decisions.load())} + assert {ocr.PUBLIC_RELEASE_DECISION, ocr.FEEDBACK_DECISION, ocr.REVIEW_DECISION} <= ids + + +def test_an_issued_ocr_covers_the_quarter_and_is_marked_frozen(): + doc = _ocr(now=ISSUE_DAY, issue=date(2026, 11, 24)) + assert fs.validate(doc, "ocr") == [] + assert doc["reportPeriod"] == {"from": "2026-08-25", "to": "2026-11-24"} + assert doc["providerExtensions"]["report"]["kind"] == "issued" + assert doc["providerExtensions"]["report"]["late"] is False + + +def test_an_issue_cannot_be_built_before_its_date_or_off_the_calendar(): + with pytest.raises(SystemExit, match="in the future"): + _ocr(issue=date(2026, 11, 24)) + with pytest.raises(SystemExit, match="not a calendar issue date"): + _ocr(now=ISSUE_DAY, issue=date(2026, 11, 23)) + + +@pytest.mark.parametrize("check", sorted(_json(BAD / "sensitive-values.json"))) +def test_the_sensitivity_screen_catches_each_kind(check): + doc = _json(BAD / "sensitive-values.json")[check] + assert {c for _, c in _sensitivity.screen(doc)} == {check} + with pytest.raises(SystemExit, match="must not be published"): + _sensitivity.require_clean(doc, "the fixture") + + +def test_the_sensitivity_screen_catches_a_token_and_allows_the_systems_own_domain(): + token = "ghp_" + "A1b2C3d4" * 5 + assert _sensitivity.screen({"x": f"used {token}"}) == [("/x", "token")] + assert _sensitivity.screen({"x": "write to security@samaydlette.com"}) == [] + + +def test_an_ocr_carrying_a_personal_address_is_never_built(): + row = {"scn_id": "SCN-T-1", "scn_type": "adaptive", "date_finished": "2026-11-01", + "short_description": "Asked by jane.doe@example.org"} + with pytest.raises(SystemExit, match="sensitivity screen"): + _ocr(scn_rows=[row]) + + +def test_reportable_incidents_come_from_the_register_and_exercises_say_so(): + reg = {"incidents": [ + {"id": "INC-1", "title": "Exercise: tabletop", "exercise": True, "started_at": "2026-10-01T00:00:00Z", + "resolved_at": "2026-10-01T02:00:00Z", "evaluation": {"reportable": True}, "lessons_learned": ["Drill it"]}, + {"id": "INC-2", "title": "Not reportable", "started_at": "2026-10-02T00:00:00Z", + "evaluation": {"reportable": False}}]} + got = _ocr(incidents=reg)["reportableIncidents"]["incidents"] + assert [i["summary"] for i in got] == ["INC-1: Exercise, not a real incident: tabletop"] + assert got[0]["incidentLessonsLearned"] == ["Drill it"] + + +def test_the_feedback_summary_covers_the_previous_issue(): + fb = {"schema": "ocr-feedback/1", "summaries": [ + {"ocr": "2026-11-24", "received": 2, "summarized_by": "Sam Aydlette", "summarized_on": "2026-12-03", + "items": [{"question": "Why monthly?", "answer": "It is quarterly."}]}]} + later = datetime(2026, 12, 10, 12, tzinfo=timezone.utc) + s = _ocr(now=later, feedback=fb)["providerExtensions"]["feedback"]["summaryOfPreviousReport"] + assert s["received"] == 2 and s["items"] == [{"question": "Why monthly?", "answer": "It is quarterly."}] + none = _ocr(now=later)["providerExtensions"]["feedback"]["summaryOfPreviousReport"] + assert none["received"] == 0 and "No feedback" in none["statement"] + + +def test_a_feedback_summary_with_more_items_than_received_fails(tmp_path): + p = tmp_path / "fb.json" + p.write_text(json.dumps({"schema": "ocr-feedback/1", "summaries": [ + {"ocr": "2026-11-24", "received": 0, "summarized_by": "x", "summarized_on": "2026-12-01", + "items": [{"question": "q", "answer": "a"}]}]})) + with pytest.raises(SystemExit, match="more summarized items than received"): + ocr.load_feedback(p) + assert ocr.load_feedback(REPO / "data" / "ocr-feedback.json")["schema"] == "ocr-feedback/1" + + +# --- issuing and snapshots (CCM-OCR-AVL, CDS-CSO-HAD) --------------------------------- + +def _issue_args(tmp_path, work, prev=None): + sig = tmp_path / "ksi-signal.json" + sig.write_text(json.dumps(SIGNAL)) + return argparse.Namespace( + work=str(work), out=str(tmp_path / "out"), previous_index=str(prev) if prev else None, + new_files=str(tmp_path / "issued.txt"), calendar=str(_ccm.CALENDAR_PATH), + offering=str(_offering.OFFERING_PATH), profile=str(REPO / "data" / "system-profile.json"), + vdr=str(tmp_path / "none.json"), decisions=str(REPO / "data" / "decisions.json"), + scn_register=str(tmp_path / "none.csv"), ksi_signal=str(sig), incidents=str(tmp_path / "none.json"), + feedback=str(REPO / "data" / "ocr-feedback.json")) + + +def _work(tmp_path, names=issue_ocr.REQUIRED): + w = tmp_path / "work" + w.mkdir(exist_ok=True) + for n in names: + (w / n).write_text(json.dumps({"file": n})) + return w + + +def test_the_first_run_on_an_issue_date_freezes_the_report_and_snapshots_the_package(tmp_path): + index, new = issue_ocr.run(_issue_args(tmp_path, _work(tmp_path)), ISSUE_DAY) + out = tmp_path / "out" + assert [i["issueDate"] for i in index["issues"]] == ["2026-11-24"] + assert {"ocr-issue-2026-11-24.json", "ocr-issue-2026-11-24.md", "snapshot-2026-11-24.json"} <= set(new) + assert fs.validate(_json(out / "ocr-issue-2026-11-24.json"), "ocr") == [] + manifest = _json(out / "snapshot-2026-11-24.json") + assert sorted(f["name"] for f in manifest["files"]) == sorted(issue_ocr.REQUIRED) + assert index["issues"][0]["quarterlyReviewDate"] == "2026-12-02" + assert index["fedRampId"] == _offering.fedramp_id() + # Every new file is one the maintenance role may write. + keys = _bootstrap_keys() + assert all(any(fnmatch.fnmatch(".well-known/" + f, k) for k in keys) for f in new) + + +def test_an_issued_report_is_carried_over_and_never_rebuilt(tmp_path): + index, _ = issue_ocr.run(_issue_args(tmp_path, _work(tmp_path)), ISSUE_DAY) + prev = tmp_path / "prev.json" + prev.write_text(json.dumps(index)) + again, new = issue_ocr.run(_issue_args(tmp_path, _work(tmp_path), prev), datetime(2026, 11, 25, tzinfo=timezone.utc)) + assert new == [] and again["issues"] == index["issues"] + + +def test_no_issue_without_the_certification_data_to_snapshot(tmp_path): + with pytest.raises(SystemExit, match="ksi-signal.json missing"): + issue_ocr.run(_issue_args(tmp_path, _work(tmp_path, issue_ocr.REQUIRED[:-1])), ISSUE_DAY) + + +@pytest.mark.parametrize("fixture,reason", [ + ("ocr-issues-not-a-calendar-date.json", "not a calendar issue date"), + ("ocr-issues-out-of-order.json", "out of order"), +]) +def test_a_tampered_issue_index_fails(fixture, reason): + with pytest.raises(SystemExit, match=reason): + issue_ocr.check_index(_json(BAD / fixture), _cal()) + + +# --- FedRAMP Certification Reports (CDS-CSO-FRC, simulated FedRAMP) ------------------- + +def test_the_committed_reports_are_published_byte_identical(tmp_path): + reg = frc.load_register(today=NOW.date()) + idx = frc.build(reg, {}, NOW, tmp_path) + for e in idx["reports"]: + assert (tmp_path / "fedramp-certification-reports" / e["file"]).read_bytes() == \ + (frc.REPORTS_DIR / e["file"]).read_bytes() + assert e["simulated"] is True and e["withinTwoWeeks"] is True + assert idx["simulated"]["counterparty"] == "fedramp" + later = datetime(2026, 12, 31, tzinfo=timezone.utc) + again = frc.build(reg, idx, later, tmp_path) + assert [e["firstPublished"] for e in again["reports"]] == [e["firstPublished"] for e in idx["reports"]] + + +@pytest.mark.parametrize("fixture,reason", [ + ("frc-modified", "differs from the sha256 recorded"), + ("frc-unlisted", "files not in the register"), +]) +def test_a_modified_or_unregistered_report_fails(fixture, reason): + with pytest.raises(SystemExit, match=reason): + frc.load_register(BAD / fixture, NOW.date()) + + +# --- the simulated package submission (FRC-CSO-PKG, FRC-CSO-POP) ---------------------- + +PKG_ID = "Example Provider (EXD)" +PKG_RULES = ["VDR-CSO-DET"] + + +def _pkg(**over): + paths = {k: FIX / "package" / f"{k}.json" for k in ("cpo", "sdr", "ocr")} + paths.update({k: BAD / v for k, v in over.items()}) + return {k: _json(p) for k, p in paths.items()}, paths + + +def test_a_complete_package_is_logged_once_per_content_change(): + docs, paths = _pkg() + log = submit.build(docs, paths, {}, NOW, "abc", PKG_RULES, PKG_ID) + assert log["nothingSent"] is True and log["simulated"]["counterparty"] == "fedramp" + assert len(log["entries"]) == 1 and log["entries"][0]["receipt"]["receiptId"].startswith("SIM-") + assert len(submit.build(docs, paths, log, NOW, "abc", PKG_RULES, PKG_ID)["entries"]) == 1 + docs["ocr"]["providerExtensions"]["contentSha256"] = "f" * 64 + assert len(submit.build(docs, paths, log, NOW, "abd", PKG_RULES, PKG_ID)["entries"]) == 2 + + +@pytest.mark.parametrize("over,rules,reason", [ + ({"cpo": "../../cr26/bad/cpo-no-sales-contact.json"}, PKG_RULES, "does not validate against FedRAMP's schema"), + ({"cpo": "cpo-rev5-program.json"}, PKG_RULES, "FRC-CSO-POP"), + ({"cpo": "cpo-without-assessment-summary.json"}, PKG_RULES, "CPO-CSO-OVR"), + ({"sdr": "sdr-repeats-a-rule.json"}, PKG_RULES, "every applicable FedRAMP rule exactly once"), + ({}, PKG_RULES + ["CCM-OCR-AVL"], "every applicable FedRAMP rule exactly once"), + ({"ocr": "ocr-other-fedramp-id.json"}, PKG_RULES, "CDS-CSO-FID"), +]) +def test_an_incomplete_or_inconsistent_package_is_not_submitted(over, rules, reason): + docs, paths = _pkg(**over) + with pytest.raises(SystemExit, match=reason): + submit.build(docs, paths, {}, NOW, "abc", rules, PKG_ID) + + +def test_a_malformed_previous_log_is_not_overwritten(): + docs, paths = _pkg() + with pytest.raises(SystemExit, match="malformed entry"): + submit.build(docs, paths, _json(BAD / "submission-log-malformed.json"), NOW, "abc", PKG_RULES, PKG_ID) + + +# --- the FedRAMP ID gate (CDS-CSO-FID) ------------------------------------------------- + +def test_the_gate_covers_the_three_reports_by_default(): + assert fid_gate.REPORTS[:3] == ("certification-package-overview.json", "security-decision-record.json", + "ongoing-certification-report.json") + step = _step("deploy-with-opa.yml", "FedRAMP ID in every FedRAMP report (CDS-CSO-FID)") + assert "check-fedramp-id.py" in step + + +@pytest.mark.parametrize("fixture,ok", [ + (FIX / "package" / "cpo.json", True), (FIX / "package" / "ocr.json", True), + (BAD / "ocr-other-fedramp-id.json", False), (BAD / "cpo-other-package-id.json", False), +]) +def test_the_gate_fails_a_report_with_another_fedramp_id(monkeypatch, fixture, ok): + monkeypatch.setattr(fid_gate._offering, "fedramp_id", lambda *a: PKG_ID) + assert fid_gate.main([str(fixture)]) == (0 if ok else 1) + + +def test_the_gate_fails_an_unreadable_report(tmp_path): + assert fid_gate.main([str(tmp_path / "missing.json")]) == 1 + + +# --- the unattended maintainer (CPO-CSX-CPM, SDR-CSX-KMT) ----------------------------- + +WORKFLOWS = REPO / ".github" / "workflows" + + +def _step(workflow, name): + text = (WORKFLOWS / workflow).read_text() + start = text.index(f"- name: {name}") + end = text.find("\n - name:", start + 1) + return text[start:end if end > 0 else None] + + +def _bootstrap_keys(): + tf = (REPO / "infrastructure" / "bootstrap" / "package-maintenance.tf").read_text() + block = re.search(r"package_maintenance_keys = \[(.*?)\]", tf, re.S).group(1) + return re.findall(r'"([^"]+)"', block) + + +def _maintenance_publishes(): + step = _step("package-maintenance.yml", "Publish the certification package to /.well-known/") + names = set(re.findall(r"^\s*put ([\w.-]+)\s", step, re.M)) + for var, items, body in re.findall(r"for (\w+) in ([^;\n]+); do(.*?)\n\s*done", step, re.S): + for suffix in re.findall(r"put \"\$" + var + r"(\.[\w.]+)\"", body): + names |= {i + suffix for i in items.split()} + return {".well-known/" + n for n in names} + + +def test_the_maintenance_role_may_write_exactly_what_the_workflow_publishes(): + keys = _bootstrap_keys() + literal = {k for k in keys if "*" not in k} + assert literal == _maintenance_publishes() + assert {k for k in keys if "*" in k} == {".well-known/ocr-issue-*", ".well-known/snapshot-*", + ".well-known/snapshots/*"} + + +def test_the_maintainer_runs_daily_and_the_package_windows_are_two_weeks_at_most(): + wf = (WORKFLOWS / "package-maintenance.yml").read_text() + assert re.search(r"cron: '\d+ \d+ \* \* \*'", wf) + assert "environment: package-maintenance" in wf and "workflow_call:" in wf + cfg = {a["path"]: a for a in _json(REPO / "infrastructure" / "schemas" / "freshness-config.json")["artifacts"]} + for p in ("security-decision-record.json", "certification-package-overview.json", + "ongoing-certification-report.json"): + assert cfg[".well-known/" + p]["max_age_hours"] <= 14 * 24 + + +def test_the_deploy_checks_the_maintainer_before_building_and_proves_it_after(): + wf = (WORKFLOWS / "deploy-with-opa.yml").read_text() + assert wf.index("- name: Package maintainer preflight") < wf.index("- name: Build Security Decision Record") + assert "uses: ./.github/workflows/package-maintenance.yml" in wf + + +def test_the_maintainer_preflight_passes_when_in_place(): + assert maint.main(["--fixture", str(FIX / "maintainer-good.json")]) == 0 + + +@pytest.mark.parametrize("fixture,reason", [ + ("maintainer-no-variable.json", "is not set"), + ("maintainer-wrong-role.json", "names a role other than"), + ("maintainer-any-branch.json", "not only main"), + ("maintainer-no-environment.json", "does not exist"), +]) +def test_the_maintainer_preflight_fails_when_not_in_place(fixture, reason, capsys): + assert maint.main(["--fixture", str(BAD / fixture)]) == 1 + assert reason in capsys.readouterr().out + + +# --- every link the package gives resolves to something this repo publishes (FRC-CSO-MRA) + +def _resolves(url): + site = "https://samaydlette.com" + if url.startswith(site + "/.well-known/"): + name = url[len(site + "/.well-known/"):] + governed = {a["path"] for a in _json(REPO / "infrastructure" / "schemas" / "freshness-config.json")["artifacts"]} + twin = name[:-3] + ".json" if name.endswith(".md") else name # a governed artifact's Markdown twin + return (f".well-known/{name}" in governed or f".well-known/{twin}" in governed + or (REPO / "website" / ".well-known" / name).is_file()) + if url in (site, site + "/"): + return (REPO / "website" / "index.html").is_file() + if url.startswith(site + "/"): + return (REPO / "website" / url[len(site) + 1:].split("#")[0]).is_file() + if url.startswith(_ccm.REPO_URL + "/blob/main/"): + return (REPO / url[len(_ccm.REPO_URL + "/blob/main/"):].split("#")[0]).is_file() + if url.startswith(_ccm.REPO_URL + "/issues/new?template="): + return (REPO / ".github" / "ISSUE_TEMPLATE" / url.split("template=")[1].split("&")[0]).is_file() + if url.startswith("https://fedramp.gov/schemas/"): + return any((REPO / "infrastructure" / "schemas").glob("fedramp-*/" + url.rsplit("/", 1)[1])) + return False + + +def test_every_link_in_the_cpo_and_ocr_resolves(built_cpo, rolling): + # Third-party resources' own websites (MAS-CSO-TPR) are outside this site by design. + cpo_own = {k: v for k, v in built_cpo.items() if k != "thirdPartyInformationResources"} + for doc in (cpo_own, rolling): + urls = set(re.findall(r"https://[^\s\"')<>]+", json.dumps(doc))) + assert urls + bad = sorted(u.rstrip(".,") for u in urls if not _resolves(u.rstrip(".,"))) + assert not bad, bad + + +def test_a_link_to_nothing_is_caught(): + assert not _resolves("https://samaydlette.com/.well-known/not-published.json") + assert not _resolves(_ccm.REPO_URL + "/blob/main/docs/no-such-file.md") diff --git a/tests/test_controls.py b/tests/test_controls.py index fa0aae40..c9a67ba0 100644 --- a/tests/test_controls.py +++ b/tests/test_controls.py @@ -26,6 +26,11 @@ REPO = Path(__file__).resolve().parent.parent FIX_SIGNAL = REPO / "tests" / "fixtures" / "clean" / "ksi-signal.json" CATALOG = REPO / "infrastructure" / "schemas" / "ksi-catalog.json" +# The KSI catalog as it stood when the SSP was retired (FedRAMP's mappings before +# its 2026-10-13 revision). The parity test runs the projection on it, so the +# projection's code stays pinned to the SSP it replaced; the current catalog is +# FedRAMP's current mapping (tests/test_ksi_catalog_corpus.py). +CATALOG_AT_RETIREMENT = REPO / "tests" / "fixtures" / "migration" / "ksi-catalog-2026-11-05.json" FROZEN = REPO / "tests" / "fixtures" / "migration" / "ssp-control-status-2026-11-05.json" sys.path.insert(0, str(REPO / "scripts")) @@ -48,7 +53,7 @@ def _projection(): def test_the_projection_matches_the_last_ssp_control_for_control(): frozen = json.loads(FROZEN.read_text()) - irs = _projection() + irs = _controls.load(FIX_SIGNAL, CATALOG_AT_RETIREMENT) assert len(irs) == frozen["implemented_requirements"] == 333 got = {cid: list(v) for cid, v in _controls.status_map(irs).items()} assert got == frozen["controls"] @@ -78,34 +83,7 @@ def test_a_failing_contributing_ksi_downgrades_its_controls(): assert status == "partial" -# --- the SDR carries the per-control record (SDR-CSF-CTF) --------------------------- - -def test_the_sdr_summarizes_every_projected_control(): - sdr = _load("build_sdr", "build-sdr.py") - irs = _projection() - rows = sdr.build_rev5_controls(irs, json.loads(CATALOG.read_text())) - assert [r["control_id"] for r in rows] == [ir["control-id"] for ir in irs] - vocab = {"Implemented", "Partially Implemented", "Planned", "Alternative Implementation", "Not Applicable"} - for r, ir in zip(rows, irs, strict=True): - assert r["implementation_status"] in vocab, r["control_id"] - assert r["mechanisms"].startswith(ir["statements"][0]["remarks"]) - assert r["parameters"] == [{"param_id": sp["param-id"], "values": sp.get("values", [])} - for sp in ir.get("set-parameters", [])] - for k in ("verification", "validation", "independent_verification", "independent_validation"): - assert r[k].strip(), (r["control_id"], k) - # Parameter values the FedRAMP profile sets are carried, not dropped. - assert sum(len(r["parameters"]) for r in rows) > 200 - - -def test_sdr_verification_points_at_the_contributing_ksis(): - sdr = _load("build_sdr2", "build-sdr.py") - rows = sdr.build_rev5_controls(_projection(), json.loads(CATALOG.read_text())) - claimed = [r for r in rows if r["contributing_ksis"] and r["implementation_status"] != "Not Applicable" - and r["origination"] != "inherited"] - assert claimed - for r in claimed: - assert all(k in r["verification"] for k in r["contributing_ksis"]), r["control_id"] - +# --- the SDR carries the per-control record: tests/test_sdr.py ---------------------- def test_the_sdr_builder_fails_closed_without_the_inventory(tmp_path): r = subprocess.run([sys.executable, str(REPO / "scripts" / "build-sdr.py"), diff --git a/tests/test_cpo_trust_fields.py b/tests/test_cpo_trust_fields.py new file mode 100644 index 00000000..a0b16bd7 --- /dev/null +++ b/tests/test_cpo_trust_fields.py @@ -0,0 +1,97 @@ +"""Group 5's fields in the Certification Package Overview: the trust center and +secure configuration guidance (CDS-CSO-PUB, CDS-CSO-UTC, SCG-CSO-AUP), the +third-party information resources (MAS-CSO-TPR) and the assessor's overall +summary, quoted verbatim from its signed set (CPO-CSO-OSA).""" +import importlib.util +import json +import re +import sys +import tempfile +from datetime import datetime, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(REPO / "scripts")) +import _assessor # noqa: E402 +import _ccm # noqa: E402 +import _fedramp_schema as fs # noqa: E402 +import _offering # noqa: E402 +import _tpr # noqa: E402 + +spec = importlib.util.spec_from_file_location("build_cpo_g5", REPO / "scripts" / "build-cpo.py") +cpo = importlib.util.module_from_spec(spec) +spec.loader.exec_module(cpo) + +NOW = datetime(2026, 11, 5, 12, tzinfo=timezone.utc) +SIGNAL = json.loads((REPO / "tests" / "fixtures" / "clean" / "ksi-signal.json").read_text()) +PROFILE = json.loads((REPO / "data" / "system-profile.json").read_text()) +FRESH = {a["path"] for a in json.loads((REPO / "infrastructure" / "schemas" / "freshness-config.json").read_text()) + ["artifacts"]} + + +def _assessment(): + with tempfile.TemporaryDirectory() as d: + s = Path(d) / "simulated-assessment.json" + s.write_text((REPO / "tests" / "fixtures" / "assessor" / "simulated-set.json").read_text()) + return _assessor.load_assessment(s, s, verifier=lambda *_a: True) + + +def _build(assessment=None): + return cpo.build(_offering.load(), PROFILE, SIGNAL, _ccm.load(_ccm.CALENDAR_PATH, NOW.date()), {}, NOW, + cpo.boundary_groups(), _assessment() if assessment is None else assessment) + + +def test_the_cpo_with_group_5_fields_validates_against_fedramps_schema(): + assert fs.validate(_build(), "cpo") == [] + + +def test_the_trust_center_entry_is_the_landing_page_with_access_instructions(): + tc = _build()["serviceProperties"]["trustCenter"] + assert tc["url"] == "https://samaydlette.com/trust/index.html" + assert (REPO / "website" / "trust" / "index.html").is_file() + assert tc["authenticationRequired"] is False and "No access request is needed" in tc["accessRequestInstructions"] + + +def test_the_secure_configuration_guidance_links_the_published_guide(): + scg = _build()["serviceProperties"]["secureConfigurationGuidance"] + assert scg["url"] == "https://samaydlette.com/.well-known/secure-configuration-guide.md" + assert ".well-known/secure-configuration-guide.json" in FRESH + + +def test_third_party_resources_are_the_decided_records(): + doc = _build() + assert doc["thirdPartyInformationResources"] == _tpr.cpo_third_party_information_resources() + assert doc["thirdPartyInformationResources"]["nonCertified"] + + +def test_the_overall_summary_is_the_assessors_record_verbatim(): + recs = _assessment() + ia = _build(recs)["providerExtensions"]["independentAssessment"] + assert ia["overallSummary"] == _assessor.overall_summary(recs) + assert "IVV-IAS-OSA" in ia["overallSummary"]["text"] and ia["simulated"] is True + assert "assessor" not in _build(recs) # no FedRAMP assessor ID exists; none is invented + md = cpo.render_markdown(_build(recs)) + assert ia["overallSummary"]["text"][:80] in md + + +def test_known_bad_an_assessment_without_a_summary_fails(): + recs = [r for r in _assessment() if r["kind"] != "summary"] + with pytest.raises(SystemExit, match="no overall summary"): + _build(recs) + + +def test_the_cpo_refuses_to_build_without_the_assessment(): + with pytest.raises(SystemExit): + cpo.main(["--output", "/dev/null"]) + + +def test_the_deploy_and_the_maintainer_give_the_cpo_the_assessment(): + wf = REPO / ".github" / "workflows" + deploy = (wf / "deploy-with-opa.yml").read_text() + step = deploy.split("- name: Build Certification Package Overview (CPO)", 1)[1].split("\n - name:", 1)[0] + assert "--assessment simulated-assessment.json" in step + maint = (wf / "package-maintenance.yml").read_text() + step = maint.split("- name: Rebuild the SDR, OCR and CPO at the deployed commit", 1)[1].split("\n - name:", 1)[0] + assert len(re.findall(r"^\s+\$ASSESSMENT$", step, re.M)) == 3 and "--assessment $W/simulated-assessment.json" in step diff --git a/tests/test_edge_access_logging.py b/tests/test_edge_access_logging.py new file mode 100644 index 00000000..77efb2d7 --- /dev/null +++ b/tests/test_edge_access_logging.py @@ -0,0 +1,154 @@ +"""CDS-TRC-ACL: access to the certification data is logged, within the +operator's privacy limits, and only monthly aggregates are published.""" +import gzip +import importlib.util +import json +import re +from datetime import datetime, timezone +from pathlib import Path + +import pytest + +REPO = Path(__file__).resolve().parent.parent +FIX = REPO / "tests" / "fixtures" / "edge-access-logging" + + +def _load(name, file): + spec = importlib.util.spec_from_file_location(name, REPO / "scripts" / file) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod + + +chk = _load("edge_check", "check-edge-access-logging.py") +summ = _load("access_summary", "build-access-summary.py") +NAME = "samaydlette-com-edge-access" +NOW = datetime(2026, 11, 5, 12, tzinfo=timezone.utc) + + +def _j(p): + return json.loads((FIX / p).read_text()) + + +# --- the configuration check -------------------------------------------------------- + +def test_the_allowlist_equals_the_bootstrap_delivery_fields(): + tf = (REPO / "infrastructure" / "bootstrap" / "trust-access-logs.tf").read_text() + block = re.search(r"edge_access_log_fields = \[(.*?)\]", tf, re.S).group(1) + assert tuple(re.findall(r'"([^"]+)"', block)) == chk.ALLOWED_FIELDS + assert "local.edge_access_log_fields" in tf + + +def test_no_identifying_field_is_allowed(): + assert not set(chk.ALLOWED_FIELDS) & set(chk.IDENTIFYING) + + +def test_the_good_configuration_passes(): + assert chk.problems(_j("good-deliveries.json"), _j("delivery-source.json"), NAME) == [] + + +def test_the_known_bad_fixture_fails_for_identifying_fields(capsys): + rc = chk.main(["--deliveries", str(FIX / "known-bad-deliveries.json"), + "--source", str(FIX / "delivery-source.json"), "--name", NAME]) + assert rc == 1 + err = capsys.readouterr().err + assert "c-ip" in err and "cs-uri-query" in err and "cs(User-Agent)" in err + + +def test_no_delivery_fails_the_deploy(tmp_path): + (tmp_path / "d.json").write_text('{"deliveries": []}') + rc = chk.main(["--deliveries", str(tmp_path / "d.json"), "--source", str(tmp_path / "absent.json"), + "--name", NAME]) + assert rc == 1 + + +def test_a_source_that_is_not_the_distribution_fails(): + src = {"deliverySource": {"name": NAME, "logType": "ACCESS_LOGS", "resourceArns": ["arn:aws:s3:::x"]}} + assert any("not a CloudFront" in p for p in chk.problems(_j("good-deliveries.json"), src, NAME)) + + +def test_a_field_outside_the_allowlist_fails_even_if_not_named_identifying(): + d = _j("good-deliveries.json") + d["deliveries"][0]["recordFields"].append("x-edge-request-id") + assert any("outside the privacy allowlist" in p for p in chk.problems(d, _j("delivery-source.json"), NAME)) + + +def test_the_deploy_checks_logging_before_the_sdr_and_publishes_the_summary(): + wf = (REPO / ".github" / "workflows" / "deploy-with-opa.yml").read_text() + step = wf.index("- name: Check edge access logging and build the access summary") + assert step < wf.index("- name: Build Security Decision Record") + body = wf[step:wf.index("\n - name:", step + 10)] + assert "check-edge-access-logging.py" in body and "build-access-summary.py" in body + assert "access-summary.bundle access-summary.json" in wf + + +def test_raw_edge_records_expire_after_90_days(): + tf = (REPO / "infrastructure" / "logging.tf").read_text() + for prefix in ('prefix = "cloudfront/"', 'CloudFront/" }'): + i = tf.index(prefix) + assert "expiration { days = 90 }" in tf[i:i + 200] + + +# --- the summary ---------------------------------------------------------------------- + +def _rec(day, stem, status=200, cc="US", **extra): + return {"date": day, "time": "10:00:00", "cs-uri-stem": stem, "sc-status": str(status), "c-country": cc, **extra} + + +def test_only_trust_paths_are_counted_and_nothing_identifying_survives(): + recs = [_rec("2026-11-02", "/.well-known/ksi-signal.json"), + _rec("2026-11-02", "/trust/index.html", cc="DE"), + _rec("2026-11-03", "/index.html"), + _rec("2026-11-03", "/.well-known/wp-login.php", status=404), + _rec("2026-11-03", "/.well-known/