| 1 | # shellcheck shell=bash |
| 2 | # Paths and fixtures come from the derivation environment. |
| 3 | # shellcheck disable=SC2154 |
| 4 | cue vet -c "$schema" "$registry"/*.cue |
| 5 | cue export "$schema" "$registry"/*.cue > registry.json |
| 6 | grep -q '"genesis": "operator"' registry.json |
| 7 | # The signing name is per key, not per entry: one entry holds keys signing |
| 8 | # under two different names, and that is what the compiler renders from. |
| 9 | grep -q '"signs": "workstation/attestations"' registry.json |
| 10 | grep -q '"signs": "operator"' registry.json |
| 11 | |
| 12 | # The registries the schema must reject, and the words each rejection must |
| 13 | # name. The floor's properties are here — mandatory expiry where a raw key |
| 14 | # is held, no external principal governing the registry, a genesis entry |
| 15 | # that governs it — and a rejection that stopped naming its field would be a |
| 16 | # floor nobody can act on. |
| 17 | while IFS=$'\t' read -r name names; do |
| 18 | case "$name" in '' | '#'*) continue ;; esac |
| 19 | if cue vet -c "$schema" "$rejected/$name.cue" > "$name.err" 2>&1; then |
| 20 | echo "identity-schema: expected invalid registry '$name' to be rejected" >&2 |
| 21 | exit 1 |
| 22 | fi |
| 23 | if [ -n "$names" ] && ! grep -qF -- "$names" "$name.err"; then |
| 24 | echo "identity-schema: '$name' was rejected without naming $names" >&2 |
| 25 | cat "$name.err" >&2 |
| 26 | exit 1 |
| 27 | fi |
| 28 | done < "$rejectedCases" |
| 29 | touch "$out" |