Skip to content

Commit 656b248

Browse files
fix(ci): boj-build passes context through env and posts only over https (#299)
## Summary This is one of the departure fixes the owner approved on 2026-11-14, and the same fix as hyperpolymath/chora-registry#116 (merged). `boj-build.yml` had two problems: - It wrote `${{ github.repository }}` and `${{ github.ref_name }}` directly into `run:`, which allows shell injection. - It POSTed in clear text to `http://boj-server.local:7700`. A GitHub-hosted runner can't resolve that mDNS name, so under `continue-on-error` the step always failed silently. ## Changes - The GitHub context goes through `env:`. The body is built with `jq -cn --arg`. - The URL comes from the `BOJ_SERVER_URL` secret or variable. With no URL set, the job does nothing. - curl runs with `--proto '=https'`, and an http URL skips with a warning (HTTPS-only rule). - Adds a concurrency group, `persist-credentials: false`, and a warning in place of `continue-on-error`. The duplicated actions-lock header lines are removed. - The `uses:` line is unchanged, so `actions.lock` needs no refresh. ## Verification - shellcheck passes on the extracted run script. - The script was run with the URL unset, with an http URL, and with an unreachable https URL. It exits 0 each time and logs why. --- _Generated by [Claude Code](https://claude.ai/code/session_0136P7ZoBy5xGnGDLk7wQ8jC)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6262892 commit 656b248

2 files changed

Lines changed: 65 additions & 8 deletions

File tree

‎.github/workflows/boj-build.yml‎

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,70 @@
11
# This workflow is managed by gh actions-lock.
22
# SPDX-License-Identifier: MPL-2.0
3-
# This workflow is managed by gh actions-lock.
4-
# This workflow is managed by gh actions-lock.
3+
#
4+
# OPTIONAL: BoJ Server Build Trigger.
5+
# Notifies a BoJ server that this repository was pushed, so its Casket
6+
# (ssg-mcp) cartridge rebuilds the site. The endpoint comes from the
7+
# BOJ_SERVER_URL secret or variable and must be https; the job is a no-op
8+
# when it is unset, and a non-fatal skip when the server is unreachable.
9+
# It used to POST in clear text to a hard-coded boj-server.local:7700, an
10+
# mDNS name a GitHub-hosted runner cannot resolve, so the step always failed,
11+
# and it wrote the GitHub context straight into the script text.
12+
# This is the form standards' and chora-registry's boj-build.yml use.
513
name: BoJ Server Build Trigger
14+
615
on:
716
push:
817
branches: [main, master]
918
workflow_dispatch:
19+
20+
# Cancel superseded runs; the job only sends a notification.
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
24+
1025
permissions:
1126
contents: read
27+
1228
jobs:
1329
trigger-boj:
30+
name: Trigger BoJ server
1431
runs-on: ubuntu-latest
15-
timeout-minutes: 10
32+
timeout-minutes: 5
1633
steps:
1734
- name: Checkout
1835
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36+
with:
37+
persist-credentials: false
38+
1939
- name: Trigger BoJ Server (Casket/ssg-mcp)
40+
# GitHub context goes through env, never into the script text.
41+
env:
42+
BOJ_URL: ${{ secrets.BOJ_SERVER_URL || vars.BOJ_SERVER_URL }}
43+
REPO_NAME: ${{ github.repository }}
44+
BRANCH_NAME: ${{ github.ref_name }}
2045
run: |
21-
# Send a secure trigger to boj-server to build this repository
22-
curl -X POST "http://boj-server.local:7700/cartridges/ssg-mcp/invoke" \
46+
set -euo pipefail
47+
48+
if [ -z "${BOJ_URL:-}" ]; then
49+
echo "BOJ_SERVER_URL not configured - skipping"
50+
exit 0
51+
fi
52+
case "$BOJ_URL" in
53+
https://*) ;;
54+
*)
55+
echo "::warning::BOJ_SERVER_URL is not an https URL - skipping (estate rule: HTTPS only)"
56+
exit 0
57+
;;
58+
esac
59+
60+
payload="$(jq -cn \
61+
--arg repo "$REPO_NAME" \
62+
--arg branch "$BRANCH_NAME" \
63+
--arg engine "casket" \
64+
'{repo: $repo, branch: $branch, engine: $engine}')"
65+
66+
curl -sSf --proto '=https' --max-time 60 -X POST \
67+
"${BOJ_URL%/}/cartridges/ssg-mcp/invoke" \
2368
-H "Content-Type: application/json" \
24-
-d "{\"repo\": \"${{ github.repository }}\", \"branch\": \"${{ github.ref_name }}\", \"engine\": \"casket\"}"
25-
continue-on-error: true
69+
--data "$payload" \
70+
|| echo "::warning::BoJ server unreachable - skipping (non-fatal)"

‎panic-attack_chora.deed‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,4 +147,16 @@
147147
:note "T0 syntax heuristics are labelled T0. A finding is never dressed up as a parser or dataflow proof; see docs/RECON-AND-EVIDENCE.adoc")
148148
(obligation
149149
:name "no-self-suppression"
150-
:note "suppressions live in a separate registry file (audits/assail-classifications_praxis.deed) so one hand cannot both add a defect and hide it"))
150+
:note "suppressions live in a separate registry file (audits/assail-classifications_praxis.deed) so one hand cannot both add a defect and hide it")
151+
; Declared egress for secret-bearing jobs (standards ADR-009; Hypatia RE001).
152+
; trigger-boj POSTs to the BoJ server named by BOJ_SERVER_URL (a secret or a
153+
; variable), over https only; nothing holds it to that host at run time.
154+
(egress
155+
:policy "standards ADR-009"
156+
(job
157+
:workflow ".github/workflows/boj-build.yml"
158+
:job "trigger-boj"
159+
:secrets ("BOJ_SERVER_URL")
160+
:endpoints ("secret:BOJ_SERVER_URL" "var:BOJ_SERVER_URL")
161+
:enforcement none
162+
:reason "optional build notification; the URL is configuration, held as a secret or a variable")))

0 commit comments

Comments
 (0)