From 8a6e610760c22a448937dfd17ead95a2e4c58054 Mon Sep 17 00:00:00 2001 From: PQCrypta Date: Sat, 5 Dec 2026 21:33:51 -0600 Subject: [PATCH] feat(release): signed SBOM, signed tag and an independent rebuild; fix(admin): request bodies refuse unknown fields release: each release attaches the binary's CycloneDX 1.5 bill of materials, attested against its digest; replaces Release Please's tag with one signed by gitsign under the release workflow's Sigstore identity; and rebuilds the binary on a fresh runner from the tag, comparing its SHA-256 with the published one. The upload uses gh, not a third-party action. admin: every admin API request body (reload, canary weight, suspend and resume, WAF explain) refuses a field it does not define; a misspelt key is a 422, not a default. ci: zizmor audits the workflows into code scanning, and the CodeQL and zizmor jobs fail on any open alert of their tool on the ref, so a finding blocks the merge on every pull request, release PRs included; a sign-off (DCO) check on every pull request; branch coverage beside line coverage (cargo-llvm-cov on the pinned nightly); concurrency groups; every checkout without persisted credentials; same-repository actions by the self-repository syntax; the composite action's cache pinned and its inputs passed as environment; rustup in place of a toolchain action; each job's permissions explained. dependencies: one workflow, daily, with cargo-deny, cargo-audit of every lockfile, the vendored forks audited as the upstream releases they carry, and the SBOM made on every change; Dependabot waits seven days after a release. licensing: every source file states its copyright and licence in an SPDX header; the Code of Conduct is CC-BY-SA-4.0 in REUSE.toml. docs: GOVERNANCE.md (model, roles, access, granting access, secrets, continuity), CODE_OF_CONDUCT.md (Contributor Covenant 3.0), ROADMAP.md, docs/ASSURANCE-CASE.md (requirements, threat model, trust boundaries, argument, reviews); SECURITY.md sets disclosure dates, support and upgrade terms, the scanning policy and VEX; CONTRIBUTING.md adds the style guides, sign-off, review, dependency policy and small tasks; README adds Upgrading and how to verify the SBOM and the tag; docs/SECURITY.md corrected on secrets, OpenSSL and the Server header. BEGIN_COMMIT_OVERRIDE feat(release): each release attaches a CycloneDX bill of materials attested against its binary, is tagged with a signed tag, and is rebuilt independently to the same bytes fix(admin): every admin API request body refuses fields it does not define END_COMMIT_OVERRIDE Signed-off-by: PQCrypta --- .clusterfuzzlite/Dockerfile | 4 + .clusterfuzzlite/build.sh | 5 + .../actions/setup-openssl-linux/action.yml | 13 +- .github/dependabot.yml | 11 + .github/workflows/cargo-deny.yml | 96 +++++++- .github/workflows/cflite-batch.yml | 6 + .github/workflows/cflite-pr.yml | 6 + .github/workflows/ci.yml | 228 ++++++++++++------ .github/workflows/codeql.yml | 33 ++- .github/workflows/ossf-scorecard.yml | 12 +- .github/workflows/release-please.yml | 153 ++++++++++-- .github/workflows/secret-scan.yml | 7 + .github/workflows/stale.yml | 10 +- CODE_OF_CONDUCT.md | 90 +++++++ CONTRIBUTING.md | 78 +++++- GOVERNANCE.md | 76 ++++++ LICENSES/CC-BY-SA-4.0.txt | 170 +++++++++++++ README.md | 43 +++- REUSE.toml | 7 + ROADMAP.md | 53 ++++ SECURITY.md | 83 +++++-- benchmarks/ab.py | 4 + benchmarks/ack-ab.sh | 5 + benchmarks/backend.py | 5 + benchmarks/bench-backend.sh | 5 + benchmarks/bench-handshake2.sh | 5 + benchmarks/bench-routes.sh | 5 + benchmarks/benchlib.sh | 5 + benchmarks/benchpub.py | 4 + benchmarks/cycles.sh | 5 + benchmarks/export-bench.py | 5 + benchmarks/export-study.py | 5 + benchmarks/hs.py | 4 + benchmarks/instr-ab.sh | 5 + benchmarks/instr.sh | 5 + benchmarks/launch-current.sh | 5 + benchmarks/launch-rerun.sh | 5 + benchmarks/mksec.py | 5 + benchmarks/mw-ab.sh | 5 + benchmarks/mw3-abc.sh | 5 + benchmarks/mw3.sh | 5 + benchmarks/nd-ab.sh | 5 + benchmarks/nd-h1-dist.sh | 5 + benchmarks/onestream.sh | 5 + benchmarks/pagefigs2.py | 5 + benchmarks/queue-window.sh | 5 + benchmarks/repeat.sh | 5 + benchmarks/ressample-lean.py | 5 + benchmarks/ressample.py | 5 + benchmarks/run-bench.sh | 5 + benchmarks/run-handshake.sh | 5 + benchmarks/run-lean.sh | 5 + benchmarks/run-pqc-only.sh | 5 + benchmarks/run-sec.sh | 5 + benchmarks/run_all.sh | 5 + benchmarks/run_matrix60.sh | 5 + benchmarks/smt.sh | 5 + benchmarks/spread-cause.sh | 5 + benchmarks/spread-confirm.sh | 5 + benchmarks/spread-dur.sh | 5 + benchmarks/spread-workers.sh | 5 + benchmarks/stalls.sh | 5 + benchmarks/steal.sh | 5 + benchmarks/tail-h1.sh | 5 + benchmarks/window-study.sh | 5 + build.rs | 4 + docker/Dockerfile | 4 + docs/ASSURANCE-CASE.md | 162 +++++++++++++ docs/SECURE-DESIGN.md | 17 +- docs/SECURITY.md | 16 +- examples/kx-interop.rs | 4 + examples/masque-client.rs | 4 + examples/speedtest-probe.rs | 4 + examples/wq-probe.rs | 4 + examples/wt-sessions.rs | 4 + fuzz/fuzz_targets/client_hello.rs | 4 + fuzz/fuzz_targets/connect_udp_target.rs | 4 + fuzz/fuzz_targets/dns_message.rs | 4 + fuzz/fuzz_targets/fetched_documents.rs | 4 + fuzz/fuzz_targets/moq_control.rs | 4 + fuzz/fuzz_targets/moq_data.rs | 4 + fuzz/fuzz_targets/proxy_header.rs | 4 + fuzz/fuzz_targets/request_body.rs | 4 + fuzz/fuzz_targets/session_ticket.rs | 4 + pentests/config.demo.sh | 5 + pentests/preflight.sh | 5 + pentests/regression/postdeploy_gate.sh | 5 + pentests/regression/regression.py | 5 + pentests/run_all.sh | 5 + pentests/scope_guard.sh | 5 + pentests/scripts/01_waf_bypass.sh | 5 + pentests/scripts/02_bot_detection.sh | 5 + pentests/scripts/03_header_injection.sh | 5 + pentests/scripts/04_rate_limit.sh | 5 + pentests/scripts/05_api_auth.sh | 5 + pentests/scripts/06_tls_ssl.sh | 5 + pentests/scripts/07_advanced_smuggling.sh | 5 + pentests/scripts/08_ssrf.sh | 5 + pentests/scripts/09_cache_poison.sh | 5 + pentests/scripts/10_crypto_api_fuzz.sh | 5 + pentests/scripts/11_timing_oracle.sh | 5 + pentests/scripts/12_waf_evasion_advanced.sh | 5 + pentests/scripts/13_websocket.sh | 5 + pentests/scripts/14_recon.sh | 5 + pentests/scripts/15_auth_session.sh | 5 + pentests/scripts/16_business_logic.sh | 5 + pentests/scripts/17_client_side_csp.sh | 5 + pentests/scripts/18_resilience_chaos.sh | 5 + pentests/scripts/19_auth_hardening.sh | 5 + pentests/scripts/20_authz_access_control.sh | 5 + pentests/scripts/21_supply_chain.sh | 5 + pentests/scripts/22_cloud_infrastructure.sh | 5 + pentests/scripts/23_client_side_js.sh | 5 + pentests/scripts/24_data_privacy.sh | 5 + pentests/scripts/25_container_security.sh | 5 + pentests/scripts/26_cicd_pipeline.sh | 5 + pentests/scripts/27_database_storage.sh | 5 + pentests/scripts/28_ai_llm.sh | 5 + pentests/scripts/29_xxe.sh | 5 + pentests/scripts/30_ssti.sh | 5 + pentests/scripts/31_file_upload.sh | 5 + pentests/scripts/32_grpc_protobuf.sh | 5 + pentests/scripts/compressed-body-decode.py | 5 + pentests/target_integrity_check.sh | 5 + scripts/crs-cases.py | 5 + scripts/delegated-credential-cert.sh | 5 + scripts/deploy.sh | 5 + scripts/detect_bots_from_logs.sh | 5 + scripts/download_geoip.sh | 5 + scripts/ech-rotate.sh | 5 + scripts/ip-update.sh | 5 + scripts/refresh_fingerprint_db.sh | 5 + scripts/setup_fingerprint_db.sh | 5 + scripts/sync_blocklist.sh | 5 + src/access_logger.rs | 4 + src/acme.rs | 4 + src/acme_dns.rs | 4 + src/admin.rs | 14 ++ src/admin_client.rs | 4 + src/audit_logger.rs | 4 + src/backend_client.rs | 4 + src/backend_limits.rs | 4 + src/bin/ech-check.rs | 4 + src/bin/ech-keygen.rs | 4 + src/bin/h3-conformance.rs | 4 + src/bin/h3-get.rs | 4 + src/body_budget.rs | 4 + src/body_pace.rs | 4 + src/bounded.rs | 4 + src/cache.rs | 4 + src/cert_compression.rs | 4 + src/challenge.rs | 4 + src/challenge/challenge.css | 6 + src/challenge/challenge.js | 4 + src/challenge/worker.js | 4 + src/client_hello.rs | 4 + src/compression.rs | 4 + src/config.rs | 4 + src/conformance/assets/bg.css | 6 + src/conformance/assets/bg.js | 4 + src/conformance/assets/cursor.css | 6 + src/conformance/assets/cursor.js | 4 + src/conformance/assets/error-menu.js | 4 + src/conformance/assets/menu.css | 6 + src/conformance/assets/menu.html | 6 + src/conformance/assets/menu.js | 4 + src/conformance/assets/mini-countdown.js | 4 + src/conformance/assets/quantum-countdown.css | 6 + src/conformance/catalog.rs | 4 + src/conformance/conformance.css | 6 + src/conformance/h3_frames.rs | 4 + src/conformance/http.rs | 4 + src/conformance/impairment.rs | 4 + src/conformance/listener.rs | 4 + src/conformance/lsquic_windows.rs | 4 + src/conformance/mod.rs | 4 + src/conformance/oversized_section.rs | 4 + src/conformance/qpack_dynamic.rs | 4 + src/conformance/read_proof.rs | 4 + src/conformance/report.rs | 4 + src/conformance/session.rs | 4 + src/conformance/zero_rtt.rs | 4 + src/conn_limits.rs | 4 + src/connect_ip.rs | 4 + src/connect_udp.rs | 4 + src/crawler_verify.rs | 4 + src/data_file.rs | 4 + src/dns_wire.rs | 4 + src/doh.rs | 4 + src/doq.rs | 4 + src/early_data.rs | 4 + src/ech_config.rs | 4 + src/error_chain.rs | 4 + src/fingerprint.rs | 4 + src/fingerprint_corpus.rs | 4 + src/fuzz_support.rs | 4 + src/fuzzing.rs | 4 + src/health.rs | 4 + src/host_names.rs | 4 + src/http3_features.rs | 4 + src/http_listener/backend_tls.rs | 4 + src/http_listener/cors.rs | 4 + src/http_listener/layers.rs | 4 + src/http_listener/mod.rs | 4 + src/http_listener/passthrough.rs | 4 + src/http_listener/proxy_protocol.rs | 4 + src/http_listener/request_host.rs | 4 + src/http_listener/speedtest_tcp.rs | 4 + src/http_listener/tls_config.rs | 4 + src/http_listener/websocket.rs | 4 + src/inherited.rs | 4 + src/json_strip.rs | 4 + src/lib.rs | 4 + src/load_balancer.rs | 4 + src/log_file.rs | 4 + src/main.rs | 4 + src/memory_pressure.rs | 4 + src/metrics.rs | 4 + src/moq/auth.rs | 4 + src/moq/codec.rs | 4 + src/moq/data.rs | 4 + src/moq/e2e.rs | 4 + src/moq/error.rs | 4 + src/moq/message.rs | 4 + src/moq/mod.rs | 4 + src/moq/relay.rs | 4 + src/moq/session.rs | 4 + src/moq/transport.rs | 4 + src/moq/upstream.rs | 4 + src/moq/version.rs | 4 + src/ocsp.rs | 4 + src/openssl_alloc.rs | 4 + src/otel.rs | 4 + src/path_canon.rs | 4 + src/path_loss.rs | 4 + src/pqc_extended.rs | 4 + src/pqc_policy.rs | 4 + src/pqc_tickets.rs | 4 + src/pqc_tls.rs | 4 + src/provider_kx.rs | 4 + src/proxy.rs | 4 + src/quic_listener/cors.rs | 4 + src/quic_listener/mod.rs | 4 + src/quic_listener/request.rs | 4 + src/quic_listener/websocket.rs | 4 + src/quic_listener/webtransport_quic.rs | 4 + src/rate_limiter.rs | 4 + src/recv_low_water.rs | 4 + src/request_encoding.rs | 4 + src/request_id.rs | 4 + src/request_target.rs | 4 + src/route_gate.rs | 4 + src/secret_source.rs | 4 + src/secure_random.rs | 4 + src/security.rs | 4 + src/service_notify.rs | 4 + src/speedtest.rs | 4 + src/speedtest_budget.rs | 4 + src/speedtest_meter.rs | 4 + src/staged_file.rs | 4 + src/startup_verify.rs | 4 + src/telemetry.rs | 4 + src/test_certificate.rs | 4 + src/tls.rs | 4 + src/tls_acceptor.rs | 4 + src/traffic_shape.rs | 4 + src/waf.rs | 4 + src/waf_crs.rs | 4 + src/webtransport_server.rs | 4 + src/ws_tunnel.rs | 4 + src/wt_flow.rs | 4 + src/wt_quic.rs | 4 + src/wt_session.rs | 4 + tests/ack_frequency.rs | 4 + tests/acme_dns_update.rs | 4 + tests/compression_and_h3_parity.rs | 4 + tests/crs_regression.rs | 4 + tests/docs.rs | 4 + tests/early_hints_h2.rs | 4 + tests/h3_grease_placement.rs | 4 + tests/integration.rs | 4 + tests/mldsa_certificate.rs | 4 + tests/openssl_alloc.rs | 4 + tests/unit_config.rs | 4 + 284 files changed, 2365 insertions(+), 169 deletions(-) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 GOVERNANCE.md create mode 100644 LICENSES/CC-BY-SA-4.0.txt create mode 100644 ROADMAP.md create mode 100644 docs/ASSURANCE-CASE.md diff --git a/.clusterfuzzlite/Dockerfile b/.clusterfuzzlite/Dockerfile index b21996d3..5ae2a611 100644 --- a/.clusterfuzzlite/Dockerfile +++ b/.clusterfuzzlite/Dockerfile @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025-2026 PQCrypta +# +# SPDX-License-Identifier: MIT OR Apache-2.0 + # OSS-Fuzz's Rust builder (nightly and cargo-fuzz), pinned by digest FROM gcr.io/oss-fuzz-base/base-builder-rust@sha256:99ce521d18330119973205ac941a46f3aa5a1b13eb41d193127d1a1321e95c84 COPY . $SRC/pqcrypta-proxy diff --git a/.clusterfuzzlite/build.sh b/.clusterfuzzlite/build.sh index e48e0d3e..0a8b8789 100755 --- a/.clusterfuzzlite/build.sh +++ b/.clusterfuzzlite/build.sh @@ -1,4 +1,9 @@ #!/bin/bash -eu + +# SPDX-FileCopyrightText: 2025-2026 PQCrypta +# +# SPDX-License-Identifier: MIT OR Apache-2.0 + # Every target in fuzz/, built with the sanitizer ClusterFuzzLite asks for, # each with its seeds (fuzz/seeds//) as its starting corpus cd "$SRC/pqcrypta-proxy/fuzz" diff --git a/.github/actions/setup-openssl-linux/action.yml b/.github/actions/setup-openssl-linux/action.yml index d36d19a6..ac1ba12b 100644 --- a/.github/actions/setup-openssl-linux/action.yml +++ b/.github/actions/setup-openssl-linux/action.yml @@ -20,7 +20,7 @@ runs: steps: - name: Cache OpenSSL ${{ inputs.version }} id: cache - uses: actions/cache@v4 + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ~/openssl-${{ inputs.version }} key: openssl-${{ inputs.version }}-${{ inputs.sha256 }}-${{ runner.os }}-${{ runner.arch }}-v2 @@ -43,15 +43,18 @@ runs: - name: Build OpenSSL ${{ inputs.version }} (cache miss) if: steps.cache.outputs.cache-hit != 'true' shell: bash + # The inputs reach the script as its environment, never as its text + env: + V: ${{ inputs.version }} + SHA256: ${{ inputs.sha256 }} run: | set -euxo pipefail - V="${{ inputs.version }}" sudo apt-get update -qq sudo apt-get install -y --no-install-recommends zlib1g-dev libbrotli-dev libzstd-dev cd "$(mktemp -d)" curl -fsSL "https://github.com/openssl/openssl/releases/download/openssl-${V}/openssl-${V}.tar.gz" -o openssl.tar.gz # Checked before it is built: what it holds is linked into the release binary - echo "${{ inputs.sha256 }} openssl.tar.gz" | sha256sum -c - + echo "${SHA256} openssl.tar.gz" | sha256sum -c - tar xf openssl.tar.gz cd "openssl-${V}" # The configuration directory is the distribution's, where a downloaded @@ -66,8 +69,10 @@ runs: - name: Export OpenSSL environment shell: bash + env: + V: ${{ inputs.version }} run: | - P="$HOME/openssl-${{ inputs.version }}" + P="$HOME/openssl-${V}" { echo "OPENSSL_DIR=$P" echo "OPENSSL_LIB_DIR=$P/lib" diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5cece8b5..4ac35071 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,15 @@ version: 2 +# A release is taken a week after it is published, not the day it appears: +# a compromised version is usually caught and pulled within days, and a +# regression reported by its first users. Security updates are not delayed. updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" day: "monday" + cooldown: + default-days: 7 commit-message: prefix: "ci" groups: @@ -20,6 +25,8 @@ updates: schedule: interval: "weekly" day: "monday" + cooldown: + default-days: 7 commit-message: prefix: "chore" ignore: @@ -36,8 +43,12 @@ updates: directory: "/fuzz" schedule: interval: "weekly" + cooldown: + default-days: 7 - package-ecosystem: "docker" directory: "/.clusterfuzzlite" schedule: interval: "weekly" + cooldown: + default-days: 7 diff --git a/.github/workflows/cargo-deny.yml b/.github/workflows/cargo-deny.yml index 447cf21b..29b5aa83 100644 --- a/.github/workflows/cargo-deny.yml +++ b/.github/workflows/cargo-deny.yml @@ -1,17 +1,28 @@ -name: Cargo Deny +name: Dependencies +# Every dependency, the vendored forks included, against RustSec's advisories, +# the licence policy and the allowed sources: on each change, and every day, +# since an advisory is published whether or not anything here changes. Any +# finding fails the run (SECURITY.md, "Dependency and code scanning"). on: push: branches: [main, develop] pull_request: branches: [main] schedule: - - cron: '0 3 * * 2' # Tuesday 03:00 UTC + - cron: '0 3 * * *' # 03:00 UTC daily + workflow_dispatch: # Read only unless a job asks for more permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: deny: name: ${{ matrix.checks }} @@ -22,16 +33,83 @@ jobs: checks: - advisories - bans licenses sources + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - # F-04: All checks are hard failures. Known-safe advisory exceptions are - # documented in deny.toml [advisories].ignore with rationale and are - # reviewed before each release. Setting continue-on-error = false ensures - # newly-published CVEs against our TLS/crypto dependencies block CI. - continue-on-error: false + - uses: EmbarkStudios/cargo-deny-action@bb119f768ea239e765aeaef5769558d4f21213aa # v2.1.5 + with: + command: check ${{ matrix.checks }} + # Every lockfile, the vendored forks' too (their standalone tests build from + # them; cargo-deny reads the proxy's alone), and warnings (unsound, + # unmaintained, yanked) as failures + audit: + name: cargo audit, each lockfile + runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11 + with: + tool: cargo-audit + - name: cargo audit, each lockfile + run: | + status=0 + while IFS= read -r lock; do + echo "::group::$lock" + cargo audit --deny warnings --file "$lock" || status=1 + echo "::endgroup::" + done < <(find . -name Cargo.lock -not -path './target/*' | sort) + exit $status - - uses: EmbarkStudios/cargo-deny-action@81891abc19297b21343b15ef67dc61e4aea74fda # v2 + # The forks under vendor/ are path dependencies, which an audit of a + # lockfile passes over: it matches advisories to crates.io packages. Each + # fork is audited here as the upstream crate and version it carries, so an + # advisory against that release fails the run until the fork takes the fix + # (or VENDORED.md and an OpenVEX statement in .vex/ say why it does not + # apply). Yanked status is the upstream release's, not the fork's. + vendored: + name: cargo audit, vendored forks as their upstream releases + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - command: check ${{ matrix.checks }} + persist-credentials: false + - uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11 + with: + tool: cargo-audit + - name: The forks, as crates.io packages + run: | + { + printf 'version = 4\n\n' + cargo metadata --format-version 1 --locked | + jq -r '.packages[] | select(.manifest_path | test("/vendor/")) + | "[[package]]\nname = \"\(.name)\"\nversion = \"\(.version)\"\nsource = \"registry+https://github.com/rust-lang/crates.io-index\"\n"' + } > "$RUNNER_TEMP/vendored.lock" + grep -c '^\[\[package\]\]' "$RUNNER_TEMP/vendored.lock" + cargo audit --deny warnings --no-yanked --file "$RUNNER_TEMP/vendored.lock" + + # The software bill of materials the release attaches, made on every change + # so the release step's command is known to work before a release needs it + sbom: + name: SBOM (CycloneDX) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11 + with: + tool: cargo-cyclonedx + - name: Bill of materials + run: | + cargo cyclonedx --format json --spec-version 1.5 --override-filename pqcrypta-proxy.cdx + jq -e '.components | length > 0' pqcrypta-proxy.cdx.json + jq -r '"\(.components | length) components, CycloneDX \(.specVersion)"' pqcrypta-proxy.cdx.json + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 + with: + name: sbom + path: pqcrypta-proxy.cdx.json diff --git a/.github/workflows/cflite-batch.yml b/.github/workflows/cflite-batch.yml index c4cc1ed7..dce21363 100644 --- a/.github/workflows/cflite-batch.yml +++ b/.github/workflows/cflite-batch.yml @@ -10,6 +10,12 @@ on: permissions: contents: read +# One run per workflow and ref at a time; a later one waits rather than +# cancelling it: a release is never cut short +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: fuzz: name: Fuzz (${{ matrix.sanitizer }}) diff --git a/.github/workflows/cflite-pr.yml b/.github/workflows/cflite-pr.yml index f37697b2..a631d7bb 100644 --- a/.github/workflows/cflite-pr.yml +++ b/.github/workflows/cflite-pr.yml @@ -18,6 +18,12 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: fuzz: name: Fuzz (${{ matrix.sanitizer }}) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76d45813..98847864 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,12 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + env: CARGO_TERM_COLOR: always RUST_BACKTRACE: 1 @@ -26,10 +32,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" - components: rustfmt + persist-credentials: false + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install # Scoped to this crate rather than --all. There is no [workspace] section, # so the vendored forks under vendor/ (noq, h3-noq, wtransport) are picked # up as implicit members, and --all was checking their upstream source @@ -43,10 +49,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" - components: clippy + persist-credentials: false + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 - run: cargo clippy --all-targets --all-features -- -D warnings @@ -61,14 +67,16 @@ jobs: features: ["", pqc, pqc-signatures, metrics, admin-api, acme, geoip, legacy-pqc] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" - components: clippy + persist-credentials: false + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: key: features-${{ matrix.features }} - - run: cargo clippy --all-targets --no-default-features --features "${{ matrix.features }}" -- -D warnings + - env: + FEATURES: ${{ matrix.features }} + run: cargo clippy --all-targets --no-default-features --features "$FEATURES" -- -D warnings # ============================================================================= # Build and Test Matrix @@ -90,11 +98,17 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" - targets: ${{ matrix.target }} + persist-credentials: false + + # bash on every runner, Windows' included, where the default is PowerShell + - name: Rust toolchain, as rust-toolchain.toml pins it, and the target + shell: bash + env: + TARGET: ${{ matrix.target }} + run: | + rustup toolchain install + rustup target add "$TARGET" - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -102,7 +116,7 @@ jobs: - name: Setup OpenSSL (Linux) if: matrix.os == 'ubuntu-latest' - uses: ./.github/actions/setup-openssl-linux + uses: $/.github/actions/setup-openssl-linux # Install OpenSSL on Windows using vcpkg for reliable paths - name: Install OpenSSL (Windows) @@ -123,7 +137,10 @@ jobs: echo "OPENSSL_INCLUDE_DIR=$OPENSSL_PREFIX/include" >> $GITHUB_ENV - name: Build - run: cargo build --release --target ${{ matrix.target }} + shell: bash + env: + TARGET: ${{ matrix.target }} + run: cargo build --release --target "$TARGET" - name: Upload artifact uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 @@ -145,10 +162,11 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -165,7 +183,7 @@ jobs: - name: Setup OpenSSL (Linux) if: matrix.os == 'ubuntu-latest' - uses: ./.github/actions/setup-openssl-linux + uses: $/.github/actions/setup-openssl-linux # The distributed rate limiter's tests start a redis-server of their own - name: Install Redis (Linux) @@ -195,10 +213,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -221,10 +240,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -243,10 +263,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -285,10 +306,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -307,10 +329,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -329,10 +352,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -356,10 +380,11 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 - name: Generate test certificates @@ -407,7 +432,7 @@ jobs: # AFTER cert generation so the system openssl CLI above is not perturbed by # LD_LIBRARY_PATH pointing at the freshly-built libs. - name: Setup OpenSSL (Linux) - uses: ./.github/actions/setup-openssl-linux + uses: $/.github/actions/setup-openssl-linux # Run integration tests - name: Run integration tests @@ -442,30 +467,6 @@ jobs: # Cleanup kill $PROXY_PID 2>/dev/null || true - # ============================================================================= - # Security Audit - # ============================================================================= - # Every lockfile, the vendored forks' too (their standalone tests build from - # them; cargo-deny reads the proxy's alone), and warnings (unsound, - # unmaintained, yanked) as failures - security: - name: Security Audit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11 - with: - tool: cargo-audit - - name: cargo audit, each lockfile - run: | - status=0 - while IFS= read -r lock; do - echo "::group::$lock" - cargo audit --deny warnings --file "$lock" || status=1 - echo "::endgroup::" - done < <(find . -name Cargo.lock -not -path './target/*' | sort) - exit $status - # ============================================================================= # Docker Build # ============================================================================= @@ -476,6 +477,8 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Docker Buildx uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 @@ -492,23 +495,91 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max + # ============================================================================= + # Sign-off + # ============================================================================= + # Each commit a pull request brings is signed off by its author: the + # Developer Certificate of Origin (CONTRIBUTING.md#sign-off). Bots' commits + # (Release Please, Dependabot) are the project's own tooling. + dco: + name: Sign-off (DCO) + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Every commit signed off by its author + env: + BASE: ${{ github.event.pull_request.base.sha }} + HEAD: ${{ github.event.pull_request.head.sha }} + run: | + status=0 + while read -r sha; do + email=$(git log -1 --format=%ae "$sha") + case "$email" in *'[bot]@users.noreply.github.com') continue ;; esac + name=$(git log -1 --format=%an "$sha") + if ! git log -1 --format=%B "$sha" | grep -qiF "Signed-off-by: $name <$email>"; then + echo "::error::$sha has no 'Signed-off-by: $name <$email>' (git commit -s)" + status=1 + fi + done < <(git rev-list "$BASE..$HEAD") + exit $status + + # ============================================================================= + # Workflow security + # ============================================================================= + # zizmor reads every workflow, action and the Dependabot configuration for + # injection, credential persistence, unpinned or excessive use, and reports + # to code scanning, where a new finding fails the pull request as CodeQL's do + zizmor: + name: Workflow audit (zizmor) + runs-on: ubuntu-latest + permissions: + contents: read # read the workflows + security-events: write # upload the findings to code scanning, and read them back + actions: read # read this run, which the upload refers to + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: zizmorcore/zizmor-action@1b4550e929643b8b26a62303c6bd64814271a4f1 # v0.9.2 + with: + version: "1.33.1" + persona: pedantic + # An open zizmor alert on this ref fails the job, as CodeQL's do + - name: No open zizmor alert on this ref + env: + GH_TOKEN: ${{ github.token }} + run: | + open=$(gh api --paginate "repos/$GITHUB_REPOSITORY/code-scanning/alerts?ref=$GITHUB_REF&state=open&tool_name=zizmor&per_page=100" --jq '.[] | "\(.number) \(.rule.id) \(.most_recent_instance.location.path):\(.most_recent_instance.location.start_line)"') + if [ -n "$open" ]; then + printf '::error::open zizmor alerts on %s:\n%s\n' "$GITHUB_REF" "$open" + exit 1 + fi + # ============================================================================= # Coverage # ============================================================================= # The Linux test run again, under LLVM's source-based coverage of the # proxy's own code (the forks under vendor/ have their jobs above): each - # file's lines, regions and functions, and the totals, go to the run's - # summary, and the lcov report is kept with the run. + # file's lines, regions, functions and branches, and the totals, go to the + # run's summary, and the lcov report is kept with the run. coverage: name: Coverage runs-on: ubuntu-latest + # Branch coverage is instrumented by nightly rustc alone: the nightly the + # fuzz builds use, the one other toolchain the proxy is built with + env: + NIGHTLY: nightly-2026-10-02 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" - components: llvm-tools-preview + persist-credentials: false + + - name: Nightly toolchain with LLVM's tools + run: rustup toolchain install "$NIGHTLY" --profile minimal --component llvm-tools-preview - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 with: @@ -519,7 +590,7 @@ jobs: tool: cargo-llvm-cov - name: Setup OpenSSL (Linux) - uses: ./.github/actions/setup-openssl-linux + uses: $/.github/actions/setup-openssl-linux - name: Install Redis run: | @@ -530,7 +601,7 @@ jobs: - name: Tests under coverage env: PQCRYPTA_REQUIRE_REDIS: "1" - run: cargo llvm-cov --all-features --ignore-filename-regex '(^|/)vendor/' --lcov --output-path lcov.info + run: cargo "+$NIGHTLY" llvm-cov --branch --all-features --ignore-filename-regex '(^|/)vendor/' --lcov --output-path lcov.info - name: Summary run: | @@ -538,7 +609,7 @@ jobs: echo '## Coverage of the proxy'"'"'s own code' echo echo '```' - cargo llvm-cov report --summary-only --ignore-filename-regex '(^|/)vendor/' + cargo "+$NIGHTLY" llvm-cov report --branch --summary-only --ignore-filename-regex '(^|/)vendor/' echo '```' } >> "$GITHUB_STEP_SUMMARY" @@ -556,6 +627,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: fsfe/reuse-action@676e2d560c9a403aa252096d99fcab3e1132b0f5 # v6.0.0 # ============================================================================= @@ -566,9 +639,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2 - name: Generate docs run: cargo doc --no-deps --all-features diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index d1d12e63..23f70833 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,21 +15,28 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: analyze: name: Analyze (Rust) runs-on: ubuntu-latest permissions: - security-events: write - contents: read - actions: read + security-events: write # upload CodeQL's results to code scanning + contents: read # check out the code + actions: read # read this run, which the upload refers to steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names with: - toolchain: "1.99.0" + persist-credentials: false + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - name: Install OpenSSL run: sudo apt-get update && sudo apt-get install -y libssl-dev pkg-config @@ -44,3 +51,17 @@ jobs: - uses: github/codeql-action/analyze@915412ff23e8b7659517e607487dbeae018f2934 # v4 with: category: /language:rust + + # The analysis is uploaded and processed by now (analyze waits for it): + # an open CodeQL alert on this ref, of any severity, fails the job, so a + # change with one does not merge (SECURITY.md, "Dependency and code + # scanning") + - name: No open CodeQL alert on this ref + env: + GH_TOKEN: ${{ github.token }} + run: | + open=$(gh api --paginate "repos/$GITHUB_REPOSITORY/code-scanning/alerts?ref=$GITHUB_REF&state=open&tool_name=CodeQL&per_page=100" --jq '.[] | "\(.number) \(.rule.id) \(.most_recent_instance.location.path):\(.most_recent_instance.location.start_line)"') + if [ -n "$open" ]; then + printf '::error::open CodeQL alerts on %s:\n%s\n' "$GITHUB_REF" "$open" + exit 1 + fi diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index da026e33..30b2b6b4 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -10,14 +10,20 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: scorecard: name: Scorecard runs-on: ubuntu-latest permissions: - security-events: write - contents: read - id-token: write + security-events: write # upload the results to code scanning + contents: read # read the repository + id-token: write # sign the results it publishes to the OpenSSF API steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e8f14deb..32189cbe 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -17,6 +17,12 @@ on: permissions: contents: read +# One run per workflow and ref at a time; a later one waits rather than +# cancelling it: a release is never cut short +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: release-please: name: Release Please @@ -24,8 +30,8 @@ jobs: runs-on: ubuntu-latest # The release pull request, and the tag and draft release it makes permissions: - contents: write - pull-requests: write + contents: write # create the release and its tag + pull-requests: write # open and update the release PR outputs: release_created: ${{ steps.release.outputs.release_created }} tag_name: ${{ steps.release.outputs.tag_name }} @@ -58,7 +64,7 @@ jobs: if: needs.release-please.outputs.prs_created == 'true' runs-on: ubuntu-latest permissions: - actions: write + actions: write # start CI and CodeQL on the release branch steps: - name: Start them on the release branch env: @@ -79,22 +85,22 @@ jobs: # Fulcio issues a short-lived certificate for this workflow's OIDC # identity, and the signature goes into its public transparency log. permissions: - contents: write - id-token: write - attestations: write + contents: write # upload to the draft release and publish it + id-token: write # the Sigstore identity the attestations are signed with + attestations: write # store the provenance and SBOM attestations env: TAG: ${{ needs.release-please.outputs.tag_name || inputs.tag }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false ref: ${{ env.TAG }} - - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # the toolchain rust-toolchain.toml names - with: - toolchain: "1.99.0" + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install - name: Setup OpenSSL (Linux) - uses: ./.github/actions/setup-openssl-linux + uses: $/.github/actions/setup-openssl-linux - name: Build release binary env: @@ -126,15 +132,35 @@ jobs: jq -c -f .github/dsse-envelope.jq "$BUNDLE" > target/release/pqcrypta-proxy.intoto.jsonl test "$(wc -l < target/release/pqcrypta-proxy.intoto.jsonl)" -eq 1 - - name: Upload binary to the draft release - uses: softprops/action-gh-release@8a0cd651e5b2365bd640854a3fa5dfc70e4875f3 # v3 + # The binary's software bill of materials: every crate it was built + # from, with its version, licence and checksum, as CycloneDX JSON for + # the features the release builds; attested against the binary's digest + # like its provenance, so it is the list for this binary and no other + - uses: taiki-e/install-action@073e1fd0bc889c9aee68dbaaa927cde1b5653a83 # v2.90.11 + with: + tool: cargo-cyclonedx + + - name: Software bill of materials + run: | + cargo cyclonedx --format json --spec-version 1.5 --override-filename pqcrypta-proxy.cdx + mv pqcrypta-proxy.cdx.json target/release/pqcrypta-proxy.cdx.json + jq -e '.components | length > 0' target/release/pqcrypta-proxy.cdx.json + + - name: Sign the bill of materials against the binary + uses: actions/attest-sbom@c604332985a26aa8cf1bdc465b92731239ec6b9e # v4.1.0 with: - tag_name: ${{ env.TAG }} - draft: true - files: | - target/release/pqcrypta-proxy - target/release/pqcrypta-proxy.sigstore.json - target/release/pqcrypta-proxy.intoto.jsonl + subject-path: target/release/pqcrypta-proxy + sbom-path: target/release/pqcrypta-proxy.cdx.json + + - name: Upload the binary, its provenance and its SBOM to the draft release + env: + GH_TOKEN: ${{ github.token }} + run: >- + gh release upload "$TAG" --clobber + target/release/pqcrypta-proxy + target/release/pqcrypta-proxy.sigstore.json + target/release/pqcrypta-proxy.intoto.jsonl + target/release/pqcrypta-proxy.cdx.json - name: Publish the release env: @@ -151,16 +177,17 @@ jobs: if: always() && (needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch') runs-on: ubuntu-latest permissions: - contents: read - packages: write - id-token: write - attestations: write + contents: read # check out the tagged commit + packages: write # push the image to ghcr.io + id-token: write # the Sigstore identity the attestation is signed with + attestations: write # store the image's provenance attestation env: TAG: ${{ needs.release-please.outputs.tag_name || inputs.tag }} IMAGE: ghcr.io/pqcrypta/pqcrypta-proxy steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false ref: ${{ env.TAG }} - name: Build the image @@ -198,3 +225,85 @@ jobs: subject-name: ${{ env.IMAGE }} subject-digest: ${{ steps.push.outputs.digest }} push-to-registry: true + + # The release's tag, signed: Release Please creates it unsigned through the + # API, and this replaces it with an annotated tag on the same commit, signed + # by gitsign with this workflow's Sigstore identity, the identity that signs + # the provenance. `gitsign verify-tag` checks it (README, "Release binary"). + tag: + name: Signed tag + needs: [release-please, binary] + if: needs.release-please.outputs.release_created == 'true' + runs-on: ubuntu-latest + permissions: + contents: write # replace the release's tag with the signed one + id-token: write # the Sigstore identity gitsign signs with + env: + TAG: ${{ needs.release-please.outputs.tag_name }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + + - uses: chainguard-dev/actions/setup-gitsign@c66754a60e304cf975e46082140547262fbe76f4 # v1.8.4 + + - name: Sign the tag, verify it, push it + env: + GH_TOKEN: ${{ github.token }} + run: | + commit=$(git rev-list -n 1 "$TAG") + git tag --force --sign --message "pqcrypta-proxy $TAG" "$TAG" "$commit" + gitsign verify-tag \ + --certificate-identity "https://github.com/$GITHUB_REPOSITORY/.github/workflows/release-please.yml@refs/heads/main" \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com \ + "$TAG" + git push --force "https://x-access-token:${GH_TOKEN}@github.com/$GITHUB_REPOSITORY.git" "refs/tags/$TAG" + + # The release rebuilt on a fresh runner from the tag alone, and its digest + # compared with the binary the release published: a build anyone with the + # tag and the toolchain it pins makes bit for bit, not one only this run + # could have made + rebuild: + name: Rebuilt independently, compared + needs: [release-please, binary] + if: always() && needs.binary.result == 'success' + runs-on: ubuntu-latest + permissions: + contents: read # check out the tag and download the release + env: + TAG: ${{ needs.release-please.outputs.tag_name || inputs.tag }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + ref: ${{ env.TAG }} + + - name: Rust toolchain, as rust-toolchain.toml pins it + run: rustup toolchain install + + - name: Setup OpenSSL (Linux) + uses: $/.github/actions/setup-openssl-linux + + - name: Build release binary, as the release did + env: + OPENSSL_STATIC: "1" + OPENSSL_LIBS: "ssl:crypto:brotlienc:brotlidec:brotlicommon:zstd:z" + run: cargo build --release --locked + + - name: The same bytes as the published binary + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern pqcrypta-proxy --dir "$RUNNER_TEMP/published" + published=$(sha256sum "$RUNNER_TEMP/published/pqcrypta-proxy" | cut -d' ' -f1) + rebuilt=$(sha256sum target/release/pqcrypta-proxy | cut -d' ' -f1) + { + echo "## Reproducible build of $TAG" + echo + echo "| Binary | SHA-256 |" + echo "|--------|---------|" + echo "| Published | \`$published\` |" + echo "| Rebuilt here | \`$rebuilt\` |" + } >> "$GITHUB_STEP_SUMMARY" + test "$published" = "$rebuilt" diff --git a/.github/workflows/secret-scan.yml b/.github/workflows/secret-scan.yml index 9e1e0ca8..86ccdfc1 100644 --- a/.github/workflows/secret-scan.yml +++ b/.github/workflows/secret-scan.yml @@ -12,6 +12,12 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: trufflehog: name: TruffleHog @@ -22,6 +28,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + persist-credentials: false fetch-depth: 0 - name: TruffleHog (pull_request) diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index e0b93e4f..ca500150 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -9,13 +9,19 @@ on: permissions: contents: read +# One run per workflow and ref: a newer push to a pull request cancels the run +# it supersedes; on main every run completes +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + jobs: stale: name: Mark stale issues and PRs runs-on: ubuntu-latest permissions: - issues: write - pull-requests: write + issues: write # label and close stale issues + pull-requests: write # label and close stale pull requests steps: - uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..be3ae426 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,90 @@ +# Contributor Covenant 3.0 Code of Conduct + +## Our Pledge + +We pledge to make our community welcoming, safe, and equitable for all. + +We are committed to fostering an environment that respects and promotes the dignity, rights, and contributions of all individuals, regardless of characteristics including race, ethnicity, caste, color, age, physical characteristics, neurodiversity, disability, sex or gender, gender identity or expression, sexual orientation, language, philosophy or religion, national or social origin, socio-economic position, level of education, or other status. The same privileges of participation are extended to everyone who participates in good faith and in accordance with this Covenant. + + +## Encouraged Behaviors + +While acknowledging differences in social norms, we all strive to meet our community's expectations for positive behavior. We also understand that our words and actions may be interpreted differently than we intend based on culture, background, or native language. + +With these considerations in mind, we agree to behave mindfully toward each other and act in ways that center our shared values, including: + +1. Respecting the **purpose of our community**, our activities, and our ways of gathering. +2. Engaging **kindly and honestly** with others. +3. Respecting **different viewpoints** and experiences. +4. **Taking responsibility** for our actions and contributions. +5. Gracefully giving and accepting **constructive feedback**. +6. Committing to **repairing harm** when it occurs. +7. Behaving in other ways that promote and sustain the **well-being of our community**. + + +## Restricted Behaviors + +We agree to restrict the following behaviors in our community. Instances, threats, and promotion of these behaviors are violations of this Code of Conduct. + +1. **Harassment.** Violating explicitly expressed boundaries or engaging in unnecessary personal attention after any clear request to stop. +2. **Character attacks.** Making insulting, demeaning, or pejorative comments directed at a community member or group of people. +3. **Stereotyping or discrimination.** Characterizing anyone’s personality or behavior on the basis of immutable identities or traits. +4. **Sexualization.** Behaving in a way that would generally be considered inappropriately intimate in the context or purpose of the community. +5. **Violating confidentiality**. Sharing or acting on someone's personal or private information without their permission. +6. **Endangerment.** Causing, encouraging, or threatening violence or other harm toward any person or group. +7. Behaving in other ways that **threaten the well-being** of our community. + +### Other Restrictions + +1. **Misleading identity.** Impersonating someone else for any reason, or pretending to be someone else to evade enforcement actions. +2. **Failing to credit sources.** Not properly crediting the sources of content you contribute. +3. **Promotional materials**. Sharing marketing or other commercial content in a way that is outside the norms of the community. +4. **Irresponsible communication.** Failing to responsibly present content which includes, links or describes any other restricted behaviors. + + +## Reporting an Issue + +Tensions can occur between community members even when they are trying their best to collaborate. Not every conflict represents a code of conduct violation, and this Code of Conduct reinforces encouraged behaviors and norms that can help avoid conflicts and minimize harm. + +When an incident does occur, it is important to report it promptly. To report a possible violation, email **contact@pqcrypta.com**, or use GitHub's "Report content" on the comment, issue or pull request. The maintainer handles reports and keeps the reporter's identity and the details confidential; a report about the maintainer goes to GitHub's own [reporting](https://docs.github.com/en/communities/maintaining-your-safety-on-github/reporting-abuse-or-spam) instead. A report is acknowledged within three days. + +Community Moderators take reports of violations seriously and will make every effort to respond in a timely manner. They will investigate all reports of code of conduct violations, reviewing messages, logs, and recordings, or interviewing witnesses and other participants. Community Moderators will keep investigation and enforcement actions as transparent as possible while prioritizing safety and confidentiality. In order to honor these values, enforcement actions are carried out in private with the involved parties, but communicating to the whole community may be part of a mutually agreed upon resolution. + + +## Addressing and Repairing Harm + + +If an investigation by the Community Moderators finds that this Code of Conduct has been violated, the following enforcement ladder may be used to determine how best to repair harm, based on the incident's impact on the individuals involved and the community as a whole. Depending on the severity of a violation, lower rungs on the ladder may be skipped. + +1) Warning + 1) Event: A violation involving a single incident or series of incidents. + 2) Consequence: A private, written warning from the Community Moderators. + 3) Repair: Examples of repair include a private written apology, acknowledgement of responsibility, and seeking clarification on expectations. +2) Temporarily Limited Activities + 1) Event: A repeated incidence of a violation that previously resulted in a warning, or the first incidence of a more serious violation. + 2) Consequence: A private, written warning with a time-limited cooldown period designed to underscore the seriousness of the situation and give the community members involved time to process the incident. The cooldown period may be limited to particular communication channels or interactions with particular community members. + 3) Repair: Examples of repair may include making an apology, using the cooldown period to reflect on actions and impact, and being thoughtful about re-entering community spaces after the period is over. +3) Temporary Suspension + 1) Event: A pattern of repeated violation which the Community Moderators have tried to address with warnings, or a single serious violation. + 2) Consequence: A private written warning with conditions for return from suspension. In general, temporary suspensions give the person being suspended time to reflect upon their behavior and possible corrective actions. + 3) Repair: Examples of repair include respecting the spirit of the suspension, meeting the specified conditions for return, and being thoughtful about how to reintegrate with the community when the suspension is lifted. +4) Permanent Ban + 1) Event: A pattern of repeated code of conduct violations that other steps on the ladder have failed to resolve, or a violation so serious that the Community Moderators determine there is no way to keep the community safe with this person as a member. + 2) Consequence: Access to all community spaces, tools, and communication channels is removed. In general, permanent bans should be rarely used, should have strong reasoning behind them, and should only be resorted to if working through other remedies has failed to change the behavior. + 3) Repair: There is no possible repair in cases of this severity. + +This enforcement ladder is intended as a guideline. It does not limit the ability of Community Managers to use their discretion and judgment, in keeping with the best interests of our community. + + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public or other spaces. Examples of representing our community include using an official email address, posting via an official social media account, or acting as an appointed representative at an online or offline event. + + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 3.0, permanently available at [https://www.contributor-covenant.org/version/3/0/](https://www.contributor-covenant.org/version/3/0/). + +Contributor Covenant is stewarded by the Organization for Ethical Source and licensed under CC BY-SA 4.0. To view a copy of this license, visit [https://creativecommons.org/licenses/by-sa/4.0/](https://creativecommons.org/licenses/by-sa/4.0/) + +For answers to common questions about Contributor Covenant, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are provided at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations). Additional enforcement and community guideline resources can be found at [https://www.contributor-covenant.org/resources](https://www.contributor-covenant.org/resources). The enforcement ladder was inspired by the work of [Mozilla’s code of conduct team](https://github.com/mozilla/inclusion). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb9e79a7..0948d703 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,8 +17,16 @@ is made and reviewed, and what a change must meet to be merged. ## Code of conduct -This project follows the -[Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct). +Everyone taking part follows the [Code of Conduct](CODE_OF_CONDUCT.md) +(Contributor Covenant 3.0). How the project is run, and who decides, is in +[GOVERNANCE.md](GOVERNANCE.md); where it is going, in [ROADMAP.md](ROADMAP.md). + +## Small tasks to start with + +Issues labelled +[good first issue](https://github.com/PQCrypta/pqcrypta-proxy/labels/good%20first%20issue) +are scoped for someone new to the code: each names the files involved and +what done looks like. Comment on one to take it. ## Building and testing @@ -43,10 +51,15 @@ The distributed rate limiter's tests start a `redis-server` of their own when one is installed, and are skipped when it is not (`PQCRYPTA_REQUIRE_REDIS=1` makes a missing one a failure, as in CI). +CI runs the whole suite on every push and pull request, on Linux and macOS, +and measures coverage of it; ClusterFuzzLite runs the fuzz targets a change +reaches, and each one for an hour a day. + ## Making a change 1. Fork the repository and branch from `main`. -2. Make the change, with its tests and documentation (below). +2. Make the change, with its tests and documentation (below), and sign off + each commit (below). 3. Run what CI runs: ```bash cargo fmt -p pqcrypta-proxy -- --check @@ -54,8 +67,18 @@ when one is installed, and are skipped when it is not cargo test --all-features ``` 4. Open a pull request against `main`. Describe what changes and why, and - link the issue it addresses. A maintainer reviews it, and it merges once - every check below passes. + link the issue it addresses. A maintainer reviews it (below), and it + merges once every check below passes. + +### Sign-off + +Every commit is signed off: a `Signed-off-by: Name ` line, which +`git commit -s` adds, certifying the +[Developer Certificate of Origin](https://developercertificate.org/), that +you wrote the change or otherwise have the right to submit it under the +project's licence. CI refuses a pull request with a commit not signed off by +its author, and GitHub requires the sign-off on commits made in its web +editor. ### Commit messages @@ -103,6 +126,11 @@ that touch the code it reaches, and for an hour each day. ### Code +The style guides are the [Rust Style Guide](https://doc.rust-lang.org/style-guide/) +as rustfmt applies it, the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/), +and Clippy's lints; for GitHub Actions workflows, zizmor's. CI enforces +each of them. + - rustfmt, and clippy with `all`, `pedantic` and `nursery` at warning level, every warning an error in CI ([`Cargo.toml`](Cargo.toml) `[lints]`, [`clippy.toml`](clippy.toml)). @@ -120,6 +148,18 @@ that touch the code it reaches, and for an hour each day. reverse proxy is known for and what counters each; a change near one keeps its countermeasure. +### Dependencies + +A dependency is added only when the standard library and the crates already +in use cannot do the work. It must be maintained, under a licence +`deny.toml` allows, from crates.io (a git or path source needs a vendored fork +with a `VENDORED.md` that says what it changes and how to move it to a new +upstream release). Cargo fetches them; `Cargo.lock` pins every version and +checksum. Dependabot proposes updates a week after they are published; CI +checks every dependency against RustSec's advisories, the licences and the +sources on each change and every day (SECURITY.md, "Dependency and code +scanning"), and the release carries a CycloneDX bill of materials. + ### Documentation A new or changed setting is documented in [docs/CONFIG.md](docs/CONFIG.md) @@ -134,10 +174,34 @@ macOS; the integration tests; each vendored fork's tests; cargo-deny and cargo-audit; CodeQL; the REUSE licensing check; coverage; the fuzz targets the change reaches; and secret scanning. +## Review + +Every pull request is reviewed before it merges. The reviewer checks that +the change: + +- does what its description says, and nothing it does not say; +- has tests that would fail without it, and a fuzz target for a new parser of + client bytes; +- keeps each countermeasure in [docs/SECURE-DESIGN.md](docs/SECURE-DESIGN.md) + it touches, bounds every new input, and holds no lock across an `.await`; +- adds no dependency outside the policy above, and no `unsafe` without its + `SAFETY` comment; +- updates the documentation it makes untrue, and writes commit subjects for + the release notes; +- passes every check. + +A reviewer approves, or asks for changes with the reason; the discussion +stays on the pull request. Changes to the security policy, the release +pipeline or `GOVERNANCE.md` are reviewed against the assurance case +([docs/ASSURANCE-CASE.md](docs/ASSURANCE-CASE.md)). + ## Licensing The proxy is licensed under either of the [Apache License 2.0](LICENSE-APACHE) or the [MIT license](LICENSE-MIT), at your option. Unless you say otherwise, a contribution you submit is licensed the same way, without any additional -terms. [REUSE.toml](REUSE.toml) names every file's licence; a change to a -fork under `vendor/` stays under that fork's upstream licence. +terms. Each source file states its copyright and licence in an SPDX header, +and [REUSE.toml](REUSE.toml) covers the files that cannot carry one; a change +to a fork under `vendor/` stays under that fork's upstream licence. A new +file gets its header with +`reuse annotate --copyright "PQCrypta " --license "MIT OR Apache-2.0" `. diff --git a/GOVERNANCE.md b/GOVERNANCE.md new file mode 100644 index 00000000..18ba8913 --- /dev/null +++ b/GOVERNANCE.md @@ -0,0 +1,76 @@ +# Governance + +How decisions are made in this project, who makes them, and who holds +access to what. + +## Model + +PQCrypta Proxy is maintainer-led. The maintainers decide what is merged and +released, guided by [ROADMAP.md](ROADMAP.md), by the standards in +[CONTRIBUTING.md](CONTRIBUTING.md), and by the discussion on each proposal. + +Anyone may propose a change: as an issue, in Discussions, or as a pull +request. A proposal is decided on its pull request or issue, in public; the +reasons for accepting or declining it are written there. A change to this +governance, the licence or the security policy is proposed and decided the +same way, as a pull request against the file that states it. + +## Roles + +| Role | Who | Responsibilities | +|------|-----|------------------| +| Maintainer | [@PQCrypta](https://github.com/PQCrypta) | Reviews and merges pull requests; cuts releases (merges the Release Please PR); triages issues; answers vulnerability reports and publishes advisories ([SECURITY.md](SECURITY.md)); keeps the CI, the release pipeline and the repository settings; moderates under the [Code of Conduct](CODE_OF_CONDUCT.md) | +| Security contact | The maintainers | Receives private reports (GitHub private vulnerability reporting, contact@pqcrypta.com) and runs the process in [SECURITY.md](SECURITY.md) | +| Contributor | Anyone | Proposes changes that meet [CONTRIBUTING.md](CONTRIBUTING.md), signed off under the Developer Certificate of Origin; reports bugs; reviews others' pull requests | + +## Access to sensitive resources + +| Resource | Who has access | +|----------|----------------| +| Repository administration: settings, branch protection, collaborators | @PQCrypta | +| Private vulnerability reports and draft security advisories | @PQCrypta | +| Merging to `main` | @PQCrypta, through pull requests with the required checks passing | +| Releases on GitHub and the image at `ghcr.io/pqcrypta/pqcrypta-proxy` | The release workflow (`.github/workflows/release-please.yml`), started by merging the release PR | +| Signing of releases | No key exists to hold: each release is signed by the release workflow's own short-lived Sigstore identity | +| GitHub Actions secrets | None are stored. Each job gets the workflow token with the permissions it declares, read-only by default | + +The list changes only by a pull request to this file, made when the access +changes. + +## Granting access + +Write or higher access is given to a person, never to a team by default, and +only: + +- after a record of reviewed contributions to this repository; +- with two-factor authentication on their GitHub account, using an + authenticator app, a passkey or a security key; +- at the lowest role that does the work (Triage before Write, Write before + Maintain, Maintain before Admin); +- by the maintainers' agreement, recorded as a pull request to the table + above. + +Access no longer used is removed, and the table updated, in the same way. + +## Secrets and credentials + +- Nothing secret is committed. gitleaks checks every push and pull request, + and GitHub's secret scanning with push protection is on; a credential that + reaches the repository is revoked and replaced, not only removed. +- The CI holds no long-lived secrets: releases are signed keylessly and + pushed with the workflow's own token. +- Maintainers keep their GitHub credentials under two-factor authentication + and use fine-grained tokens with an expiry for automation, revoked when the + task ends. +- A deployment's own secrets (the admin token, HMAC keys) are the operator's: + the proxy reads them as systemd credentials or files and never logs them + ([docs/CRYPTOGRAPHY.md](docs/CRYPTOGRAPHY.md#secrets-and-passwords)). + +## Continuity + +The code, its history, the CI and the release pipeline all live in this +public repository, and every release is built by its workflow, not on a +maintainer's machine, so the project can be continued from the repository +alone. One maintainer holds administrator access today; a second +maintainer with access to merge, release and answer reports is the first +item of [ROADMAP.md](ROADMAP.md). diff --git a/LICENSES/CC-BY-SA-4.0.txt b/LICENSES/CC-BY-SA-4.0.txt new file mode 100644 index 00000000..835a6836 --- /dev/null +++ b/LICENSES/CC-BY-SA-4.0.txt @@ -0,0 +1,170 @@ +Creative Commons Attribution-ShareAlike 4.0 International + + Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses. + +Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors. + +Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. + +Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public. + +Creative Commons Attribution-ShareAlike 4.0 International Public License + +By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. + +Section 1 – Definitions. + + a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. + + e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License. + + i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights under this Public License. + + k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. + +Section 2 – Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. + + 3. Term. The term of this Public License is specified in Section 6(a). + + 4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. Downstream recipients. + + A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. + + B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. + + C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. + + 6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties. + +Section 3 – License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable; + + B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. + + 3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. + + b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. + + 1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. + +Section 4 – Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database; + + b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. +For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. + + a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You. + + b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You. + + c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. + + a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. + + d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. + + e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. + +Section 8 – Interpretation. + + a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. + + c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. + + d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. + +Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at creativecommons.org. diff --git a/README.md b/README.md index 940a9c99..d332e568 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **Production-ready HTTP/3/QUIC/WebTransport reverse proxy with hybrid Post-Quantum Cryptography (PQC) TLS support.** [![CI](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/ci.yml) -[![Cargo Deny](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/cargo-deny.yml/badge.svg)](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/cargo-deny.yml) +[![Dependencies](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/cargo-deny.yml/badge.svg)](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/cargo-deny.yml) [![OSSF Scorecard](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/ossf-scorecard.yml/badge.svg)](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/ossf-scorecard.yml) [![CodeQL](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/codeql.yml/badge.svg)](https://github.com/PQCrypta/pqcrypta-proxy/actions/workflows/codeql.yml) [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/16902/badge)](https://www.bestpractices.dev/projects/16902) @@ -736,7 +736,14 @@ with OpenSSL linked in, and its signed SLSA build provenance: `pqcrypta-proxy.intoto.jsonl` (its DSSE envelope with the signing certificate). The signature is keyless: the certificate names the release workflow and the commit it built, and the signature is entered in Sigstore's -public transparency log. Releases up to v0.14.1 carry the binary alone. +public transparency log. Each release also attaches the binary's software +bill of materials, `pqcrypta-proxy.cdx.json` (CycloneDX 1.5, every crate it +was built from), attested against the binary's digest in the same way; its +tag `v` is signed by the same workflow with +[gitsign](https://github.com/sigstore/gitsign); and a second runner rebuilds +the binary from the tag and checks that it is the same bytes. Releases up to +v0.14.1 carry the binary alone, and up to v0.31.2 the binary and its +provenance. ```bash gh release download --repo PQCrypta/pqcrypta-proxy --pattern 'pqcrypta-proxy*' @@ -748,6 +755,16 @@ gh attestation verify pqcrypta-proxy --repo PQCrypta/pqcrypta-proxy gh attestation verify pqcrypta-proxy --repo PQCrypta/pqcrypta-proxy \ --bundle pqcrypta-proxy.sigstore.json +# Its bill of materials, attested against the same binary +gh attestation verify pqcrypta-proxy --repo PQCrypta/pqcrypta-proxy \ + --predicate-type https://cyclonedx.org/bom + +# The tag, signed by the release workflow (git fetch --tags first) +gitsign verify-tag \ + --certificate-identity https://github.com/PQCrypta/pqcrypta-proxy/.github/workflows/release-please.yml@refs/heads/main \ + --certificate-oidc-issuer https://token.actions.githubusercontent.com \ + v + # Or with cosign cosign verify-blob-attestation --new-bundle-format \ --bundle pqcrypta-proxy.sigstore.json --type slsaprovenance1 \ @@ -786,6 +803,25 @@ docker run -d -p 443:4433/tcp -p 443:4433/udp \ pqcrypta-proxy ``` +## Upgrading + +Releases follow Semantic Versioning, and the latest is the supported one +([SECURITY.md](SECURITY.md#supported-versions-and-upgrades)). Before +upgrading, read the release notes: a change that needs anything of an operator +is marked **BREAKING CHANGES**, with what to do. + +```bash +# The new binary loads this node's configuration and runs the start's checks +./pqcrypta-proxy.new --config /etc/pqcrypta/proxy-config.toml --validate \ + && install -m 0755 pqcrypta-proxy.new /usr/local/bin/pqcrypta-proxy \ + && systemctl restart pqcrypta-proxy +``` + +`scripts/deploy.sh` does the same on each node in turn, keeps the previous +binary as `.prev-