Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ JWT_ACCESS_TOKEN_EXPIRE_MINUTES=30 # clients keep a session going with the re
# LOGIN_ATTEMPTS_PER_USERNAME_PER_MINUTE=20
# Set to require "Authorization: Bearer <token>" on /metrics. Empty = open.
# METRICS_TOKEN=
# METRICS_TOKEN_FILE=/run/secrets/testlookup-metrics-token
# false turns off /api-docs and the OpenAPI document.
# API_DOCS_ENABLED=true
# Self-service sign-up (the login page's "Register"). SECURE DEFAULT: false --
Expand Down Expand Up @@ -296,6 +297,19 @@ E2E_ADMIN_PASSWORD=<set-only-if-dev-login-is-disabled>
KNOWLEDGE_RAG_ENABLED=false

# ── Monitoring (optional overlay) ─────────────────────────────
# For docker-compose.monitoring-auth.yml, point each service at a protected
# host file containing the same metrics bearer token. Do not put the token here.
# METRICS_API_TOKEN_SOURCE=
# METRICS_PROMETHEUS_TOKEN_SOURCE=
# For docker-compose.objectives.yml, choose a stable lowercase installation ID
# and size Prometheus retention from the capacity runbook. Adoption is optional.
# OBSERVABILITY_INSTALLATION=
# SLO_PROMETHEUS_RETENTION_SIZE=
# SLO_ADOPTION_RULES_FILE=
# Application trace sampling for the optional durable profile. The SDK defaults
# to parentbased_always_on. A site may set both values after measuring capacity.
# OTEL_TRACES_SAMPLER=parentbased_traceidratio
# OTEL_TRACES_SAMPLER_ARG=0.1
# Required when using docker-compose.monitoring.yml
# Generate with: openssl rand -hex 16
GF_SECURITY_ADMIN_PASSWORD=<set-a-grafana-admin-password>
241 changes: 224 additions & 17 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

28 changes: 16 additions & 12 deletions .github/workflows/offline-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ on:
description: "Also bundle Ollama + ChromaDB (adds ~4 GB)"
type: boolean
default: false
with_telemetry:
description: "Include durable Compose telemetry configuration and redistributable images"
type: boolean
default: false
version:
description: "Release version without the v (for example 0.1.0): bundle the images that release promoted instead of building them. Leave empty for a CI check build."
type: string
Expand All @@ -69,6 +73,8 @@ permissions:
env:
BUNDLE_VERSION: ${{ inputs.version || format('ci-{0}', github.sha) }}
RELEASE_TAG: ${{ inputs.version && format('v{0}', inputs.version) || '' }}
WITH_LLM: ${{ inputs.with_llm || false }}
WITH_TELEMETRY: ${{ inputs.with_telemetry || false }}

jobs:
# ───────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -173,9 +179,11 @@ jobs:

- name: Show the bundle plan
run: |
bash scripts/release/offline-bundle.sh --dry-run \
--version "${BUNDLE_VERSION}" \
--created-at "${{ steps.meta.outputs.created_at }}"
set -euo pipefail
args=(--dry-run --version "$BUNDLE_VERSION" --created-at "${{ steps.meta.outputs.created_at }}")
if [ "$WITH_LLM" = true ]; then args+=(--with-llm); fi
if [ "$WITH_TELEMETRY" = true ]; then args+=(--with-telemetry); fi
bash scripts/release/offline-bundle.sh "${args[@]}"

# syft is intentionally NOT installed here: the released images carry
# BuildKit SBOM attestations in the registry, which `docker save` cannot
Expand All @@ -187,15 +195,11 @@ jobs:
- name: Build the offline bundle
run: |
set -euo pipefail
ARGS="--version ${BUNDLE_VERSION} --created-at ${{ steps.meta.outputs.created_at }}"
if [ "${{ github.event.inputs.with_llm }}" = "true" ]; then
ARGS="$ARGS --with-llm"
fi
if [ -n "$RELEASE_TAG" ]; then
ARGS="$ARGS --skip-build"
fi
# shellcheck disable=SC2086
bash scripts/release/offline-bundle.sh $ARGS
args=(--version "$BUNDLE_VERSION" --created-at "${{ steps.meta.outputs.created_at }}")
if [ "$WITH_LLM" = true ]; then args+=(--with-llm); fi
if [ "$WITH_TELEMETRY" = true ]; then args+=(--with-telemetry); fi
if [ -n "$RELEASE_TAG" ]; then args+=(--skip-build); fi
bash scripts/release/offline-bundle.sh "${args[@]}"

