Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
8912ec9
feat(proto): add signed command envelopes
fransallen Nov 17, 2026
bc96c64
feat(api): sign commands through an extension signer
fransallen Nov 17, 2026
cd213b3
feat(agent): enroll over mtls and run only signed commands
fransallen Nov 17, 2026
421be62
feat(api): add an mtls agent endpoint with enrollment
fransallen Nov 17, 2026
c85299a
feat(connect): keep built images in the cluster's own registry
fransallen Nov 17, 2026
7b4e2cc
feat(api): require proof of domain ownership on shared installations
fransallen Nov 17, 2026
98f4a14
feat(dash): offer test payments on the billing page
fransallen Nov 17, 2026
7535028
fix(api): refuse this-machine clusters when agents use mtls
fransallen Nov 17, 2026
35b4788
feat(api): fail commands the signer refuses
fransallen Nov 17, 2026
ca12071
fix(agent): prove the client certificate on every connection
fransallen Nov 17, 2026
d9461f9
feat(api): give a team's first cluster a builder on pyo cloud
fransallen Nov 17, 2026
4c56378
test(connect): expect a restart for a new local registry mirror
fransallen Nov 17, 2026
d3e6829
feat(proto): sign agent requests with the agent's own key
fransallen Nov 17, 2026
4428ed3
feat(api): accept agents that sign their requests
fransallen Nov 17, 2026
a12e369
feat(api): read CF-Connecting-IP from trusted proxies only
fransallen Nov 17, 2026
83334d5
feat(agent): sign every request with the agent's own key
fransallen Nov 17, 2026
05f83c0
fix(agent): ping terminal sockets every 30 seconds
fransallen Nov 17, 2026
5ae70c5
feat(api): refuse tailscale setup on a hosted pyo
fransallen Nov 20, 2026
18b12ab
feat(dash): hide tailscale and hetzner on a hosted pyo
fransallen Nov 20, 2026
fc20837
fix(dash): say services, not apps, on add cluster
fransallen Nov 20, 2026
d62e500
feat(dash): connect only other machines on a hosted pyo
fransallen Nov 20, 2026
5ad9216
feat(dash): leave tailscale out of the hosted setup checklist
fransallen Nov 20, 2026
1a60efb
feat(dash): hide the update dots on a hosted pyo
fransallen Nov 20, 2026
1b2da53
feat(dash): hide tailnet-only offers on a hosted pyo
fransallen Nov 20, 2026
afe2c59
fix(api): build on a builder in the deploy's cluster
fransallen Nov 20, 2026
8c9293f
fix(api): give a cluster only the certificates and logins it uses
fransallen Nov 20, 2026
1b433d3
feat(api): keep installation-wide sandbox servers off a hosted pyo
fransallen Nov 20, 2026
0deb959
feat(api): add row-level security on team-owned tables
fransallen Nov 20, 2026
b3cadb2
feat(proto): sign replies to the agent, bound to its request
fransallen Nov 20, 2026
cfb27e1
feat(api): sign heartbeat replies, certificates and registry logins
fransallen Nov 20, 2026
f6a7a00
feat(agent): act only on signed answers where commands are signed
fransallen Nov 20, 2026
ecf503b
feat(proto): sign streamed request bodies by their declared hash
fransallen Nov 20, 2026
64da90a
feat(api): let builders and pyo-static sign with keys from the agent
fransallen Nov 20, 2026
e60e17c
feat(agent): give builders and pyo-static keys, relay Vector's data
fransallen Nov 20, 2026
2577f0b
feat(builder): sign requests with the builder's own key
fransallen Nov 20, 2026
fc1403c
feat(static): sign requests with pyo-static's own key
fransallen Nov 20, 2026
0632dac
feat(api): make connect commands one-time and good for an hour
fransallen Nov 20, 2026
0e41912
feat(api): update agents on a hosted pyo, automatic or when the team …
fransallen Nov 20, 2026
8285aed
feat(dash): say when a cluster's install command expired
fransallen Nov 20, 2026
2727f69
feat(dash): update agents on a hosted pyo from the team and cluster
fransallen Nov 20, 2026
26502b8
fix(api): refuse hosted agent updates to an image not pinned by digest
fransallen Nov 20, 2026
a1f7f0b
feat(proto): let the command key hand signing to a session key
fransallen Nov 20, 2026
be3bffb
refactor(api): issue agent certificates through a pluggable ca
fransallen Nov 20, 2026
ef4390f
feat(dash): show billing in the menu to team owners and admins only
fransallen Nov 20, 2026
b1a918e
feat(dash): rebuild the pyo cloud billing page
fransallen Nov 20, 2026
5c2df35
feat(proto): add traffic totals, sketches and kept-request queries
fransallen Nov 20, 2026
21a1ab3
feat(agent): keep traffic in the cluster and send only totals
fransallen Nov 20, 2026
879068b
feat(api)!: store traffic totals and read requests from the clusters
fransallen Nov 20, 2026
cf97c72
feat(api): clean up build logs after 90 days
fransallen Nov 20, 2026
ec41dd7
feat(dash): read analytics from totals and requests from the clusters
fransallen Nov 20, 2026
daf591b
feat(dash): drop the request allowance from cloud billing
fransallen Nov 20, 2026
01e7adf
feat!: move tailscale into each cluster's agent
fransallen Nov 20, 2026
f61b77e
feat(dash): set tailscale up per cluster, on cloud too
fransallen Nov 20, 2026
6732991
Merge branch 'feat/tailscale-agent' into dev
fransallen Nov 20, 2026
d4155c4
style(dash): pick replicas with a stepper, like read replicas
fransallen Nov 20, 2026
b554a2f
fix(api): keep domain changes from asking for a redeploy
fransallen Nov 20, 2026
e72498c
fix(dash): center the terminal's shell picker and empty state
fransallen Nov 20, 2026
c09e7fb
Merge branch 'fix/terminal-ui' into dev
fransallen Nov 20, 2026
c72fa04
style(dash): match the terminal header buttons to the pickers' height
fransallen Nov 20, 2026
7e27e5b
feat(dash): add domains as your domain, free domain or tailscale
fransallen Nov 20, 2026
d2d9ca7
refactor(dash): drop the free domain settings from cluster settings
fransallen Nov 20, 2026
f4964de
feat(dash): give the terminal light and dark color palettes
fransallen Nov 20, 2026
aa4c435
style(dash): give tick boxes one rounded, filled design
fransallen Nov 20, 2026
3ec6568
Merge branch 'feat/terminal-palettes' into dev
fransallen Nov 20, 2026
9ef4de5
style(dash): call the request log settings logs
fransallen Nov 20, 2026
0e72e94
fix(api): keep traffic totals for 12 months
fransallen Nov 20, 2026
f6d8dcd
fix(api): keep free domains on the public ip where they were added
fransallen Nov 20, 2026
12df21c
fix(dash): suggest a domain name nothing uses yet
fransallen Nov 20, 2026
05ee450
fix(api): refuse a hostname twice on one service
fransallen Nov 20, 2026
77d4e62
Merge branch 'feat/domain-add-options' into dev
fransallen Nov 20, 2026
87c7e71
style(dash): explain where a service runs from its server tags
fransallen Nov 20, 2026
b8e61a4
style(dash): drop the downtime note from the volumes tab
fransallen Nov 20, 2026
405845d
style(dash): show one server only in muted text
fransallen Nov 20, 2026
1104bc5
style(dash): drop the http only note from networking
fransallen Nov 20, 2026
d9edb49
style(dash): simplify the volumes table
fransallen Nov 20, 2026
f992d0e
Merge branch 'style/volumes-table' into dev
fransallen Nov 20, 2026
14d73b1
feat(api): run services on picked servers and tags, changed in place
fransallen Nov 20, 2026
ec82a71
feat(cli): set where a service runs from the cli and mcp
fransallen Nov 20, 2026
1a8818c
feat(dash): pick servers in the resources tab
fransallen Nov 20, 2026
a047315
feat(dash): drop the server tags field from service settings
fransallen Nov 20, 2026
a13346d
Merge branch 'feat/servers-picker' into dev
fransallen Nov 20, 2026
124eaca
refactor(api): share cancelling a deployment
fransallen Nov 20, 2026
fb220b8
feat(api): add preview environments for pull and merge requests
fransallen Nov 20, 2026
b7c4c01
feat(dash): add a previews tab to Git services
fransallen Nov 20, 2026
5edc110
style(dash): drop the vercel trademark notice from imports
fransallen Nov 20, 2026
f3c5365
fix(cli): sign in by polling pyo instead of a localhost callback
fransallen Nov 20, 2026
c6af702
Merge branch 'fix/cli-login' into dev
fransallen Nov 20, 2026
cc3e569
fix(api): make tailnet domains live once the cluster serves them
fransallen Nov 20, 2026
3f13e92
fix(cli): show tailnet domains as setting up on tailscale
fransallen Nov 20, 2026
c35b76b
fix(dash): show tailnet domains as setting up on tailscale
fransallen Nov 20, 2026
8bf0e36
feat(api): run one command in a replica with its exit code
fransallen Nov 20, 2026
b24d611
feat(api): read service logs since a time or from one replica
fransallen Nov 20, 2026
a44a41f
feat(api): deploy a folder uploaded through pyo
fransallen Nov 20, 2026
99ee85c
feat(builder): build folders uploaded with pyo deploy
fransallen Nov 20, 2026
ca579ce
feat(dash): show deployments uploaded from a folder
fransallen Nov 20, 2026
3162581
feat(cli): deploy a folder with pyo deploy
fransallen Nov 20, 2026
dda7d25
feat(cli): follow logs since a time, from one replica, or of the build
fransallen Nov 20, 2026
0fb72f6
feat(cli): run one command with pyo exec
fransallen Nov 20, 2026
1e01de4
feat(cli): pull secrets with pyo env pull --secrets
fransallen Nov 20, 2026
f45a2da
Merge branch 'feat/cli-05' into dev
fransallen Nov 20, 2026
a81f14b
feat(api): choose how long observability data is kept
fransallen Nov 20, 2026
f28e1c7
feat(dash): add retention settings for observability data
fransallen Nov 20, 2026
f2b67f5
feat(api): put the rest of the team tables under row security
fransallen Nov 20, 2026
97544d8
feat(api): rate-limit api keys, webhooks, invites and operations
fransallen Nov 20, 2026
927b95a
fix(api): seal teams' credentials with the team's own data key
fransallen Nov 20, 2026
7df58c8
feat(api): give teams no default backup store on a hosted pyo
fransallen Nov 20, 2026
a3a1128
feat(dash): add a backup bucket from an empty backups page
fransallen Nov 20, 2026
8d34724
feat(dash): word the security page's key lines for a hosted pyo
fransallen Nov 20, 2026
66313ce
feat(api): read domain proofs from the domain's own name servers
fransallen Nov 20, 2026
5a68659
feat(agent): add a door to the cluster's own registry
fransallen Nov 20, 2026
d208296
feat(api): sync registry tokens to each cluster's own registry door
fransallen Nov 20, 2026
88e9020
feat(dash): show each cluster's registry address on pyo cloud
fransallen Nov 20, 2026
b162cd1
Merge branch 'feat/cloud-hardening' into dev
fransallen Nov 20, 2026
117cdd4
feat(api): add two-factor authentication and a team audit log
fransallen Nov 20, 2026
440669d
feat(dash): set up two-factor and sign in with a code
fransallen Nov 20, 2026
dc454de
feat(dash): add the audit log page and security settings
fransallen Nov 20, 2026
d0dd17b
Merge branch 'feat/team-security' into dev
fransallen Nov 20, 2026
768018c
fix(dash): count only applicable checks in the security header
fransallen Nov 20, 2026
d32603e
Merge branch 'fix/security-header' into dev
fransallen Nov 20, 2026
0f98b48
chore(dash): drop notes that cloud billing endpoints are missing
fransallen Nov 20, 2026
fad92a2
feat(agent): follow service logs over one websocket
fransallen Nov 20, 2026
19f5f87
feat(api): relay log follows from agents to readers
fransallen Nov 20, 2026
ee4e8a5
feat(cli): follow logs over one stream in pyo logs -f
fransallen Nov 20, 2026
2bdf38e
feat(dash): follow live service logs over the stream
fransallen Nov 20, 2026
69a9923
feat(api): send no new commands to paused or ended hosted teams
fransallen Nov 20, 2026
12d8afe
feat(dash): say servers get no changes while a plan is paused or ended
fransallen Nov 20, 2026
3d24f70
Merge branch 'feat/cloud-followups' into dev
fransallen Nov 20, 2026
f591c6e
fix(api): hand agent sockets across web replicas with a relay ticket
fransallen Nov 20, 2026
eccd8f3
feat(api): send held back syncs again once a hosted team resumes
fransallen Nov 20, 2026
04da256
feat(agent): follow database logs over one websocket
fransallen Nov 20, 2026
ad34d06
feat(api): relay database log follows to readers
fransallen Nov 20, 2026
26c871c
feat(dash): follow live database logs over the stream
fransallen Nov 20, 2026
80a0bda
Merge branch 'feat/cloud-followups-2' into dev
fransallen Nov 20, 2026
a9dd1dc
fix(agent): leave ended proxy pods out of the heartbeat's scope check
fransallen Nov 20, 2026
b8be8e1
Merge branch 'fix/agent-startup-memory' into dev
fransallen Nov 20, 2026
9b14681
feat(dash): say a cloud plan ends because the team has no servers
fransallen Nov 21, 2026
ca8c9c5
ci: scan release images and lockfiles for cves with trivy
fransallen Nov 21, 2026
c632c5d
ci: scan published and pinned images for cves every day
fransallen Nov 21, 2026
9864d6c
ci: check every week whether a postgres rebuild fixes cves
fransallen Nov 21, 2026
ae70543
build: add a renovate config for dependency updates
fransallen Nov 21, 2026
bf5eaee
ci: check rust dependencies with cargo-deny
fransallen Nov 21, 2026
517e94b
build(release): add a script that prepares a patch release
fransallen Nov 21, 2026
7128ed1
docs(release): describe security patch releases and image scans
fransallen Nov 21, 2026
ce5f5cf
docs: add a security policy
fransallen Nov 21, 2026
95fa903
Merge branch 'ci/supply-chain' into dev
fransallen Nov 21, 2026
ac865b0
fix(deps): update lettre to 0.11.24 for smtp advisories
fransallen Nov 21, 2026
dfa649b
fix(waf): update golang.org/x/net to 0.62.0
fransallen Nov 21, 2026
c62c26c
fix(images): update certifi in the mysql backup image
fransallen Nov 21, 2026
5c65d22
Merge branch 'fix/mysql-backup-cves' into dev
fransallen Nov 21, 2026
7fb606c
chore(sandbox): ship the latest base and desktop images
fransallen Nov 21, 2026
201e181
feat(cli): scale a service with pyo scale
fransallen Nov 21, 2026
25393ce
chore(release): 0.5.0
fransallen Nov 21, 2026
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
24 changes: 24 additions & 0 deletions .github/actions/trivy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Trivy
description: >
Installs Trivy at the pinned version and restores today's vulnerability
database from the Actions cache (saved by the first job of the day to
download it).

