mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
S1. The journey signs in with a real account and POSTs that account's password to whatever BASE_URL names, and the workflow took BASE_URL as free text. Anyone with repo write, or a leaked token, could dispatch the run at a collector of their own and keep a working credential; secret masking guards the log, never the egress. The host now has to be on a short const allowlist in the script, checked before anything is sent, with exit 2 and a named refusal otherwise. The workflow input is a choice between the two hosted instances, so the form cannot offer a third; the script's own check still stands behind it for a dispatch that goes round the form. --self-test covers the refusal, the prefix lookalike a startsWith check would have waved through included.
74 lines
2.8 KiB
YAML
74 lines
2.8 KiB
YAML
# Synthetic post-deploy journey.
|
|
#
|
|
# `post-publish-verify.yml` proves the published image boots. This one
|
|
# proves that on a running instance a person can sign in, write a reading
|
|
# and read it back, and that the instance serves the version that was just
|
|
# published.
|
|
#
|
|
# Deliberately manual for now: the maintainer picks the target instance and
|
|
# creates the two repository secrets. Nothing calls this from the deploy
|
|
# path yet.
|
|
#
|
|
# Secrets, both required:
|
|
# SYNTHETIC_USERNAME — the probe account's username or email
|
|
# SYNTHETIC_PASSWORD — its password
|
|
#
|
|
# The probe account must be password-only (the password flow stops at the
|
|
# MFA ticket, which the script reports as a configuration failure), and the
|
|
# target must not be the demo instance, where every mutation is blocked.
|
|
name: Synthetic journey
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
# A closed list, not free text. The dispatcher chooses where the probe
|
|
# account's password is POSTed, so the choice is between the hosted
|
|
# instances and nothing else. The script re-checks the host against its
|
|
# own const allowlist and exits 2 on anything else, so a dispatch that
|
|
# goes round this form still cannot reach a stranger's collector.
|
|
base_url:
|
|
description: Instance to walk
|
|
required: true
|
|
type: choice
|
|
default: https://review.healthlog.dev
|
|
options:
|
|
- https://review.healthlog.dev
|
|
- https://healthlog.bombeck.io
|
|
expected_version:
|
|
description: Version the instance must serve, e.g. v1.38.13
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
journey:
|
|
name: Sign in, write a reading, read it back
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 10
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version: 22
|
|
|
|
# A check that cannot fail is worse than none. The self-test walks the
|
|
# journey against an in-process instance once per leg with that leg
|
|
# broken, and fails if any of them still comes back green.
|
|
- name: Prove the check can go red
|
|
run: node scripts/synthetic-journey.mjs --self-test
|
|
|
|
# Every input and secret rides an env var — never interpolated into
|
|
# the shell command. The script refuses a `BASE_URL` whose host is off
|
|
# its allowlist before it sends the password anywhere.
|
|
- name: Walk the journey
|
|
env:
|
|
BASE_URL: ${{ inputs.base_url }}
|
|
EXPECTED_VERSION: ${{ inputs.expected_version }}
|
|
SYNTHETIC_USERNAME: ${{ secrets.SYNTHETIC_USERNAME }}
|
|
SYNTHETIC_PASSWORD: ${{ secrets.SYNTHETIC_PASSWORD }}
|
|
run: node scripts/synthetic-journey.mjs
|