When handling security-sensitive interactions (authz/ownership, network callbacks, and untrusted execution), apply defense-in-depth at the boundaries: be precise about guarantees, bind authorization to explicit identities at creation time, validate inbound payloads before side effects, and isolate both execution and filesystem writes.
Practical rules: 1) Don’t overstate bypass behavior
2) Bind authorization explicitly; require exact-match on callbacks
3) Validate callback payload structure against stored state before calling responders
4) Only allow interactive actions for eligible inbound-human turns
5) Sandbox untrusted code with isolation parity; keep metadata out of the sandbox
gh calls or network calls that require credentials.6) Never write trusted outputs through untrusted worktrees
7) Constrain PR-facing writes to a single authorized path
Example (callback ingress validation pattern):
// 1) Owner-only: storedKey was recorded at card creation time.
const ok = normalizeOwner(callback.user) === storedKey;
if (!ok) return failClosed();
// 2) Answer-key defense-in-depth: indices must match stored questions.
const keys = Object.keys(payload.answers ?? {});
const valid = keys.every(k => {
const i = Number(k);
return Number.isInteger(i) && i >= 0 && i < storedQuestions.length;
});
if (!valid) return failClosed();
// 3) Only now call the responder/settlement.
await responder({ answers: payload.answers, ...otherFields });
Checklist your team can apply to any “interactive callback / bypass flag / untrusted execution” change: (authz binding) + (payload validation) + (eligibility definition) + (sandbox/credential boundaries) + (safe output path policy) + (single allowed write path).
Enter the URL of a public GitHub repository