runs:
using: composite
steps:
- uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
with:
version: v0.76.2 # aquasecurity/trivy
cache: true
- name: Today
id: today
shell: bash
run: echo "date=$(date -u +%F)" >> "$GITHUB_OUTPUT"
# Yesterday's database when today's isn't cached yet: Trivy sees it's
# old and downloads a new one, which this saves under today's key.
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/trivy/db
key: trivy-db-${{ steps.today.outputs.date }}
restore-keys: trivy-db-
60 changes: 60 additions & 0 deletions .github/scripts/cve-issue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
# Keeps one GitHub issue per scanned image, labelled `security`, listing
# its HIGH and CRITICAL CVEs that have a fix (from trivy-scan.sh). Opens
# it, updates it (with a comment when new CVEs show up) or closes it once
# the image has none. The issue is found by the marker in its body, so
# its title can follow the image's version. Needs GH_TOKEN and GH_REPO.
#
# cve-issue.sh <key> <image ref> <out> # <out>.json and <out>.md
set -euo pipefail
export LC_ALL=C

key=$1 ref=$2 out=$3
marker="<!-- pyo-cve-scan: $key -->"
title="CVEs with a fix in ${ref%@*}"
run="${GITHUB_SERVER_URL:-https://github.com}/${GH_REPO}/actions/runs/${GITHUB_RUN_ID:-0}"

