Skip to content

fix(ctf): match vendor indicators as whole words - #551

Open
DevaanshPathak wants to merge 2 commits into
GenAI-Security-Project:mainfrom
DevaanshPathak:fix/issue-124-vendor-status-boundaries
Open

fix(ctf): match vendor indicators as whole words#551
DevaanshPathak wants to merge 2 commits into
GenAI-Security-Project:mainfrom
DevaanshPathak:fix/issue-124-vendor-status-boundaries

Conversation

@DevaanshPathak

@DevaanshPathak DevaanshPathak commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • match configured prohibited indicators as whole words in vendor agent notes
  • share the same boundary-aware matching logic across direct and gradual status-flip detectors
  • add regression coverage for substring false positives and valid whole-word matches on both activation paths

Root cause

Both status-flip detectors escaped indicator text before searching, but the matching logic was duplicated and did not consistently enforce word boundaries. As a result, an indicator such as denied could also match inside a larger word such as undenied.

Impact

This prevents false-positive vendor re-activation detections for both direct and indirect status transitions while preserving matches for genuine prohibited indicators.

Testing

  • uv run pytest tests/unit/ctf/test_vendor_status_flip_detector.py (4 passed)
  • uv run pytest tests/unit/ctf (31 passed, 1 skipped)

Fixes #124

Copilot AI review requested due to automatic review settings August 2, 2026 12:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the CTF vendor status-flip detection logic to avoid false positives caused by prohibited indicator substring matches in vendor agent_notes, and adds regression tests to validate the corrected matching behavior.

Changes:

  • Update VendorStatusFlipDetector to match prohibited indicators as whole words using regex word boundaries.
  • Add unit tests covering both the substring false-positive case and a valid whole-word match case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
finbot/ctf/detectors/implementations/vendor_status_flip.py Adds word-boundary matching for prohibited indicators in vendor agent notes to prevent substring false positives.
tests/unit/ctf/test_vendor_status_flip_detector.py Adds regression tests for substring false positives and correct whole-word matches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread finbot/ctf/detectors/implementations/vendor_status_flip.py Outdated
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.

Bug_027_MUST_FIX: Test Case DET-VSF-NEG-003 VendorStatusFlipDetector matches prohibited indicators as substrings and generates false positives

2 participants