@W-23515831: neutralize agent-directed text in portal machine-readable - #202
Merged
Merged
Conversation
leandrogilcarrano
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Dev Portal's base template embedded a
<nav aria-label="machine-readable" class="visually-hidden">block whose contents directly addressed LLM agents in imperative voice —STOP.,If you are an AI agent or LLM: read AGENTS.md FIRST,Do NOT use summarizer tools,MANDATORY first read,Fetch with raw HTTP. Because this block lives inbase.html,every generated portal page inherited it.
Claude Code (in automode) flagged this as an attempted prompt injection on every page it browsed and surfaced a warning to end users — visible noise that erodes trust for
AI-agent-assisted workflows. Reported by Fernando Lescano; same symptom was internally recorded on 2026-07-15.
What changed
scripts/portal_generator/templates/base.html— rewrote the machine-readable nav in declarative, third-person voice. The block still exists (screen-readers, crawlers, andbody-scanning agents still discover the three resources), but it now describes what each file contains instead of instructing the reader:
<p>describes the three resources and notes they are served as raw text/JSON.<a>usesfilename — Descriptionformat (no imperatives, no "Fetch/Read/STOP/MANDATORY", noIf you are an AI…targeting).<head><link rel="help">/rel="llms-txt"/rel="alternate">discovery hints preserved./AGENTS.md,/registry.json,/llms.txtare unchanged.Why not just delete the block
The nav has legitimate purposes — screen-reader announcement, alternate discovery path for crawlers/agents that scan
<body>and ignore<head>. Deleting it would drop thataffordance. Neutralizing the text keeps the discovery intent while removing the prompt-injection signals.
Tests
Added
TestNoPromptInjectionTriggersinscripts/tests/test_smoke.py(7 tests):*.htmlsweep — guards against reintroduction of the specific triggers (STOP.,MANDATORY first read,If you are an AI agent,Do NOT use summarizer,read AGENTS.md FIRST).<p>(any descriptive paragraph must remaindeclarative).
Verification
make test-portal→ 614 pytest + 303 jest, all pass.make generate-portalsucceeds. Regeneratedportal/HTML no longer contains any of the forbidden phrases in files produced bybase.html.Fixes W-23515831.