-
Notifications
You must be signed in to change notification settings - Fork 0
Add audit package and simplify rules to boolean logic #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
- Create audit.Auditor interface for pluggable audit implementations - Add audit.LoggingAuditor that logs to slog (replaces rules engine logging) - Integrate auditor into proxy request handling pipeline - Update rules engine with EvaluateWithRule() to return rule details - Remove logging responsibility from rules engine (separation of concerns) - Add comprehensive tests for audit package All HTTP requests (allow/deny) now go through consistent audit pipeline 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove Action enum (Allow/Deny) from rules package - Update rules engine to return bool instead of Action - Update EvaluationResult to use Allowed bool field - Update audit package to use boolean logic instead of Action - Update proxy to use boolean conditions (!result.Allowed) - Update all tests to use true/false instead of Allow/Deny - Remove unnecessary dependencies between packages Simplifies codebase by using intuitive boolean logic throughout 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
bcpeinhardt
reviewed
Sep 9, 2025
… common reason - Replace test logger that discarded output with buffer-based approach for proper verification - Add ReasonNoMatchingRules constant to avoid string duplication - Enhance tests to verify log levels and content fields - Tests now actually validate that audit logging works correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Move all CLI logic from main.go into new cli package for better modularity - main.go is now extremely slim (18 lines), only importing and calling cli package - Add comprehensive audit package test coverage: - Edge cases (empty fields, special characters, long URLs, custom reasons) - Different log levels and filtering behavior - Nil logger/request handling with graceful panic testing - Enhanced HTTPRequestToAuditRequest tests for all HTTP methods - Interface compliance, JSON/text handlers, and discard handler testing - 11 test functions with 24 sub-tests providing thorough coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Split audit.go into separate files: - request.go: Request struct and HTTPRequestToAuditRequest function - logging_auditor.go: LoggingAuditor implementation and Auditor interface - Move LoggingAuditor tests to logging_auditor_test.go - Keep general audit tests (HTTPRequestToAuditRequest) in request_test.go - Remove Request.Reason field and ReasonNoMatchingRules constant - Update proxy to use concrete LoggingAuditor type instead of interface - Simplify audit logging by removing reason parameter from DENY logs - All tests pass with improved organization and cleaner API 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove the nil request test case that was testing edge case behavior - Keep the main HTTPRequestToAuditRequest test function with 8 test cases - Cleaner test file focusing on valid request conversion scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Rename RuleEngine.EvaluateWithRule() to Evaluate() for simpler API - Remove old boolean-only Evaluate() method - Update proxy.go to use renamed Evaluate() method - Fix rules tests to work with EvaluationResult struct - Clean up formatting and remove extra blank lines - All tests pass with unified evaluation method 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
bcpeinhardt
reviewed
Sep 9, 2025
}() | ||
|
||
// Give proxy time to start | ||
time.Sleep(100 * time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still weak at this
bcpeinhardt
approved these changes
Sep 9, 2025
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.
Changes
🤖 Generated with Claude Code