Files
buzz/deploy/charts/buzz-push-gateway/tests/runtime-options.sh
Tom Brow 25b58ab98f feat(push-gateway): verify Android Key Attestation (#9562)
## What and why

Ticket 3 of the Android push plan ([design PR
#9555](https://github.com/block/buzz/pull/9555)). The gateway now
verifies Android Key Attestation at enrollment instead of rejecting
every Android chain, and rate limits signed installation calls per
attested key.

Stacked on [#9560](https://github.com/block/buzz/pull/9560) (Android
enrollment and FCM wakes). This PR's base is that branch; it will be
retargeted once that merges.

- **Chain.** It must end at a configured Google attestation root
(Google's [published hardware
roots](https://developer.android.com/privacy-and-security/security-key-attestation#root_certificate)
are built in, pinned by public key), with valid signatures and issuer
links, CA issuers above the attestation key certificate, and no SHA-1
signatures. The attestation key certificate itself is exempt from the CA
flags, because some factory keyboxes issue it with CA:FALSE and
digitalSignature only (Google's Sony Xperia 10 III sample); a Keystore
leaf still cannot act as an issuer, since the extension is refused above
the leaf. Validity is enforced for Remote Key Provisioning chains;
Google tells verifiers to keep trusting the long-expired factory chains,
which the revocation list covers instead. The attestation extension must
be in the leaf and nowhere else. The leaf key must be EC P-256; it
becomes the installation's signing key.
- **KeyDescription.** Attestation and KeyMint security levels must be
TrustedEnvironment or StrongBox. The challenge must equal SHA-256 of the
enrollment transcript. Key properties (generated, EC, P-256, sign-only)
and the root of trust come only from the hardware-enforced list. The
bootloader must be locked, and the boot state Verified, or SelfSigned
with a verified boot key on an operator-configured list. The application
id (the one software-enforced value) must name exactly the configured
package with a configured signing digest.
- **Revocation.** A background task fetches Google's status list at
startup and then on its cache lifetime (5 minutes to 1 day), with a 30
second timeout, an 8 MiB size cap, capped exponential backoff and
jitter. Any REVOKED or SUSPENDED serial in the chain is rejected. With
no list yet, or a list older than the grace period, enrollment fails
closed. Enrollment reads an in-memory snapshot and never waits on a
fetch.
- **Rate limit.** Signed installation calls (delegate, revoke
delegation, rotate endpoint, revoke installation, on both platforms) are
limited per attested key. A call is counted only after its signature
verifies, so forged requests cannot spend another installation's
allowance. Counters are in memory per replica, bounded to 100,000 keys.
- **Dependencies.** None added. `x509-parser` gains its `verify-aws`
feature, which uses the `aws-lc-rs` the crate already depends on.

## Configuration

All optional; Android stays off unless the ticket 2 settings are
present. Documented in `docs/push-gateway-deployment.md` and
`.env.example` with example values only, and passed through
`deploy/charts/buzz-push-gateway` (disabled by default, schema-checked,
covered by `tests/runtime-options.sh`).

- `BUZZ_PUSH_ANDROID_BOOT_KEY_DIGESTS`: SHA-256 digests of verified boot
keys accepted with a SelfSigned boot state. Empty by default, so a
default gateway accepts stock Android only.
- `BUZZ_PUSH_ANDROID_ATTESTATION_ROOTS_PATH`: PEM bundle replacing the
built-in roots, for a reviewed root rollout. In the chart,
`android.attestationRoots.secretName` and `secretKey` mount it from a
Secret; an empty name keeps the built-in roots.
- `BUZZ_PUSH_ANDROID_REVOCATION_GRACE_SECONDS`: default 604800 (7 days),
minimum 3600.
- `BUZZ_PUSH_SIGNED_CALL_WINDOW_SECONDS` and
`BUZZ_PUSH_SIGNED_CALL_MAX_CALLS`: defaults 60 and 30.

## Tests

- `cargo test -p buzz-push-gateway` (all pass, 18 ignored), `cargo fmt
--all --check`, `cargo clippy -p buzz-push-gateway --all-targets -- -D
warnings`, and the chart tests (`render.sh`, `release-contract.sh`).
- Key Attestation chains are generated in the tests with a test root
injected as the configured root, and run through the production
verifier. One table rejects: unlocked bootloader, Unverified, Failed,
SelfSigned with an unlisted key, boot key only in the software list (two
variants), key properties only in the software list, extra key purposes,
wrong curve, wrong package, two packages, wrong signing digest, wrong
challenge, software-backed key (two variants), unknown root, forged leaf
signature, expired provisioned intermediate, extension repeated above
the leaf, non-P-256 leaf, a CA:FALSE certificate issuing the attestation
key certificate. Another accepts Verified with any boot key, SelfSigned
with a listed key, StrongBox and TrustedEnvironment, an expired factory
intermediate, and a CA:FALSE, digitalSignature attestation key
certificate. Revoked leaf, intermediate and root, a missing list and a
stale list are rejected. The status list parser and refresh (backoff,
cap, keeping the last list through failures) run against a scripted fake
source; no test touches the network.
- The per-key rate limit runs through the public router: forged calls do
not spend the allowance, the fourth authentic call is refused whatever
its kind, and another installation is unaffected.
- Break check: disabling the locked-bootloader guard and the rate limit
turned `rejected_attestations` and the rate limit test red; restored.

## Not here

The app side (ticket 7) generates the Keystore key and sends the chain.
The end to end run on a physical Android phone against a test gateway is
also still to do.

---------

Signed-off-by: Tom Brow <tomb@squareup.com>
2026-11-17 19:18:35 -08:00

298 lines
17 KiB
Bash

#!/usr/bin/env bash
set -euo pipefail
chart=deploy/charts/buzz-push-gateway
out=$(mktemp -d)
trap 'rm -rf "$out"' EXIT
helm template push "$chart" >"$out/default.yaml"
helm template push "$chart" \
--set-string 'podLabels.example\.com/runtime=gateway' \
--set serviceAccountName=mesh-gateway \
--set terminationGracePeriodSeconds=90 >"$out/runtime.yaml"
helm template push "$chart" --set networkPolicy.enabled=false \
--set networkPolicy.externalPolicyName=platform-runtime >"$out/external.yaml"
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
base, runtime, external = %w[default runtime external].map { |name| YAML.load_stream(File.read("#{ARGV[0]}/#{name}.yaml")).compact }
pod = runtime.find { |r| r['kind'] == 'Deployment' }.dig('spec', 'template')
raise 'runtime label missing' unless pod['metadata']['labels'].delete('example.com/runtime') == 'gateway'
raise 'service account missing' unless pod['spec'].delete('serviceAccountName') == 'mesh-gateway'
raise 'grace period missing' unless pod['spec']['terminationGracePeriodSeconds'] == 90
pod['spec']['terminationGracePeriodSeconds'] = 60
raise 'runtime options changed unrelated resources or selectors' unless runtime == base
expected = base.reject { |r| r['kind'] == 'NetworkPolicy' && r['metadata']['name'] == 'push-buzz-push-gateway' }
external.find { |r| r['kind'] == 'Deployment' }['metadata'].delete('annotations')
raise 'external policy mode changed migration isolation or other resources' unless external == expected
RUBY
reject() {
if helm template push "$chart" "$@" >"$out/invalid.log" 2>&1; then
echo "expected invalid runtime options to fail: $*" >&2
exit 1
fi
if ! grep -q 'schema' "$out/invalid.log"; then
cat "$out/invalid.log" >&2
exit 1
fi
}
reject --set networkPolicy.enabled=false
reject --set networkPolicy.enabled=false --set-string 'networkPolicy.externalPolicyName= '
reject --set networkPolicy.externalPolicyName=conflicting-policy
reject --set terminationGracePeriodSeconds=59
reject --set podLabels.invalid=true
# Android stays off by default, and enabling it needs a signing digest.
if grep -q 'BUZZ_PUSH_ANDROID\|BUZZ_PUSH_FCM' "$out/default.yaml"; then
echo 'default values must leave Android disabled' >&2
exit 1
fi
digest=$(printf 'ab%.0s' {1..32})
helm template push "$chart" --set android.enabled=true \
--set "android.signingCertDigests[0]=$digest" >"$out/android.yaml"
for needle in BUZZ_PUSH_ANDROID_PACKAGE_NAME "$digest" BUZZ_PUSH_ANDROID_BOOT_KEY_DIGESTS \
BUZZ_PUSH_ANDROID_REVOCATION_GRACE_SECONDS BUZZ_PUSH_FCM_SERVICE_ACCOUNT_PATH; do
grep -q "$needle" "$out/android.yaml" || { echo "Android render lacks $needle" >&2; exit 1; }
done
if grep -q 'ATTESTATION_ROOTS\|android-attestation' "$out/android.yaml"; then
echo 'an empty attestationRoots.secretName must keep the built-in roots' >&2
exit 1
fi
helm template push "$chart" --set android.enabled=true \
--set "android.signingCertDigests[0]=$digest" \
--set android.attestationRoots.secretName=attestation-roots >"$out/android-roots.yaml"
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
docs = YAML.load_stream(File.read("#{ARGV[0]}/android-roots.yaml")).compact
pod = docs.find { |r| r['kind'] == 'Deployment' }.dig('spec', 'template', 'spec')
gateway = pod['containers'].find { |c| c['name'] == 'gateway' }
env = gateway['env'].find { |e| e['name'] == 'BUZZ_PUSH_ANDROID_ATTESTATION_ROOTS_PATH' }
raise 'roots override env missing' unless env && env['value'] == '/run/buzz/android-attestation/roots.pem'
mount = gateway['volumeMounts'].find { |m| m['name'] == 'android-attestation-roots' }
raise 'roots override mount missing' unless mount && mount['mountPath'] == '/run/buzz/android-attestation'
volume = pod['volumes'].find { |v| v['name'] == 'android-attestation-roots' }
expected = { 'secretName' => 'attestation-roots', 'items' => [{ 'key' => 'android-attestation-roots.pem', 'path' => 'roots.pem' }] }
raise "roots override volume wrong: #{volume.inspect}" unless volume && volume['secret'] == expected
RUBY
helm template push "$chart" --set android.attestationRoots.secretName=attestation-roots >"$out/roots-disabled.yaml"
cmp -s "$out/default.yaml" "$out/roots-disabled.yaml" || { echo 'roots override must not render while Android is disabled' >&2; exit 1; }
reject --set android.attestationRoots.secretName=attestation-roots --set-string android.attestationRoots.secretKey=
reject --set android.enabled=true
reject --set 'android.signingCertDigests[0]=abcd'
reject --set 'android.bootKeyDigests[0]=zz'
reject --set android.revocationGraceSeconds=60
reject --set signedCallRateLimit.maxCalls=0
for label in name instance component; do
reject --set-string "podLabels.app\\.kubernetes\\.io/$label=override"
done
# Kubernetes NetworkPolicy names are DNS subdomains, not single DNS labels.
long_name=$(printf '%0253d' 0)
for name in runtime.platform.example "$long_name"; do
helm template push "$chart" --set networkPolicy.enabled=false \
--set-string "networkPolicy.externalPolicyName=$name" >/dev/null
done
for name in "$long_name"x .runtime runtime. runtime..example Runtime runtime.-example; do
reject --set networkPolicy.enabled=false --set-string "networkPolicy.externalPolicyName=$name"
done
# Parent policy owns scrape access in external mode. Internal policy retains its guard.
helm template push "$chart" --set networkPolicy.enabled=false \
--set networkPolicy.externalPolicyName=platform-runtime \
--set podMonitor.enabled=true >"$out/external-monitor.yaml"
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out/external-monitor.yaml" <<'RUBY'
resources = YAML.load_stream(File.read(ARGV[0])).compact
raise 'PodMonitor missing in external mode' unless resources.any? { |r| r['kind'] == 'PodMonitor' }
policies = resources.select { |r| r['kind'] == 'NetworkPolicy' }
raise 'external mode must retain only migration policy' unless policies.map { |r| r['metadata']['name'] } == ['push-buzz-push-gateway-migration']
RUBY
reject --set podMonitor.enabled=true
reject --set podMonitor.enabled=true --set networkPolicy.monitoring.enabled=true
# External ownership replaces runtime egress only; migration still needs DB/DNS.
helm template push "$chart" --set networkPolicy.enabled=false \
--set networkPolicy.externalPolicyName=platform-runtime \
--set-json 'networkPolicy.apnsEgressCidrs=[]' >/dev/null
reject --set-json 'networkPolicy.apnsEgressCidrs=[]'
reject --set networkPolicy.enabled=false --set networkPolicy.externalPolicyName=platform-runtime \
--set-json 'networkPolicy.postgresEgressCidrs=[]'
reject --set networkPolicy.enabled=false --set networkPolicy.externalPolicyName=platform-runtime \
--set networkPolicy.dns=null
reject --set terminationGracePeriodSeconds=null
# Kubernetes DNS-subdomain service accounts and qualified label keys.
for name in '' runtime.platform.example "$long_name"; do
helm template push "$chart" --set-string "serviceAccountName=$name" >/dev/null
done
for name in INVALID_NAME ' ' "$long_name"x .runtime runtime. runtime..example; do
reject --set-string "serviceAccountName=$name"
done
long_label=$(printf '%063d' 0)
for key in 'example.com/Runtime_v1' "$long_label" "$long_name/$long_label"; do
helm template push "$chart" --set-json "podLabels={\"$key\":\"valid_value\"}" >/dev/null
done
for key in 'bad key' '/name' 'prefix/' 'UPPER.example/name' 'a/b/c' "$long_label"x "$long_name"x/name; do
reject --set-json "podLabels={\"$key\":\"value\"}"
done
reject --set-json 'podLabels={"valid":"bad value"}'
# Combined parent render gate: mutations must fail without emitting manifests.
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
resources = YAML.load_stream(File.read("#{ARGV[0]}/external.yaml")).compact
pod = resources.find { |r| r['kind'] == 'Deployment' }
policy = {'apiVersion' => 'networking.k8s.io/v1', 'kind' => 'NetworkPolicy',
'metadata' => {'name' => 'platform-runtime'},
'spec' => {'podSelector' => {'matchLabels' => pod.dig('spec', 'selector', 'matchLabels').dup},
'policyTypes' => %w[Ingress Egress], 'ingress' => [], 'egress' => []}}
File.write("#{ARGV[0]}/combined.yaml", (resources + [policy]).map(&:to_yaml).join)
list = {'apiVersion' => 'v1', 'kind' => 'List', 'items' => [policy]}
File.write("#{ARGV[0]}/list.yaml", (resources + [list]).map(&:to_yaml).join)
File.write("#{ARGV[0]}/duplicate-list.yaml", (resources + [policy, list]).map(&:to_yaml).join)
typed_list = {'apiVersion' => 'networking.k8s.io/v1', 'kind' => 'NetworkPolicyList', 'items' => [policy]}
File.write("#{ARGV[0]}/typed-list.yaml", (resources + [typed_list]).map(&:to_yaml).join)
File.write("#{ARGV[0]}/duplicate-typed-list.yaml", (resources + [policy, typed_list]).map(&:to_yaml).join)
expression_policy = Marshal.load(Marshal.dump(policy))
identity = expression_policy['spec']['podSelector'].delete('matchLabels')
expression_policy['spec']['podSelector']['matchExpressions'] = identity.map { |k, v| {'key' => k, 'operator' => 'In', 'values' => [v]} }
File.write("#{ARGV[0]}/expression-identity.yaml", (resources + [expression_policy]).map(&:to_yaml).join)
%w[helm.sh/hook argocd.argoproj.io/hook].each_with_index do |key, i|
wrapped = Marshal.load(Marshal.dump(typed_list))
wrapped['metadata'] = {'annotations' => {key => i == 0 ? 'pre-upgrade' : 'PreSync'}}
File.write("#{ARGV[0]}/wrapped-hook-#{i}.yaml", (resources + [wrapped]).map(&:to_yaml).join)
end
defaulted = Marshal.load(Marshal.dump(policy))
defaulted['spec'].delete('policyTypes')
defaulted['spec']['egress'] = [{'ports' => [{'protocol' => 'TCP', 'port' => 443}]}]
File.write("#{ARGV[0]}/defaulted-types.yaml", (resources + [defaulted]).map(&:to_yaml).join)
variants = {
'invalid-key' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'bad key', 'operator' => 'DoesNotExist'}] },
'invalid-value' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'absent', 'operator' => 'NotIn', 'values' => ['bad value']}] },
'numeric-value' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'absent', 'operator' => 'NotIn', 'values' => [123]}] },
'unknown-operator' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'absent', 'operator' => 'Unknown'}] },
'empty-notin' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'absent', 'operator' => 'NotIn', 'values' => []}] },
'valued-exists' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'app.kubernetes.io/name', 'operator' => 'Exists', 'values' => ['buzz-push-gateway']}] },
'argo-skip' => ->(p) { p['metadata']['annotations'] = {'argocd.argoproj.io/hook' => 'Skip'} },
'argo-presync' => ->(p) { p['metadata']['annotations'] = {'argocd.argoproj.io/hook' => 'PreSync', 'argocd.argoproj.io/hook-delete-policy' => 'HookSucceeded'} },
'hook-policy' => ->(p) { p['metadata']['annotations'] = {'helm.sh/hook' => 'pre-install', 'helm.sh/hook-delete-policy' => 'hook-succeeded'} },
'misspelled' => ->(p) { p['metadata']['name'] = 'typo' },
'wrong-selector' => ->(p) { p['spec']['podSelector']['matchLabels']['app.kubernetes.io/instance'] = 'other' },
'empty-selector' => ->(p) { p['spec']['podSelector'] = {} },
'wrong-namespace' => ->(p) { p['metadata']['namespace'] = 'other' },
'ingress-only' => ->(p) { p['spec']['policyTypes'] = ['Ingress'] },
'wrong-expression' => ->(p) { p['spec']['podSelector']['matchExpressions'] = [{'key' => 'absent', 'operator' => 'Exists'}] }
}
variants.each do |name, mutate|
changed = Marshal.load(Marshal.dump(policy))
mutate.call(changed)
File.write("#{ARGV[0]}/#{name}.yaml", (resources + [changed]).map(&:to_yaml).join)
end
RUBY
gate() { env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby "$chart/tests/check-external-policy.rb"; }
gate <"$out/default.yaml" >"$out/gated.yaml"
cmp "$out/default.yaml" "$out/gated.yaml"
gate <"$out/combined.yaml" >"$out/gated.yaml"
cmp "$out/combined.yaml" "$out/gated.yaml"
gate <"$out/list.yaml" >"$out/gated.yaml"
cmp "$out/list.yaml" "$out/gated.yaml"
for valid in defaulted-types typed-list expression-identity; do
gate <"$out/$valid.yaml" >"$out/gated.yaml"
cmp "$out/$valid.yaml" "$out/gated.yaml"
done
for mutation in wrapped-hook-0 wrapped-hook-1 duplicate-typed-list argo-skip argo-presync invalid-key invalid-value numeric-value unknown-operator empty-notin valued-exists duplicate-list external hook-policy misspelled wrong-selector empty-selector wrong-namespace ingress-only wrong-expression; do
if gate <"$out/$mutation.yaml" >"$out/gated.yaml" 2>"$out/gate-error"; then
echo "expected combined-render gate to reject $mutation" >&2
exit 1
fi
test ! -s "$out/gated.yaml"
grep -q 'external policy' "$out/gate-error"
done
# Helm assigns omitted namespaces to the actual release namespace.
helm template push "$chart" --namespace tenant-runtime --set networkPolicy.enabled=false \
--set networkPolicy.externalPolicyName=platform-runtime >"$out/tenant.yaml"
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
resources = YAML.load_stream(File.read("#{ARGV[0]}/tenant.yaml")).compact
policy = YAML.load_stream(File.read("#{ARGV[0]}/combined.yaml")).compact.last
{'omitted' => nil, 'empty' => '', 'explicit' => 'tenant-runtime', 'default' => 'default', 'wrong' => 'other'}.each do |variant, namespace|
candidate = Marshal.load(Marshal.dump(policy))
candidate['metadata']['namespace'] = namespace if namespace
File.write("#{ARGV[0]}/tenant-#{variant}.yaml", (resources + [candidate]).map(&:to_yaml).join)
end
# Missing release metadata must fail closed rather than assume default.
resources.find { |r| r['kind'] == 'Deployment' }['metadata']['annotations'].delete('buzz.block.xyz/release-namespace')
File.write("#{ARGV[0]}/tenant-missing-annotation.yaml", (resources + [policy]).map(&:to_yaml).join)
RUBY
for variant in omitted empty explicit; do
gate <"$out/tenant-$variant.yaml" >"$out/gated.yaml"
cmp "$out/tenant-$variant.yaml" "$out/gated.yaml"
done
for variant in default wrong missing-annotation; do
if gate <"$out/tenant-$variant.yaml" >"$out/gated.yaml" 2>"$out/gate-error"; then
echo "expected release-namespace gate to reject $variant" >&2
exit 1
fi
test ! -s "$out/gated.yaml"
grep -q 'external policy' "$out/gate-error"
done
# Valid parent YAML aliases in unrelated resources must pass through unchanged.
cat "$out/combined.yaml" >"$out/aliases.yaml"
cat >>"$out/aliases.yaml" <<'YAML'
---
apiVersion: v1
kind: ConfigMap
metadata:
name: unrelated
data:
first: &shared "value"
second: *shared
date: 2026-10-06
timestamp: 2026-10-06T16:00:00Z
YAML
gate <"$out/aliases.yaml" >"$out/gated.yaml"
cmp "$out/aliases.yaml" "$out/gated.yaml"
# Standard YAML scalars must not enable arbitrary Ruby object construction.
printf '%s\n' '--- !ruby/object:Object {}' >"$out/ruby-object.yaml"
if gate <"$out/ruby-object.yaml" >"$out/gated.yaml" 2>"$out/gate-error"; then
echo 'expected Ruby object tag to be rejected' >&2
exit 1
fi
test ! -s "$out/gated.yaml"
grep -q 'DisallowedClass' "$out/gate-error"
# Helm 3 excludes hooks from post-renderer stdin. The complete template stream
# must reject a hook colliding with an otherwise valid ordinary replacement.
mkdir -p "$out/parent/templates"
printf 'apiVersion: v2\nname: policy-hook-fixture\nversion: 0.1.0\n' >"$out/parent/Chart.yaml"
cp "$out/combined.yaml" "$out/parent/templates/runtime.yaml"
cat >"$out/parent/templates/hook.yaml" <<'YAML'
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: platform-runtime
annotations:
helm.sh/hook: pre-upgrade
helm.sh/hook-delete-policy: before-hook-creation,hook-succeeded
spec:
podSelector: {}
policyTypes: [Ingress, Egress]
YAML
if [[ $(helm version --short) == v3.* ]]; then
helm template push "$out/parent" --is-upgrade --post-renderer "$chart/tests/check-external-policy.rb" >"$out/post-rendered.yaml"
fi
if helm template push "$out/parent" --is-upgrade | gate >"$out/gated.yaml" 2>"$out/gate-error"; then
echo 'expected complete render to reject a hook collision' >&2
exit 1
fi
test ! -s "$out/gated.yaml"
grep -q 'external policy' "$out/gate-error"
# External-mode callers must bind expectations independently of the marker.
env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby -ryaml - "$out" <<'RUBY'
resources = YAML.load_stream(File.read("#{ARGV[0]}/combined.yaml")).compact
pod = resources.find { |r| r['kind'] == 'Deployment' }
pod['metadata'].delete('annotations')
File.write("#{ARGV[0]}/missing-marker.yaml", resources.map(&:to_yaml).join)
RUBY
if env -u GEM_HOME -u GEM_PATH -u RUBYLIB -u RUBYOPT ruby "$chart/tests/check-external-policy.rb" --expect push-buzz-push-gateway platform-runtime default <"$out/missing-marker.yaml" >"$out/gated.yaml" 2>"$out/gate-error"; then
echo 'expected strict gate to reject removed marker' >&2
exit 1
fi
test ! -s "$out/gated.yaml"
grep -q 'missing or overwritten ownership marker' "$out/gate-error"