Skip to content

doctor.sh never validates PULLWRIGHT_APPROVER_INSTALLATION_IDS is a well-formed JSON object, though lib/approver-token.sh's comment says it does

Id: TD-PPagop-26083012 · Status: open · Filed: 2026-08-30

lib/approver-token.sh’s approver_token_installation_id_for deliberately treats a set-but-malformed PULLWRIGHT_APPROVER_INSTALLATION_IDS (invalid JSON, or valid JSON that is not an object) as an empty map, falling through to the scalar PULLWRIGHT_APPROVER_INSTALLATION_ID — and its comment justifies this with ‘malformed configuration is exactly what scripts/doctor.sh exists to catch before this ever runs against it’. But scripts/doctor.sh has no such check: it only consumes the map through the same lenient resolver. On a multi-owner fleet a typo’d map therefore surfaces as misdirected diagnoses — either ‘the Approver App installation does not cover (owner act)’ (scalar set: every owner silently resolves to the default installation) or ‘no Approver App installation is configured for ’ (no scalar) — neither of which names the actual fix, correcting the JSON. Nothing is unsafe (the wrong installation’s token cannot see the other owner’s repositories, so writes fail 404 and doctor still goes red in the genuine multi-owner case), but the failure is diagnosed as an owner act when it is a one-character .env fix. Suggested fix: in scripts/doctor.sh’s Approver-credential component, when PULLWRIGHT_APPROVER_INSTALLATION_IDS is set, fail (or at least warn) if it is not valid JSON or not a JSON object, naming the variable — making the library comment’s claim true. Alternative: soften the lib/approver-token.sh comment to stop claiming doctor catches this.

Default: Add the explicit doctor check (fail when the map is set but not a valid JSON object) rather than softening the comment — the comment describes the right design, doctor just doesn’t implement it yet.

Section titled “Default: Add the explicit doctor check (fail when the map is set but not a valid JSON object) rather than softening the comment — the comment describes the right design, doctor just doesn’t implement it yet.”

Noticed while the Approver was judging https://github.com/Poetic-Poems/agent-ops/pull/1059.

Migrated to https://github.com/Pullwright/agent-ops/issues/2008.