issue=$(gh issue list --state open --label security --limit 500 --json number,body \
| jq -r --arg m "$marker" 'map(select(.body | contains($m))) | .[0].number // empty')

ids=$(jq -r '[.Results[]?.Vulnerabilities[]?.VulnerabilityID] | unique | .[]' "$out.json")

if [ -z "$ids" ]; then
if [ -n "$issue" ]; then
gh issue close "$issue" --comment "The scan of $(date -u +%F) finds no HIGH or CRITICAL CVEs with a fix in \`$ref\` ([run]($run))."
echo "Closed #$issue: nothing left."
else
echo "Nothing to report for $ref."
fi
exit 0
fi

rows=$(wc -l < "$out.md")
{
echo "$marker"
echo "Trivy finds $(wc -l <<<"$ids") HIGH or CRITICAL CVEs with a fixed version in \`$ref\`."
echo
# An issue's body holds 65536 characters.
head -n 252 "$out.md"
if [ "$rows" -gt 252 ]; then
echo
echo "And $((rows - 252)) more. The run has them all."
fi
echo
echo "Scanned $(date -u +%F) ([run]($run)). This issue is updated by each daily scan and closed when nothing is left."
echo
echo "**To fix:** take the fixed versions. For one of Pyo's images, bump its base image or the dependency. For a third-party image, take the fixed image (Renovate opens a pull request when it's published). Then cut a patch release (RELEASING.md, Security patch release). A CVE that doesn't apply goes in \`.trivyignore\` with the reason."
} > "$out.issue.md"

