Skip to content

Conversation

@jirivrany
Copy link
Collaborator

finished whitelist

- Updated equality checks in Flowspec4 and Whitelist models:
  - Adjusted conditions to compare only relevant fields.
  - Excluded user_id, org_id, comment, and time fields from Whitelist equality checks.
- Improved formatting in docstrings for clarity.
- Added unit tests for:
  - User creation and relationships.
  - ApiKey and MachineApiKey expiration logic.
  - Organization user retrieval.
  - Flowspec6 and Whitelist equality comparisons.
  - Whitelist serialization with to_dict.

These changes enhance test coverage and refine model behavior.
- Moved models from flowapp/models.py into a dedicated directory
- Updated flowapp/output.py to handle rule_type as an enum value
- Fixed a return value issue in flowapp/utils.py's parse_api_time function
- Added a debug print statement in flowapp/views/rules.py for user actions UI
Rule service is now used both in rules and api views
Replaced direct database operations with calls to rule_service.create_or_update_*_rule for IPv4, IPv6, and RTBH rules
Streamlined route announcements and logging by delegating responsibility to the service layer
Improved maintainability and modularity by centralizing rule handling logic in rule_service
…nd whitelist handling services to avoid ciruclar imports
Added delete_by_rule_id method to RuleWhitelistCache for efficient cache entry removal.
Used with statement for RabbitMQ connection handling in announce_to_rabbitmq to ensure proper cleanup.
Introduced ALLOWED_COMMUNITIES check in rule and whitelist services for better filtering.
Replaced print statements with structured logging using current_app.logger for better debugging.
Improved logging in whitelist deletion to handle anomalies and prevent errors.
Refactored logging configuration to use a standardized handler instead of loguru.
Updated bulk_user_form.html example data to clarify user roles.
Added whitelist_rule_ids parameter to build_ip_tbody and build_rtbh_tbody macros to visually distinguish whitelist-created rules.
Expired rules highlighted in table-warning.
Whitelisted rules marked with table-success.
Rules created by Whitelist marked with in table-secondary.
Refactored index view to enrich rule data with whitelist info via enrich_rules_with_whitelist_info.
Passed whitelist_rule_ids to dashboard rendering functions to ensure consistent rule styling.
Added count_by_rule method in RuleWhitelistCache to count cache entries per rule.
Modified evaluate_rtbh_against_whitelists_check_results to process all whitelist matches instead of stopping at the first.
Adjusted RTBH rule filtering to include both active (rstate_id=1) and whitelisted (rstate_id=4) rules when checking against whitelists.
Improved whitelist deletion logic to only revert user-created rules to Active if they have no other whitelist references.
Updated build_whitelist_tbody macro to accept whitelist_rule_ids for consistent rule highlighting.
…elevant functions to handle mixed IP versions gracefully, and add new test cases in test_whitelist_common.py to ensure proper coverage
…ssages, add file-based logging in app_factory, and update tests to assert flashes instead of specific messages.
- Move announce_all_routes to flowapp.services.base for better modularity.
- Add delete_expired_whitelists function in whitelist_service.py to remove expired whitelist entries.
- Update withdraw_expired route to call delete_expired_whitelists before withdrawing expired routes.
- Import cleanup: remove unused Flask imports in test_forms.py and test_forms_cl.py.
- Optimize rules.py by importing and using announce_all_routes and delete_expired_whitelists directly.
- Add  method to Log model to purge logs older than 30 days
- Implement string representation methods for Log objects
- Add application logging for log entries in output.py
- Integrate log cleanup into withdraw_expired endpoint
- Introduce reactivate_rule function in rule_service to centralize rule reactivation logic.
- Replace inline limit checks with service-level handling for global and organization-specific limits.
- Simplify rule reactivation in rules.py by delegating logic to the service layer.
- Add redirects for global_limit_reached and limit_reached messages to improve user experience.
- Ensure cleaner and more maintainable code by reducing duplication and improving readability.
- Implement delete_rtbh_and_create_whitelist function in rule_service to handle RTBH rule deletion and whitelist creation.
- Add a new route delete_and_whitelist in rules.py to expose this functionality via the UI.
- Update macros.html to include a button for converting RTBH rules to whitelist entries.
- Enhance user feedback with detailed flash messages for both success and failure scenarios.
- Improve code maintainability by centralizing logic in the service layer.
@jirivrany jirivrany closed this Jun 3, 2025
@jirivrany jirivrany deleted the feature/whitelist branch June 4, 2025 08:40
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.

1 participant