# The bundle must carry the pulled digests, not a local build:
# MANIFEST.json records each app image's registry digest.
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/release-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
default: regression
type: choice
options: [smoke, regression, full]
verify_signals:
description: Verify a candidate that includes the disposable monitored profile
type: boolean
default: false
workflow_call:
inputs:
source_sha:
Expand All @@ -21,6 +25,9 @@ on:
tier:
type: string
default: regression
verify_signals:
type: boolean
default: false
outputs:
manifest_sha256:
value: ${{ jobs.regression.outputs.manifest_sha256 }}
Expand Down Expand Up @@ -57,6 +64,7 @@ jobs:
- name: Verify release journeys and previous-build upgrade on Podman
env:
TIER: ${{ inputs.tier }}
VERIFY_SIGNALS: ${{ inputs.verify_signals }}
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
run: |
Expand Down Expand Up @@ -86,11 +94,20 @@ jobs:
"$RUNNER_TEMP/tl-e2e/bin/pip" install --require-hashes -r e2e-runner/requirements-lock.txt
"$RUNNER_TEMP/tl-e2e/bin/python" e2e-runner/release_campaign.py --repository "$REPOSITORY" \
--manifest verified/release-manifest.json --tier "$TIER" --out release-results
if [[ "$VERIFY_SIGNALS" == "true" ]]; then
# The runtime proof resolves OCI descriptors with Buildx, which
# reads Docker's registry credentials.
printf '%s' "$GH_TOKEN" | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
"$RUNNER_TEMP/tl-e2e/bin/python" e2e-runner/monitored_ephemeral.py --engine podman \
--manifest verified/release-manifest.json --out release-results/signal-gate.json
fi
- name: Show release decision
if: always() && hashFiles('release-results/summary.md') != ''
run: cat release-results/summary.md >> "$GITHUB_STEP_SUMMARY"
- name: Bind the passing decision to the tested artifact
id: attest
env:
VERIFY_SIGNALS: ${{ inputs.verify_signals }}
run: |
python3 - <<'PY'
import hashlib, json, os
Expand All @@ -101,6 +118,12 @@ jobs:
if (result["verdict"] != "GO" or result["manifest_hash"] != digest
or result["observed_build"]["revision"] != manifest["source_sha"]):
raise SystemExit("Candidate and functional decision do not match")
if os.environ["VERIFY_SIGNALS"] == "true":
signal = json.loads(Path("release-results/signal-gate.json").read_bytes())
if (signal.get("status") != "passed" or signal.get("cleanup") != "completed"
or signal.get("profile") != "compose" or signal.get("source_sha") != manifest["source_sha"]
or signal.get("manifest_sha256") != digest):
raise SystemExit("Candidate and disposable signal evidence do not match")
with open(os.environ["GITHUB_OUTPUT"], "a") as output:
print("manifest_sha256=" + digest, file=output)
PY
Expand All @@ -115,3 +138,5 @@ jobs:
release-results/summary.md
release-results/results.json
release-results/release-junit.xml
release-results/signal-gate.json
release-results/signal-gate-evidence/
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ jobs:
uses: ./.github/workflows/release-e2e.yml
with:
source_sha: ${{ needs.resolve-tag.outputs.source_sha }}
verify_signals: ${{ vars.REQUIRE_RELEASE_SIGNAL_GATE == 'true' }}

promote:
name: Promote verified digest set to release aliases
Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/require-verified-sha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
require:
name: Require successful CI and immutable image manifest
runs-on: ubuntu-latest
timeout-minutes: 20
outputs:
source_sha: ${{ steps.verify.outputs.source_sha }}
ci_run_id: ${{ steps.verify.outputs.ci_run_id }}
Expand All @@ -37,7 +38,7 @@ jobs:
set -euo pipefail
[[ "$SOURCE_SHA" =~ ^[0-9a-f]{40}$ ]] || { echo "source_sha must be a lowercase full Git SHA" >&2; exit 1; }
artifact_name="verified-images-$SOURCE_SHA"
# Contract: the artifact is named verified-images-${{ inputs.source_sha }}.
# The artifact name is bound to the validated candidate SHA.
artifact_json="$(gh api "/repos/$GITHUB_REPOSITORY/actions/artifacts?name=$artifact_name&per_page=100")"
mapfile -t candidates < <(jq -r '.artifacts[] | select(.expired == false) | .workflow_run.id' <<<"$artifact_json" | sort -u)
matches=()
Expand All @@ -48,3 +49,18 @@ jobs:
[[ "${#matches[@]}" -eq 1 ]] || { echo "Expected exactly one successful main ci.yml run for $SOURCE_SHA" >&2; exit 1; }
ci_run_id="${matches[0]}"
printf 'source_sha=%s\nci_run_id=%s\nartifact_name=%s\n' "$SOURCE_SHA" "$ci_run_id" "$artifact_name" >> "$GITHUB_OUTPUT"
- name: Check out the protected release verifier
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# The candidate SHA is evidence to verify. The verifier comes from
# the protected branch and cannot be selected by a workflow input.
ref: refs/heads/main
persist-credentials: false
- name: Require successful exact-SHA secret scan before release authorization
env:
GH_TOKEN: ${{ github.token }}
SOURCE_SHA: ${{ inputs.source_sha }}
run: |
python3 scripts/release/verify_secret_scan.py \
--repository "$GITHUB_REPOSITORY" --source-sha "$SOURCE_SHA" \
--timeout-seconds 900 --poll-seconds 10
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
23 changes: 19 additions & 4 deletions .github/workflows/secret-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ name: Secret scan
# Its own workflow, not a ci.yml job: ci.yml skips Markdown-only changes, and a
# token pasted into a README or a runbook is exactly what this is for.
#
# Only added lines are scanned, so the fake tokens in existing redaction tests
# do not fire. A new deliberate fake value: make it obviously fake, or end the
# Added history AND the full tracked candidate are scanned. Otherwise a failed
# push followed by an unrelated push could leave the first push's secret in an
# image while scanning only the second diff. A deliberate fake value: make it
# obviously fake, or end the
# line with a `gitleaks:allow` comment and say why in the PR. A real secret
# that reached a pushed commit is public: rotate it, then remove it.