if [ -z "$issue" ]; then
gh issue create --title "$title" --label security --body-file "$out.issue.md"
exit 0
fi

before=$(gh issue view "$issue" --json body --jq .body | grep -oE '\[[A-Z]+-[A-Za-z0-9-]+\]' | tr -d '[]' | sort -u || true)
new=$(comm -13 <(echo "$before") <(echo "$ids" | sort -u) | paste -sd ' ' -)
gh issue edit "$issue" --title "$title" --body-file "$out.issue.md"
if [ -n "$new" ]; then
gh issue comment "$issue" --body "New since the last scan: $new"
fi
echo "Updated #$issue."
69 changes: 69 additions & 0 deletions .github/scripts/rebuild-issue.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# For the weekly Postgres rebuild check (postgres-rebuild.yml): compares
# the published image's HIGH and CRITICAL CVEs that have a fix with a
# fresh build's (trivy-scan.sh's published.json and fresh.json). While the
# fresh build has fewer, one issue per major version, labelled security,
# says a patch release would pick up the fixes. Closed once it doesn't.
# Needs GH_TOKEN and GH_REPO.
#
# rebuild-issue.sh <major> <published ref> <pinned base> <today's base>
set -euo pipefail
export LC_ALL=C

major=$1 published=$2 pinned=$3 today=$4
marker="<!-- pyo-postgres-rebuild: $major -->"
run="${GITHUB_SERVER_URL:-https://github.com}/${GH_REPO}/actions/runs/${GITHUB_RUN_ID:-0}"

