Skip to content

Comments

Injection detection is too strict, and caused a false positive when I used "repeatable" in a PR description#32

Merged
dgageot merged 1 commit intodocker:mainfrom
derekmisler:overly-aggressive-injection-detection
Feb 9, 2026
Merged

Injection detection is too strict, and caused a false positive when I used "repeatable" in a PR description#32
dgageot merged 1 commit intodocker:mainfrom
derekmisler:overly-aggressive-injection-detection

Conversation

@derekmisler
Copy link
Contributor

@derekmisler derekmisler commented Feb 5, 2026

Summary

Fixes overly aggressive injection detection patterns that were causing false positives in legitimate content. The security filter was incorrectly flagging content containing words like "system models" in release notes due to overly broad regex patterns. This update makes the patterns more specific while maintaining security effectiveness.

Changes

Modified

  • security/sanitize-input.sh - Refined regex patterns to reduce false positives while maintaining security
  • tests/test-security.sh - Added comprehensive test cases for both false positive prevention and continued security coverage

Technical Details

The injection detection system was using overly broad patterns that matched legitimate technical content:

Key changes:

  • system.*mode pattern: Changed from "system.*mode" to "system.{0,20}mode([^a-z]|$)" to avoid matching compound words like "system models" while still catching actual "system mode" injection attempts
  • repeat.*system.*prompt pattern: Made more specific by requiring "repeat.*(your|the|back).*system.*prompt" to target actual prompt extraction attempts
  • show.*system.*prompt pattern: Similarly refined to "show.*(your|the).*system.*prompt" to be more targeted

The original patterns were causing false positives when legitimate technical documentation mentioned:

  • "system models" (in AI/ML contexts)
  • "repeatable" (in general usage)
  • Other compound words containing these substrings

Testing

  • Added Test 16: Verifies release notes with "system models" are not flagged as false positives
  • Added Test 17: Confirms real "system mode" injection attempts are still properly blocked
  • Existing security tests continue to pass
  • Manual testing with the original false positive case

Test coverage:

  • False positive prevention for legitimate technical content
  • Continued detection of actual injection attempts
  • Regression testing for the specific "repeatable" case mentioned in the PR title

Breaking Changes

None - this change only reduces false positives while maintaining the same security protection level.

Related Issues

Fixes the false positive issue where using "repeatable" in PR descriptions triggered injection detection warnings.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Security implications carefully considered
  • Comprehensive test cases added
  • Tests pass locally
  • No reduction in actual security protection
  • False positive scenarios documented and tested

@derekmisler derekmisler self-assigned this Feb 5, 2026
@derekmisler
Copy link
Contributor Author

/describe

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

❌ Failed to generate PR description. Check workflow logs for details.

@derekmisler derekmisler changed the title The pattern repeat.*system.*prompt is too broad Injection detection is too strict, and caused a false positive when I used "repeatable" in a PR description Feb 5, 2026
@derekmisler
Copy link
Contributor Author

/describe

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

✅ PR description has been generated and updated!

@derekmisler derekmisler marked this pull request as ready for review February 5, 2026 20:08
@derekmisler derekmisler requested a review from a team as a code owner February 5, 2026 20:08
@derekmisler derekmisler force-pushed the overly-aggressive-injection-detection branch from 1e92629 to d079cce Compare February 7, 2026 14:45
@derekmisler
Copy link
Contributor Author

/describe

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

✅ PR description has been generated and updated!

@dgageot dgageot merged commit 60369a8 into docker:main Feb 9, 2026
7 checks passed
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.

3 participants