Expand All @@ -31,7 +33,7 @@ jobs:
gitleaks:
name: Security — Secret scan (gitleaks)
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -50,6 +52,11 @@ jobs:
sudo install -m 0755 gitleaks /usr/local/bin/gitleaks
rm -f gitleaks gitleaks.tar.gz

- name: Prove full candidate coverage and raw-blob isolation
env:
GITLEAKS_TEST_BINARY: /usr/local/bin/gitleaks
run: python3 -m unittest discover -s scripts/release/tests -p test_scan_secret_snapshot.py

- name: Scan the added commits
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
Expand All @@ -68,4 +75,12 @@ jobs:
fi
echo "Scanning: git log $log_opts"
gitleaks git --config .gitleaks.toml --redact --no-banner --exit-code 1 \
--log-opts="$log_opts" .
--timeout 300 --log-opts="$log_opts" .

- name: Scan the full tracked candidate snapshot
if: github.event_name == 'push'
run: |
set -euo pipefail
python3 scripts/release/scan_secret_snapshot.py \
--source-sha "$GITHUB_SHA" --gitleaks /usr/local/bin/gitleaks \
--timeout-seconds 300
8 changes: 6 additions & 2 deletions .github/workflows/third-party-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Third-party image scan
# Flower and the monitoring add-on's Jaeger, Prometheus and Grafana) were in no
# scan, and Dependabot tracks only their Compose tags (OSS review 2026-11-12,
# H-4). This scans every `infra` row of deploy/images.manifest.txt and every
# image in docker-compose.monitoring.yml: weekly, when either file changes on
# image in the monitoring and alerting overlays: weekly, when these files change on
# main, and on demand.
#
# It reports and does not fail on findings: an upstream image's findings are
Expand All @@ -22,13 +22,17 @@ on:
paths:
- deploy/images.manifest.txt
- docker-compose.monitoring.yml
- docker-compose.alerting.yml
- docker-compose.telemetry.yml
- .github/workflows/third-party-images.yml
# A pull request that changes an image or this workflow sees the report
# before it merges.
pull_request:
paths:
- deploy/images.manifest.txt
- docker-compose.monitoring.yml
- docker-compose.alerting.yml
- docker-compose.telemetry.yml
- .github/workflows/third-party-images.yml
workflow_dispatch:

Expand Down Expand Up @@ -77,7 +81,7 @@ jobs:
set -euo pipefail
{
awk '!/^[[:space:]]*#/ && NF >= 2 && $2 == "infra" { print $1 }' deploy/images.manifest.txt
sed -n 's/^[[:space:]]*image:[[:space:]]*//p' docker-compose.monitoring.yml
sed -n 's/^[[:space:]]*image:[[:space:]]*//p' docker-compose.monitoring.yml docker-compose.alerting.yml docker-compose.telemetry.yml
} | sort -u > third-party-images.txt
test "$(wc -l < third-party-images.txt)" -ge 8
cat third-party-images.txt
Expand Down
76 changes: 72 additions & 4 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,79 @@ description = "Cloudflare tunnel token (base64 JSON with a/t/s keys)"
regex = '''eyJhIjoi[A-Za-z0-9+/=_\-]{40,}'''
keywords = ["eyjhijoi"]

