Commit Graph

2 Commits

Author SHA1 Message Date
HAL9000 807b56bc69 fix(agents): sanitize user-provided content in AutoDebugAgent prompts to prevent prompt injection
- Add _sanitize_user_input() helper that catches PromptInjectionDetected and falls back to wrap_user_content() instead of crashing the agent
- Remove dead code (_bs, _be variables) from all three agent methods
- Use wrap_user_content() for error_analysis (internal LLM output) in _generate_fix() to avoid crashing on the agent's own output
- Add @security @prompt-injection BDD tags to feature file and all scenarios
- Add missing @then("the boundary markers should be present") step definition
- Add Robot Framework integration tests (auto_debug_agent_prompt_injection.robot)
- Update CHANGELOG.md and CONTRIBUTORS.md

ISSUES CLOSED: #9110
2026-06-02 17:06:11 -04:00
HAL9000 69929b4d23 fix(agents): sanitize user-provided content in AutoDebugAgent prompts to prevent prompt injection
- Import PromptSanitizer from cleveragents.application.services.prompt_sanitizer
- Create module-level _SANITIZER instance for prompt boundary markers
- Apply sanitize_and_wrap() to error_msg and code_ctx in _analyze_error()
- Apply sanitize_and_wrap() to error_analysis and code_context in _generate_fix()
- Apply sanitize_and_wrap() to error_message in _validate_fix()
- Augment system prompts with BOUNDARY_INSTRUCTION to inform LLM about markers
- Add comprehensive BDD test scenarios for prompt injection mitigation
- Add step definitions for testing boundary markers and injection attempts

Fixes #9110
2026-06-02 17:06:11 -04:00