itdove/ai-guardian#1146: feat: add Always Allow button in violation detail modal (web console + TUI)#1208
Conversation
- Add violation_rescan module to re-scan files and extract matched text - Add POST /api/violation-context endpoint to REST API and multi_client - Add allowlist dialog to TUI and web violations views with pattern preview - Map violation types to config sections in pattern_editor 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
10 tasks
…+ TUI) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Switch from tempfile.NamedTemporaryFile/os.unlink to pytest tmp_path - Remove unused os and tempfile imports - Flatten nested with/try/finally blocks into linear test bodies Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Issue: N/A
Description
Adds an "Always Allow" button in the violation detail modal for both the web console and TUI, enabling ask-mode allowlisting for remote/container/headless daemons where the popup dialog cannot display at detection time.
Key changes:
POST /api/violation-contextREST endpoint on the daemon that rescans a file at the original violation location (±N line window) using existing scan infrastructure, filtered by violation sub-type (e.g.,env-variable,pii-ssn). Returns matched text in memory only — never persisted.violation_rescan.pymodule implementing targeted rescan logic with sub-type filtering and line-proximity search.daemon_service.py.Resolves: #1146
Assisted-by: Claude
Testing
Steps to test
ai-guardian daemon start)ai-guardian tui)curl -X POST http://localhost:<port>/api/violation-context -H "Authorization: Bearer <token>" -d '{"file_path": "/path/to/file", "line_number": 42, "violation_type": "secret_detected", "secret_type": "env-variable"}'status,matched_text, andline_numberpython -m pytest tests/unit/test_violation_rescan.py -vScenarios tested
file_not_foundstatusnot_foundstatusenv-variable, not other secret types)Deployment considerations