ids() { jq -r '[.Results[]?.Vulnerabilities[]?.VulnerabilityID] | unique | .[]' "$1"; }
before=$(ids published.json)
after=$(ids fresh.json)
nb=$(grep -c . <<<"$before" || true)
na=$(grep -c . <<<"$after" || true)
fixed=$(comm -23 <(echo "$before") <(echo "$after") | sed '/^$/d')

echo "Postgres $major: the published image has $nb HIGH or CRITICAL CVEs with a fix, a fresh build has $na." \
| tee -a "${GITHUB_STEP_SUMMARY:-/dev/null}"

issue=$(gh issue list --state open --label security --limit 500 --json number,body \
| jq -r --arg m "$marker" 'map(select(.body | contains($m))) | .[0].number // empty')

if [ "$na" -ge "$nb" ]; then
if [ -n "$issue" ]; then
gh issue close "$issue" --comment "A rebuild on $(date -u +%F) no longer has fewer CVEs than \`$published\` ([run]($run))."
fi
exit 0
fi

{
echo "$marker"
echo "A fresh build of Pyo's Postgres $major image has $na HIGH or CRITICAL CVEs with a fix. The published \`$published\` has $nb. A patch release would pick up these fixes:"
echo
jq -r --argjson fixed "$(jq -Rnc '[inputs | select(length > 0)]' <<<"$fixed")" '
[.Results[]?.Vulnerabilities[]? | select(.VulnerabilityID as $id | $fixed | index($id))]
| unique_by([.VulnerabilityID, .PkgName])
| sort_by([(if .Severity == "CRITICAL" then 0 else 1 end), .VulnerabilityID])
| "| CVE | Severity | Package | Published has | Fixed in |",
"|---|---|---|---|---|",
(.[:250][] | "| [\(.VulnerabilityID)](\(.PrimaryURL // "https://osv.dev/vulnerability/\(.VulnerabilityID)")) | \(.Severity) | \(.PkgName) | \(.InstalledVersion) | \(.FixedVersion) |")
' published.json
echo
echo "The fresh build is the release's \`deploy/images/postgres.Dockerfile\` with this week's extension packages, on the base image of the same tag as it is today."
echo
if [ "$pinned" = "$today" ]; then
echo "The base is the one the release pins, so the fixes are in the packages the build installs. Cutting a patch release rebuilds the image with them."
else
echo "- The release pins \`$pinned\`"
echo "- Today it's \`$today\`"
echo
echo "Bump \`BASE_$major\` in \`deploy/images/postgres.Dockerfile\` to today's digest (Renovate's pull request does it), then cut a patch release."
fi
echo
echo "See RELEASING.md, Security patch release. Checked $(date -u +%F) ([run]($run)). This issue is updated each week and closed when a rebuild no longer fixes more."
} > rebuild.issue.md

title="Postgres $major: a rebuild has $((nb - na)) fewer CVEs"
if [ -n "$issue" ]; then
gh issue edit "$issue" --title "$title" --body-file rebuild.issue.md
else
gh issue create --title "$title" --label security --body-file rebuild.issue.md
fi
62 changes: 62 additions & 0 deletions .github/scripts/trivy-scan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# Scans an image, or this checkout's lockfiles, with Trivy for HIGH and
# CRITICAL CVEs that have a fixed version. Writes <out>.json (Trivy's
# report), <out>.sarif (for code scanning) and <out>.md (a table, empty
# when there's nothing), adds the table to the job's summary and sets the
# step outputs `critical` and `high`: how many CVEs of each.
#
# It never fails because of what it finds. The workflow decides.
# .trivyignore lists CVEs checked and found not to apply.
#
# trivy-scan.sh image <ref> <out>
# trivy-scan.sh fs <dir> <out>
set -euo pipefail

kind=$1 target=$2 out=$3
case "$kind" in
image) args=() ;;
# bun.lock's dev dependencies too: they run in CI and on our machines.
fs) args=(--include-dev-deps) ;;
*) echo "trivy-scan.sh: image or fs, not $kind" >&2; exit 2 ;;
esac

