Dev.to Security πŸ” Cybersecurity πŸ‘ 2 πŸ“– 5 min read

DoorDash Allergy Shield stops the checkout when Claude Code puts an allergen in your cart

Auto Mode gates the checkout, not the cart When the DoorDash team gave me CLI access, the thing I liked most was that Auto Mode stopped at order submit --cart-uuid. That is exactly the action I want to approve myself.

DoorDash Allergy Shield stops the checkout when Claude Code puts an allergen in your cart

Auto Mode gates the checkout, not the cart

When the DoorDash team gave me CLI access, the thing I liked most was that Auto Mode stopped at order submit --cart-uuid. That is exactly the action I want to approve myself.

// Detect dark theme var iframe = document.getElementById('tweet-2078942369148514637-556'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2078942369148514637&theme=dark" }

That gate is about authority, not content. The permission prompt tells you a checkout is about to happen. It does not tell you that something in the cart is pad thai and that pad thai is peanuts. And Claude has no cross-session memory: you say β€œI am allergic to peanuts” today, and tomorrow, in a fresh session, nobody has ever heard of it.

doordash-allergy-shield is the piece that carries that fact across sessions and puts a deterministic check in front of the checkout URL.

What the shield installs

Three components, three commands:

npx claude-code-templates@latest --skill doordash/doordash-allergy-shield
npx claude-code-templates@latest --hook doordash/doordash-allergy-checkout-gate
npx claude-code-templates@latest --command doordash/doordash-profile

The skill lands in .claude/skills/doordash-allergy-shield/ with references/allergen-synonyms.md beside the SKILL.md, the command in .claude/commands/doordash-profile.md, and the hook script in .claude/hooks/ with its PreToolUse registration. The skill is the protocol Claude follows. The command is how the profile gets edited. The hook is the only part that is not a model decision.

It is one of five DoorDash skills I published together.

// Detect dark theme var iframe = document.getElementById('tweet-2078998261814235282-342'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2078998261814235282&theme=dark" }

The profile, and which tier actually has teeth

State lives in ~/.claude/doordash-profile/dietary.json:

{
  "people": {
    "me": {
      "allergens": [
        { "name": "peanut", "severity": "anaphylaxis" },
        { "name": "shellfish", "severity": "avoid" }
      ],
      "diets": ["vegetarian"],
      "dislikes": ["cilantro"]
    }
  }
}

Three severity tiers:

  1. anaphylaxis: hook enforced, not waivable in session.
  2. avoid: Claude presents the conflict, the item stays only with explicit acknowledgment.
  3. preference: mentioned in passing, never gated.

Only the top tier has teeth. A profile with no anaphylaxis entry means the hook exits without checking anything and the whole bundle is conversational. Worth knowing before you file every restriction as avoid and expect the gate to fire.

Edits go through /doordash-profile (show, add, edit, rm), which interviews you per person and asks for the tier explicitly instead of assuming it. Downgrading an anaphylaxis entry makes you type the allergen name back. Deliberate friction in the dangerous direction.

The tripwire

After every cart mutation the skill runs dd-cli cart show, checks each line against the profile and against the synonyms table (satay to peanut, aioli to egg, ponzu to soy and fish), removes anything at anaphylaxis tier, and writes the full raw cart show output plus a verdict and an ISO timestamp to ~/.claude/doordash-profile/vetted/<cart-uuid>.json.

At checkout the checkout gate hook runs on the Bash tool before the command does. Three things block it with exit 2:

  1. No vetted dump exists for that cart uuid.
  2. The dump is older than the last recorded cart mutation. The same hook timestamps add-items, remove-item and reorder into a mutations/ directory, and never blocks on those.
  3. The dump text contains an anaphylaxis allergen name or one of the synonyms the hook hardcodes.

Exit 2 is the documented way for a PreToolUse hook to block a tool call, and the hook’s stderr is the message that comes back, so the block arrives as a sentence naming the cart and the keyword that tripped.

The design point is in that third condition: the hook greps the artifact, not Claude’s claim that it checked. It fires the same whether the checkout goes through dd-cli order checkout-url directly or through the dd-guard.sh wrapper from doordash-spend-guard, so the money gate and the allergy gate compose on one command.

// Detect dark theme var iframe = document.getElementById('tweet-2082172114010775954-44'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2082172114010775954&theme=dark" }

Where it stops being deterministic

Some of this the skill states up front. Some of it comes out of reading the hook.

  • Matching is substring against item names and descriptions. β€œoat” matches inside β€œgoat cheese”. False positives are the intended trade: blocking a safe bowl is cheap, the reverse is not.
  • The synonym lookup matches in both directions, so a profile entry named peanut also pulls in the tree nut list (pesto, marzipan, korma) because nut is a key. More over-blocking.
  • references/allergen-synonyms.md is broader than what the hook enforces. The hook carries its own compact dict. The SKILL.md says this plainly, and the closing note of the reference file contradicts it by claiming the hook list is derived from those sections. It is not, and adding a synonym to the reference alone changes nothing at the gate.
  • The dump is written by the model. The hook verifies that it exists, that it is fresh, and what is in it, but not that it reflects the real cart. β€œNever write a vetted dump without running cart show fresh” is a rule in the SKILL.md, not an enforcement.
  • The matcher is Bash, which is an exact tool-name match. If ordering ever moves to an MCP server, the gate stops covering it. Matching MCP tools takes a pattern like mcp__doordash__.*.
  • The script exits 0 when python3 is not on PATH. Exit 0 does not mean allow, the call just continues through the normal permission flow, but either way there is no allergy check. To fail closed instead, onFailure: "block" on the handler is the documented switch (Claude Code 2.1.295 or later).
  • The SKILL.md frontmatter carries a tags key, which is not in the Agent Skills spec (name, description, license, compatibility, metadata, allowed-tools). Claude Code ignores unknown keys so it runs fine, but the same file fails validation if you upload it to claude.ai.

And the limit the skill puts first: this is a tripwire against agent mistakes, not a medical device. It cannot see full ingredient lists and knows nothing about what happens in the kitchen. The DoorDash payment page, where a human reads the real order, is still the last check.

Where the DoorDash skills live

You can follow me on my social media:

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.