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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/actions/install-pinned-binary/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: install-pinned-binary
description: >-
Put one binary from a release tarball on PATH, at a pinned version whose
SHA-256 is pinned too. The archive is kept in the Actions cache (keyed on
name, version and checksum), so a job downloads it only on a cache miss;
a download retries transient failures for up to four minutes. The
checksum is checked on every run, cached archive or fresh download: it,
not the cache or the release host, decides what runs. A cached archive
that fails the check is discarded and downloaded again.

Why: GitHub's release-asset host answered 504 for minutes at a time on
2026-11-09 (the Fly deploy twice, the secret scan six retries in a row),
and an unpinned setup action (`setup-flyctl@master`, flyctl `latest`)
let both the action's code and the CLI change under the production
deploy. To move a version: change `version`, `url` and `sha256` together
at the call site (the publisher's checksums file, checked against the
archive's own hash).

inputs:
name:
description: Short name, used in the cache key and the step names (e.g. flyctl).
required: true
version:
description: The pinned version (e.g. 0.5.5).
required: true
url:
description: The release tarball for that version (linux x86_64).
required: true
sha256:
description: The tarball's SHA-256 (hex).
required: true
binary:
description: The file inside the tarball to put on PATH.
required: true

runs:
using: composite
steps:
- name: Restore the ${{ inputs.name }} ${{ inputs.version }} archive
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pinned-binaries/${{ inputs.name }}-${{ inputs.version }}.tar.gz
key: pinned-binary-${{ inputs.name }}-${{ inputs.version }}-${{ inputs.sha256 }}

- name: Install ${{ inputs.name }} ${{ inputs.version }} (checksum-pinned)
shell: bash
env:
NAME: ${{ inputs.name }}
VERSION: ${{ inputs.version }}
URL: ${{ inputs.url }}
SHA256: ${{ inputs.sha256 }}
BINARY: ${{ inputs.binary }}
run: |
set -euo pipefail
archive="$HOME/.cache/pinned-binaries/${NAME}-${VERSION}.tar.gz"
mkdir -p "$(dirname "$archive")"
download() {
echo "downloading ${NAME} ${VERSION}"
curl --fail --silent --show-error --location \
--retry 8 --retry-all-errors --retry-delay 10 --retry-max-time 240 \
"$URL" --output "$archive"
}
verified() { echo "${SHA256} ${archive}" | sha256sum --check --status; }
if [ -s "$archive" ] && verified; then
echo "${NAME} ${VERSION}: cached archive, checksum ok"
else
[ -s "$archive" ] && echo "::warning::cached ${NAME} archive failed its checksum; downloading again"
rm -f "$archive"
download
if ! verified; then
echo "::error::${NAME} ${VERSION}: the download does not match the pinned SHA-256"
exit 1
fi
echo "${NAME} ${VERSION}: downloaded, checksum ok"
fi
dest="$RUNNER_TEMP/pinned-bin/${NAME}"
mkdir -p "$dest"
tar -xzf "$archive" -C "$dest" "$BINARY"
echo "$dest" >> "$GITHUB_PATH"
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,51 @@ jobs:
exit 1
fi
python -m pytest -q tests/test_smoke_live.py

# Secret scan of the new commits only: the pull request's range, or the
# push's. The default gitleaks rules plus the AgentChat API key rule
# (.gitleaks.toml).
secret-scan:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
fetch-depth: 0

# Checksum-pinned, cached: a download happens only on a cache miss
# (.github/actions/install-pinned-binary).
- uses: ./.github/actions/install-pinned-binary
with:
name: gitleaks
version: 8.30.1
url: https://github.com/gitleaks/gitleaks/releases/download/v8.30.1/gitleaks_8.30.1_linux_x64.tar.gz
sha256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
binary: gitleaks

- name: Select commits to scan
id: commits
env:
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.sha }}
run: |
if [[ "$EVENT_NAME" == "pull_request" ]]; then
echo "range=${BASE_SHA}..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
# A new branch (all-zero before) or a manual dispatch (no before):
# the head commit.
elif [[ "$BEFORE_SHA" =~ ^0*$ ]]; then
echo "range=${HEAD_SHA}^..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
else
echo "range=${BEFORE_SHA}..${HEAD_SHA}" >> "$GITHUB_OUTPUT"
fi

- name: Scan new commits for secrets
run: >-
gitleaks git
--redact
--no-banner
--log-opts="${{ steps.commits.outputs.range }}"
.
37 changes: 37 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# gitleaks configuration: the default rules plus the AgentChat API key rule,
# kept identical to the one the core repository scans with, and one allowlist
# for the exact, documented synthetic values of the contract conformance
# fixture. The allowlist patterns match only those specific values, never a
# shape a real credential could take. CI scans only the new commits of a pull
# request or a push (.github/workflows/ci.yml, job secret-scan). Every default
# rule stays active everywhere else.

[extend]
useDefault = true

[[allowlists]]
description = "Contract v1 conformance fixture: made-up test secrets shared byte-identically by the contract and both SDKs"
regexTarget = "line"
regexes = [
# conformance/v1/wake-webhook.cases.json
'''"secret":\s*"wks_conformance_0123456789abcdef"''',
# base64 of the made-up Standard Webhooks key "conformance-key-0123456789abcdef"
'''"standard_webhooks_secret_base64":\s*"Y29uZm9ybWFuY2Uta2V5LTAxMjM0NTY3ODlhYmNkZWY="''',
]

# AgentChat API keys: `ac_` + 32 random bytes as unpadded base64url.
# 32 bytes = 43 characters, and the last character carries only 4 data bits,
# so it is one of 16 letters/digits.
# Bounded on both sides by a non-base64url character (RE2 has no lookaround),
# so identifiers such as `ac_status` and 42- or 44-character runs never match;
# on the left an escape (`\n`, `\t`) or a percent-encoding (`Bearer%20`) also
# counts as a boundary.
# No keyword is needed next to it: a key pasted bare or in
# `Authorization: Bearer ac_…` is caught. Test code must build keys at run
# time from random bytes, never as a literal.
[[rules]]
id = "agentchat-api-key"
description = "AgentChat API key"
regex = '''(?:^|[^A-Za-z0-9_-]|\\[nrt]|%[0-9A-Fa-f]{2})(ac_[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048])(?:[^A-Za-z0-9_-]|$)'''
secretGroup = 1
keywords = ["ac_"]
Loading