trivy "$kind" --scanners vuln --ignore-unfixed --severity HIGH,CRITICAL \
"${args[@]}" --format json --output "$out.json" "$target"
trivy convert --format sarif --output "$out.sarif" "$out.json"

# One row per CVE and package, CRITICAL first.
jq -r '
[.Results[]? | .Vulnerabilities[]?]
| unique_by([.VulnerabilityID, .PkgName, .InstalledVersion])
| sort_by([(if .Severity == "CRITICAL" then 0 else 1 end), .VulnerabilityID])
| if length == 0 then empty else
"| CVE | Severity | Package | Installed | Fixed in |",
"|---|---|---|---|---|",
(.[] | "| [\(.VulnerabilityID)](\(.PrimaryURL // "https://osv.dev/vulnerability/\(.VulnerabilityID)")) | \(.Severity) | \(.PkgName) | \(.InstalledVersion) | \(.FixedVersion) |")
end
' "$out.json" > "$out.md"

count() {
jq --arg s "$1" '[.Results[]?.Vulnerabilities[]? | select(.Severity == $s) | .VulnerabilityID] | unique | length' "$out.json"
}
critical=$(count CRITICAL)
high=$(count HIGH)

{
echo "### Trivy: \`$target\`"
echo
if [ -s "$out.md" ]; then
echo "$critical CRITICAL and $high HIGH with a fix."
echo
head -n 302 "$out.md"
else
echo "No HIGH or CRITICAL CVEs with a fix."
fi
echo
} >> "${GITHUB_STEP_SUMMARY:-/dev/stdout}"

if [ -n "${GITHUB_OUTPUT:-}" ]; then
echo "critical=$critical" >> "$GITHUB_OUTPUT"
echo "high=$high" >> "$GITHUB_OUTPUT"
fi
echo "$target: $critical CRITICAL, $high HIGH with a fix."
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,55 @@ jobs:
- run: scripts/install-railpack.sh
- run: cargo test --locked --workspace

# Known CVEs in the locked dependencies: Cargo.lock, bun.lock (with the
# dashboard's dev dependencies) and the WAF's go.mod. A CRITICAL one
# with a fix fails the check. HIGH ones are reported in the job's
# summary and in code scanning.
lockfiles:
name: Lockfile CVEs
runs-on: ubuntu-24.04
permissions:
contents: read
security-events: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/trivy
- name: Scan for CVEs
id: scan
run: .github/scripts/trivy-scan.sh fs . trivy
# A fork's pull request can't write to code scanning.
- uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
with:
sarif_file: trivy.sarif
category: lockfiles
- name: No CRITICAL CVE with a fix
if: steps.scan.outputs.critical != '0'
env:
CRITICAL: ${{ steps.scan.outputs.critical }}
run: |
echo "::error::The lockfiles have $CRITICAL CRITICAL CVEs with a fix (see the job's summary). Update those dependencies, or add a CVE that doesn't apply to .trivyignore with the reason."
exit 1

# cargo-deny, configured in deny.toml. RustSec advisories and crates
# from anywhere but crates.io fail the check. Licenses and banned or
# duplicate crates only warn for now (continue-on-error), until they're
# clean enough to enforce.
cargo-deny:
name: cargo-deny ${{ matrix.checks }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
checks: [advisories sources, bans licenses]
continue-on-error: ${{ matrix.checks == 'bans licenses' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
with:
rust-version: 1.99.1
command: check ${{ matrix.checks }}

# Pyo Sandbox end to end: real Firecracker microVMs on the runner's KVM.
# x64 only, as GitHub's arm runners have no KVM. The networking e2e
# changes the host's network as root, so it runs last.
Expand Down
109 changes: 109 additions & 0 deletions .github/workflows/postgres-rebuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Postgres rebuild check

# Every week: builds Pyo's Postgres images (16, 17 and 18) from the latest
# release's deploy/images/postgres.Dockerfile, with this week's extension
# packages and on the CloudNativePG base of the same tag as it is today,
# then scans each next to the published one. When the fresh build has
# fewer HIGH or CRITICAL CVEs with a fix, an issue (labelled security)
# says a patch release would pick up the fixes.
#
# Nothing is pushed anywhere. Pyo's images are published only by a tagged
# release, signed and versioned (release.yml).

on:
schedule:
- cron: "41 3 * * 1"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: postgres-rebuild

jobs:
release:
name: Latest release
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.release.outputs.tag }}
images: ${{ steps.release.outputs.images }}
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- name: Its tag and Postgres images
id: release
run: |
set -euo pipefail
tag=$(gh release view --json tagName --jq .tagName)
gh release download "$tag" --pattern release.json --dir release
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "images=$(jq -c '.images | {"16": .postgres16, "17": .postgres17, "18": .postgres18}' release/release.json)" >> "$GITHUB_OUTPUT"

check:
name: Postgres ${{ matrix.major }}
needs: release
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
strategy:
fail-fast: false
matrix:
major: ["16", "17", "18"]
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
MAJOR: ${{ matrix.major }}
PUBLISHED: ${{ fromJSON(needs.release.outputs.images)[matrix.major] }}
steps:
# This branch's scripts, and the release's Dockerfile beside them.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.release.outputs.tag }}
path: release
persist-credentials: false
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: The base, pinned and today
id: base
run: |
set -euo pipefail
pinned=$(sed -n "s/^ARG BASE_${MAJOR}=//p" release/deploy/images/postgres.Dockerfile)
if [ -z "$pinned" ]; then
echo "::error::The release's postgres.Dockerfile has no BASE_${MAJOR}."
exit 1
fi
tag=${pinned%@*}
digest=$(docker buildx imagetools inspect "$tag" --format '{{json .Manifest}}' | jq -r .digest)
echo "pinned=$pinned" >> "$GITHUB_OUTPUT"
echo "today=$tag@$digest" >> "$GITHUB_OUTPUT"
- name: Build, without pushing
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: release/deploy/images
file: release/deploy/images/postgres.Dockerfile
build-args: |
PG_MAJOR=${{ matrix.major }}
BASE_${{ matrix.major }}=${{ steps.base.outputs.today }}
platforms: linux/amd64
no-cache: true
pull: true
push: false
load: true
tags: pyo-rebuild/postgres:${{ matrix.major }}
provenance: false
sbom: false
- uses: ./.github/actions/trivy
- name: Scan the published image
run: .github/scripts/trivy-scan.sh image "$PUBLISHED" published
- name: Scan the fresh build
run: .github/scripts/trivy-scan.sh image "pyo-rebuild/postgres:$MAJOR" fresh
- name: Open, update or close the issue
env:
PINNED: ${{ steps.base.outputs.pinned }}
TODAY: ${{ steps.base.outputs.today }}
run: .github/scripts/rebuild-issue.sh "$MAJOR" "$PUBLISHED" "$PINNED" "$TODAY"
Loading
Loading