Skip to content

Expose all GuardScanLog audit fields in API response and add audit log tests#902

Open
Pcmhacker-piro wants to merge 1 commit into
SdSarthak:mainfrom
Pcmhacker-piro:fix/audit-logging-guard-scan
Open

Expose all GuardScanLog audit fields in API response and add audit log tests#902
Pcmhacker-piro wants to merge 1 commit into
SdSarthak:mainfrom
Pcmhacker-piro:fix/audit-logging-guard-scan

Conversation

@Pcmhacker-piro
Copy link
Copy Markdown

Summary

Exposes all GuardScanLog audit fields in the API response and adds tests verifying persistent audit logging for every Guard scan decision. Closes #441.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Tests
  • Infra / CI

Checklist

  • I have read CONTRIBUTING.md
  • My code follows the project style (PEP 8 for Python, ESLint for TS)
  • I have added/updated tests where relevant
  • pytest backend/tests/ passes locally (16/16)
  • I have not committed .env or any secrets
  • I have updated documentation if needed

Screenshots (if UI change)

Expose all GuardScanLog audit fields (detection_type, regex_flag,
regex_score, intent, ml_confidence, combined_score, prompt_length,
scanned_at) in the API response schema so the full audit trail is
visible via GET /guard/history.

Add comprehensive tests verifying:
- Audit log creation for 'allow', 'block', 'sanitize' decisions
- Full metadata persistence for blocked prompts
- Batch scan creating multiple audit log entries
- History endpoint returning all audit fields
@Pcmhacker-piro
Copy link
Copy Markdown
Author

@SdSarthak

the checks have passed. Could you please review and approve the pending workflows when you have a chance? Thank you!

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.

Add audit logging for Guard scan decisions

1 participant