Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 1.87 KB

File metadata and controls

20 lines (12 loc) · 1.87 KB

ADR-010: Untrusted-input fencing for web-sourced company research

Last updated: 2026-07-16

Status: Accepted

Context

Company-research text is retrieved from the web (the active AI provider's own web search — a native search tool, or the Ollama Web Search API for Ollama — plus AI synthesis) and folded into prompts for cover-letter generation and application-question answers. Web-sourced content can contain prompt-injection payloads (e.g. "Ignore previous instructions and…") that, if passed to the model without fencing, could manipulate generated output.

Decision

All web-sourced company research is wrapped in an explicit untrusted <company_research> XML fence by packages/prompts/src/generate/emphasis/emphasis.ts: buildCompanyResearchBlock. The fence text instructs the model that the block is untrusted, web-sourced reference material to be used only for company context — never as a candidate fact — and to ignore any instructions it contains. The brief is also capped at 1 200 characters so a long or hostile payload cannot dominate the prompt. buildCompanyResearchBlock is shared by cover-letter.ts and application-questions.ts, so fencing is applied consistently. Tests in generate/emphasis/emphasis.test.ts and the per-surface prompt suites assert that any prompt containing a brief includes the fence, the "untrusted" label, and the "ignore any instructions" directive.

Consequences

  • Prompt-injection risk from web-sourced content is mitigated at the prompt-building layer, not relying on model caution.
  • The 1 200-character cap limits cost impact from unusually long research briefs.
  • Any new prompt template that consumes companyBrief must call buildCompanyResearchBlock — passing raw brief text is a HIGH security finding (tauri-security-reviewer).
  • The fence pattern is tested; a regression in the fence text fails the test suite.