[[allowlists]]
description = "Cross-SDK redaction vectors: they hold token-shaped fake values on purpose, to prove every SDK masks them"
paths = ['''^sdk-vectors/''']

[[allowlists]]
description = "Chart axis keys such as p95_duration_ms read as high-entropy generic keys"
targetRules = ["generic-api-key"]
stopwords = ["_duration_ms"]

# These exact golden chart-metadata lines are deterministic test labels, not
# credentials. The AND condition permits no other value anywhere in this file.
[[allowlists]]
description = "Exact synthetic chart metadata in the analytics parity golden fixture"
condition = "AND"
targetRules = ["generic-api-key"]
paths = ['''^backend/tests/integration/golden/analytics_parity_characterisation\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"membership_key": "395524f698eb9382943f84f87782ca2b",\s*$''', # gitleaks:allow -- exact synthetic golden metadata
'''^\s*"membership_key": "398fa42ff77ee0c8119dd3749c780d3f",\s*$''', # gitleaks:allow -- exact synthetic golden metadata
'''^\s*"membership_key": "5a28a10db27b29653db1c73983d33b16",\s*$''', # gitleaks:allow -- exact synthetic golden metadata
]

# Shared SDK conformance vectors deliberately contain fixed synthetic canaries.
# Match the exact recorded lines AND file AND detector, never the directory.

[[allowlists]]
description = "Exact synthetic cross-SDK redaction vector for aws-access-token"
condition = "AND"
targetRules = ["aws-access-token"]
paths = ['''^sdk\-vectors/http_exchange\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"X\-Debug": "key AKIAW23DSAMPLEKEYQZX",\s*$''', # gitleaks:allow -- exact synthetic conformance input
]

[[allowlists]]
description = "Exact synthetic cross-SDK redaction vector for generic-api-key"
condition = "AND"
targetRules = ["generic-api-key"]
paths = ['''^sdk\-vectors/http_exchange\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"Sec\-WebSocket\-Key": "dGhlIHNhbXBsZSBub25jZQ==",\s*$''', # gitleaks:allow -- exact synthetic conformance input
]

[[allowlists]]
description = "Exact synthetic cross-SDK redaction vector for github-pat"
condition = "AND"
targetRules = ["github-pat"]
paths = ['''^sdk\-vectors/http_exchange\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"X\-GitHub\-Token": "ghp_w23dSamplePatValueQxZkLmNoPqRsTuVwXy",\s*$''', # gitleaks:allow -- exact synthetic conformance input
'''^\s*"X\-Trace": "pat ghp_w23dSamplePatValueQxZkLmNoPqRsTuVwXy"\s*$''', # gitleaks:allow -- exact synthetic conformance input
'''^\s*"body": "\{\\"note\\": \\"sample ghp_w23dSamplePatValueQxZkLmNoPqRsTuVwXy\\", \\"id\\": 11\}"\s*$''', # gitleaks:allow -- exact synthetic conformance input
'''^\s*"url": "https://api\.example\.test/api/hooks/ghp_w23dSamplePatValueQxZkLmNoPqRsTuVwXy/deliveries",\s*$''', # gitleaks:allow -- exact synthetic conformance input
'''^\s*"url": "https://api\.example\.test/api/search\?q=ghp_w23dSamplePatValueQxZkLmNoPqRsTuVwXy\&limit=5",\s*$''', # gitleaks:allow -- exact synthetic conformance input
]

[[allowlists]]
description = "Exact synthetic cross-SDK redaction vector for jwt"
condition = "AND"
targetRules = ["jwt"]
paths = ['''^sdk\-vectors/http_exchange\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\.eyJzdWIiOiJ3MjNkLXNhbXBsZSJ9\.c2lnbmF0dXJlLXNhbXBsZS12YWx1ZS0x",\s*$''', # gitleaks:allow -- exact synthetic conformance input
'''^\s*"body": "\{\\"session\\": \\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9\.eyJzdWIiOiJ3MjNkLXNhbXBsZSJ9\.c2lnbmF0dXJlLXNhbXBsZS12YWx1ZS0x\\"\}"\s*$''', # gitleaks:allow -- exact synthetic conformance input
]

[[allowlists]]
description = "Exact synthetic cross-SDK redaction vector for jwt"
condition = "AND"
targetRules = ["jwt"]
paths = ['''^sdk\-vectors/run_context\.json$''']
regexTarget = "line"
regexes = [
'''^\s*"BUILD_IMAGE": "eyJSentinelSentinelSenti\.eyJPayloadSentinelPayloa\.SignatureSentinelSignatu"\s*$''', # gitleaks:allow -- exact synthetic conformance input
]
Loading
Loading