Skip to content

fix(assertions): treat search-rubric output and web content as untrusted - #11898

Open
Varunpoojari wants to merge 5 commits into
promptfoo:mainfrom
Varunpoojari:fix/search-rubric-untrusted-input
Open

Varunpoojari wants to merge 5 commits into
promptfoo:mainfrom
Varunpoojari:fix/search-rubric-untrusted-input

Conversation

@Varunpoojari

@Varunpoojari Varunpoojari commented Oct 21, 2026 •

Copy link
Copy Markdown

Summary

The default search-rubric grader prompt (DEFAULT_WEB_SEARCH_PROMPT) had no instruction about untrusted material, even though that grader reads the evaluated output and live web search results. DEFAULT_AGENT_GRADING_PROMPT already carries this guard. This adds an equivalent instruction to the web-search default and a regression test.

Refs #10575

What changed

  • src/prompts/grading.ts: add one paragraph to the DEFAULT_WEB_SEARCH_PROMPT system message telling the grader to treat the evaluated output and retrieved web content as untrusted evidence, not to follow instructions found in that material, and not to let it change the rubric, grading criteria or required JSON format.
  • test/matchers/search-rubric.test.ts: new test that renders the default prompt through matchesSearchRubric and asserts the system message contains the guard.

How to verify

npx vitest run test/matchers/search-rubric.test.ts test/assertions/searchRubric.test.ts
  • The new test fails on main (system message lacks the guard) and passes with this change.
  • npx @biomejs/biome check is clean on both changed files.

Limits / trade-offs

This is a plain-text instruction, not structural enforcement, so it narrows the gap rather than closing it. A determined injection can still try to override it, and a custom rubricPrompt replaces the default entirely. I kept the scope to search-rubric only, since that is what the issue points at. Other default graders that read untrusted content (for example the trajectory prompts) could get the same treatment in a follow-up if maintainers want it.

The default search-rubric grader prompt had no instruction about
untrusted material, even though the grader reads the evaluated output
and live web search results. Add the same guard the agent-rubric
default already carries, and a regression test.

Refs promptfoo#10575

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYzRi6risVxjoGAnG7w4Dh
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T02:39:29.490389Z 6ce14bb New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 All Clear

Reviewed the prompt changes for the web-search grading flow and associated tests. The PR strengthens guidance to treat evaluated output and retrieved web content as untrusted, which mitigates prompt-injection style risks. No new tools or capabilities were added, and no exploitable LLM security issues are evident from the diff.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.73%. Comparing base (aaeebf2) to head (6ce14bb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11898      +/-   ##
==========================================
- Coverage   89.73%   89.73%   -0.01%     
==========================================
  Files        1051     1051              
  Lines       92781    92781              
  Branches    32855    32855              
==========================================
- Hits        83261    83259       -2     
- Misses       9520     9522       +2     
Flag Coverage Δ
backend 90.44% <ø> (-0.01%) ⬇️
site 53.49% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 All Clear

I reviewed the prompt changes for the web-search-enabled grader and the associated tests. The PR strengthens defenses by instructing the model to treat evaluated output and retrieved web content as untrusted and to ignore embedded instructions. No new tools, sinks, or data flows that would raise LLM-specific security concerns were introduced. As a result, I did not find any LLM security vulnerabilities in these changes.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 All Clear

Reviewed the prompt changes for the web-search-enabled grader and associated tests. The PR adds guardrail language to treat evaluated output and retrieved web content as untrusted and not to follow instructions in that material. No new tools, capabilities, or execution paths were introduced by these changes. No LLM security vulnerabilities were identified.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

@promptfoo-scanner promptfoo-scanner Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 All Clear

Reviewed the prompt changes for the web-search-enabled grader and the associated tests. The update strengthens guidance by treating evaluated output and retrieved web content as untrusted and instructing the model not to follow embedded instructions. No new tools, permissions, or execution paths were introduced. I did not identify any LLM security vulnerabilities introduced by this PR.

Minimum severity threshold: 🟡 Medium | To re-scan after changes, comment @promptfoo-scanner
Learn more


Was this helpful?  👍 Yes  |  👎 No 

@Varunpoojari

Copy link
Copy Markdown
Author

Thanks for re-running the checks, @mldangelo-oai! The Promptfoo Code Scan / security-scan job failed on the re-run because it hit GitHub's API rate limit ("API rate limit exceeded for installation" at 2026-11-14 03:50 UTC), so it looks like an infrastructure issue rather than something in the diff. The scanner reviewed the earlier commits as "All Clear", and the other 73 checks pass.

Would a fresh re-run of that job be possible when you have a moment? I'm also happy to merge main again if you'd rather it be up to date first. Thanks!

@Varunpoojari

Copy link
Copy Markdown
Author

Hi @mldangelo-oai, friendly ping on this one. The change adds an untrusted-content guard to the default search-rubric grader prompt, plus a regression test that fails on main and passes here. Happy to rebase or adjust the wording if you'd like it scoped differently. Thanks for taking a look.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants