Public: anyone can read this; nobody can change it.

sweep the escaped domain spelling; seed-release in-cluster API (#258, #263) #264

Merged opened this view on origin

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

immune-fixes → main 1 commit

  • Merged. immune-fixes was merged into main.

Review

Sign in to review this change.
2 files changed +30 −5
.forgejo/workflows/seed-release.yml +8 −2
@@ -12,8 +12,14 @@
1212 # published at build time (publish_seed) never do.
1313 #
1414 # Needs the same PLAT_PAT repo secret reseed.yml uses.
15 #
16 # The isolated pool's egress reaches in-cluster services ONLY — every API call
17 # goes through $REGISTRY; the public $FORGEJO_URL is for printed links, never
18 # for calling (issue #263: every firing failed while the API base was public).
19 # workflow_dispatch re-fires for the CURRENT genesis — idempotent (409 = done).
1520 name: seed-release
1621 on:
22 workflow_dispatch:
1723 push:
1824 branches: [main]
1925 paths:
@@ -54,7 +60,7 @@ jobs:
5460 - name: create release + attach seed
5561 run: |
5662 set -eu
57 API="$FORGEJO_URL/api/v1"
63 API="http://$REGISTRY/api/v1" # in-cluster — the pool cannot reach the public host
5864 AUTH="Authorization: token $PLAT_PAT"
5965 PROFILE=$(sed -n 's/^profile:[[:space:]]*//p' manifest.yaml | head -1)
6066 BODY=$(printf 'Gate-validated genesis seed (profile %s).\n\nManifest refs:\n```\n%s\n```\nPackage: %s/%s/-/packages\nFetch: SEED=latest bin/germinate (resolve_seed)' \
@@ -85,7 +91,7 @@ jobs:
8591 OWNER="${GITHUB_REPOSITORY%%/*}"; REPO_NAME="${GITHUB_REPOSITORY##*/}"
8692 code=$(curl -s -o /tmp/link.out -w '%{http_code}' -X POST \
8793 -H "Authorization: token $PLAT_PAT" \
88 "$FORGEJO_URL/api/v1/packages/$OWNER/generic/seed/-/link/$REPO_NAME")
94 "http://$REGISTRY/api/v1/packages/$OWNER/generic/seed/-/link/$REPO_NAME")
8995 case "$code" in
9096 201|204) echo "package $OWNER/seed linked to $GITHUB_REPOSITORY" ;;
9197 409) echo "package already linked" ;;
bin/lib.sh +22 −3
@@ -152,12 +152,31 @@ rewrite_identity_domain() { # $1=gitops $2=seed/old domain $3=new domain [$4=fl
152152 sedx=(-e "s/\*\.$pat/$W/g" -e "s/\.$pat/$attach_sent/g" \
153153 -e "s/$pat/$new_sent/g" -e "s/$A/$old/g" -e "s/$W/*.$old/g")
154154 else
155 # The domain has a SECOND cleartext spelling: regex-escaped, dots as `\.`
156 # (render_front_door's apex redirectRegex). The plain sweep cannot see it —
157 # sed's `\.` matches a real dot, and the escaped text has a backslash there
158 # instead — so gauntlet run 880: rehome moved the Host() rules but left the
159 # old domain inside the redirect regex; it never matched, the apex fell
160 # through to www as 200 and A12 failed. An identity's escaped spelling IS
161 # the identity: rewrite it FIRST (its output contains no plain-spelling
162 # $old, so the two passes cannot double), with the same shield for values
163 # already escaped-correct. $pat's literal characters ARE the escaped
164 # spelling; epat/enewpat match that text as regex, erep emits it through
165 # sed's replacement unescaping. (The flat sweep skips this: front-door is
166 # the only escaped-identity artifact and flat germination re-renders it.)
167 local epat enewpat erep ekeep='__MITOSIS_KEEP_ESCAPED_DOMAIN__'
168 epat=$(printf '%s' "$pat" | sed -e 's/\\/\\\\/g' -e 's/\./\\./g')
169 enewpat=$(printf '%s' "$newpat" | sed -e 's/\\/\\\\/g' -e 's/\./\\./g')
170 erep=$(printf '%s' "$newpat" | sed 's/\\/\\\\/g')
155171 case "$new" in
156 *"$old"*) sedx=(-e "s/$newpat/$keep/g" -e "s/$pat/$new/g" -e "s/$keep/$new/g") ;;
157 *) sedx=(-e "s/$pat/$new/g") ;;
172 *"$old"*) sedx=(-e "s/$enewpat/$ekeep/g" -e "s/$epat/$erep/g" -e "s/$ekeep/$erep/g"
173 -e "s/$newpat/$keep/g" -e "s/$pat/$new/g" -e "s/$keep/$new/g") ;;
174 *) sedx=(-e "s/$epat/$erep/g" -e "s/$pat/$new/g") ;;
158175 esac
159176 fi
160 grep -rIl --include='*.yaml' "$old" "$g/clusters/local" 2>/dev/null | while read -r f; do
177 # -F: fixed strings — select files carrying EITHER spelling ($pat's literal
178 # text is the escaped one). Plain-BRE "$old" would miss escaped-only files.
179 grep -rIlF --include='*.yaml' -e "$old" -e "$pat" "$g/clusters/local" 2>/dev/null | while read -r f; do
161180 sed -i.bak "${sedx[@]}" "$f" && rm -f "$f.bak"
162181 done
163182 # Verify the surgical invariant held: the CA tokens must SURVIVE intact. If they

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs