Commit Graph

477 Commits

Author SHA1 Message Date
GitHub Actions 9c04b3c198 fix(security): prevent email header injection (CWE-93)
CodeQL flagged critical vulnerabilities in mail_service.go where
untrusted input could be used to inject additional email headers
via CRLF sequences.

Changes:
- Add sanitizeEmailHeader() to strip CR, LF, and control characters
- Sanitize all header values (from, to, subject) in buildEmail()
- Add validateEmailAddress() using net/mail.ParseAddress
- Add comprehensive security tests for header injection prevention

This addresses the 3 critical CodeQL alerts:
- Line 199: buildEmail header construction
- Line 260: sendSSL message usage
- Line 307: sendSTARTTLS message usage

Security: CWE-93 (Improper Neutralization of CRLF Sequences)
2025-12-05 05:02:09 +00:00
GitHub Actions 1143a372fa fix: restore /setup API routes removed in user management commit
The commit c06c282 (feat: add SMTP settings page and user management
features) removed userHandler.RegisterRoutes(api) and manually
registered only some of the routes, missing the critical /setup
endpoints.

This restores GET /api/v1/setup and POST /api/v1/setup which are
required for initial admin setup flow.
2025-12-05 04:27:43 +00:00
GitHub Actions 0453924fe7 fix: resolve CI test failures
- Remove SQLite cache=shared from certificate handler tests to prevent
  database locking issues in parallel test runs
- Add JSON validation before jq parsing in integration-test.sh to
  provide clear error messages when setup endpoint returns invalid response
- Remove unused fmt import from certificate_handler_coverage_test.go
2025-12-05 04:08:08 +00:00
GitHub Actions 562bb012fb feat: Enhance Dockerfile for Caddy with security patches and automate dependency management
- Added custom manager in renovate.json to track Go dependencies patched in Dockerfile for Caddy CVE fixes.
- Updated Dockerfile to pre-fetch and override vulnerable module versions for dependencies (expr, quic-go, smallstep/certificates) during the build process.
- Improved build resilience by implementing a fallback mechanism for Caddy versioning.
- Introduced tests for user SMTP audit, covering invite token security, input validation, authorization, and SMTP config security.
- Enhanced user invite functionality with duplicate email protection and case-insensitive checks.
- Updated go.work.sum to include new dependencies and ensure compatibility.
2025-12-05 02:15:43 +00:00
GitHub Actions c06c2829a6 feat: add SMTP settings page and user management features
- Added a new SMTP settings page with functionality to configure SMTP settings, test connections, and send test emails.
- Implemented user management page to list users, invite new users, and manage user permissions.
- Created modals for inviting users and editing user permissions.
- Added tests for the new SMTP settings and user management functionalities.
- Updated navigation to include links to the new SMTP settings and user management pages.
2025-12-05 00:47:57 +00:00
GitHub Actions cecf0ef9d6 ci: run perf asserts in CI (backend quality & benchmark jobs) 2025-12-04 20:58:18 +00:00
GitHub Actions fa41fda360 feat: add comprehensive security audit tests for SQL injection, input validation, and settings persistence 2025-12-04 20:27:13 +00:00
GitHub Actions 4b056c1133 feat: implement runtime overrides for security settings and add comprehensive tests 2025-12-04 19:52:57 +00:00
GitHub Actions 197e2bf672 Add comprehensive tests for security and user handlers, enhancing coverage
- Introduced tests for the security handler, covering UpdateConfig, GetConfig, ListDecisions, CreateDecision, UpsertRuleSet, DeleteRuleSet, Enable, and Disable functionalities.
- Added tests for user handler methods including GetSetupStatus, Setup, RegenerateAPIKey, GetProfile, and UpdateProfile, ensuring robust error handling and validation.
- Implemented path traversal and injection tests in the WAF configuration to prevent security vulnerabilities.
- Updated the manager to sanitize ruleset names by stripping potentially harmful characters and patterns.
2025-12-04 17:54:17 +00:00
GitHub Actions 2adf094f1c feat: Implement comprehensive tests and fixes for Coraza WAF integration
- Add unit tests for WAF ruleset selection priority and handler validation in config_waf_test.go.
- Enhance manager.go to sanitize ruleset names, preventing path traversal vulnerabilities.
- Introduce debug logging for WAF configuration state in manager.go to aid troubleshooting.
- Create integration tests to verify WAF handler presence and ruleset sanitization in manager_additional_test.go.
- Update coraza_integration.sh to include verification steps for WAF configuration and improved error handling.
- Document the Coraza WAF integration fix plan, detailing root cause analysis and implementation tasks.
2025-12-04 04:04:37 +00:00
GitHub Actions 80934670e1 fix: trigger Caddy reload when security config changes
- Add ApplyConfig call in UpdateConfig handler after saving to DB
- This ensures WAF mode changes (block/monitor) regenerate rulesets
- Add nil guard for caddyManager in tests
2025-12-03 23:49:58 +00:00
GitHub Actions 58d570ee1d fix: update WAF handler tests for directives format and fix hash calculation
- Change test assertions from checking 'include' array to 'directives' string
- Fix advanced_config array case to use 'directives' instead of 'include'
- Calculate ruleset hash from final content (after SecRuleEngine prepend)
- Update filename pattern matching in tests for hashed filenames
- Ensures WAF mode changes result in different ruleset filenames
2025-12-03 23:05:09 +00:00
GitHub Actions 85a15f8299 fix: resolve CI failures (WAF integration, Trivy vulnerabilities) 2025-12-03 20:16:42 +00:00
GitHub Actions cc61830908 fix: resolve WAF integration tests and benchmark workflow 2025-12-03 19:36:48 +00:00
GitHub Actions a945a77f8e chore: update go.sum via go mod tidy to fix missing entries for Docker build 2025-12-03 15:12:13 +00:00
renovate[bot] 64cd7ca8f0 fix(deps): update module github.com/prometheus/client_golang to v1.23.2 2025-12-03 14:22:17 +00:00
Jeremy 377c331ff9 Merge branch 'feature/beta-release' into development 2025-12-03 09:20:34 -05:00
Jeremy 8b9ae95dd9 Merge branch 'development' into renovate/npm-minorpatch 2025-12-03 09:17:35 -05:00
GitHub Actions dbdb3fe7be feat(tests): add unit tests for SanitizeForLog function 2025-12-03 14:03:49 +00:00
GitHub Actions edeaacbfaa fix(docs): correct typo in remaining contract tasks documentation
fix(scripts): enhance test coverage script with verbose output and race detection
2025-12-03 13:46:13 +00:00
GitHub Actions 673a496bfa feat(tests): add new tests for certificate upload, proxy host creation, and uptime monitoring 2025-12-03 12:54:05 +00:00
GitHub Actions 336000ca5b feat: Add validation and error handling for notification templates and uptime handlers
- Implement tests for invalid JSON input in notification template creation, update, and preview endpoints.
- Enhance uptime handler tests to cover sync success and error scenarios for delete and list operations.
- Update routes to include backup service in certificate handler initialization.
- Introduce certificate usage check before deletion in the certificate service, preventing deletion of certificates in use.
- Update certificate service tests to validate new behavior regarding certificate deletion.
- Add new tests for security service to verify break glass token generation and validation.
- Enhance frontend certificate list component to prevent deletion of certificates in use and ensure proper backup creation.
- Create unit tests for the CertificateList component to validate deletion logic and error handling.
2025-12-03 04:55:29 +00:00
renovate[bot] 4235573d80 chore(deps): update dependency go to v1.25.5 2025-12-03 03:25:40 +00:00
GitHub Actions 8ea50e37e0 feat: Remove deprecated security handler test file to streamline test suite 2025-12-03 02:23:22 +00:00
GitHub Actions 078b5803e6 feat: Add CheckMonitor functionality to trigger immediate health checks for uptime monitors 2025-12-02 22:08:58 +00:00
GitHub Actions bb7b6a7f9e feat: Implement partial update for ProxyHostHandler
- Added a new test case to ensure that partial updates do not wipe existing fields in the ProxyHost model.
- Modified the Update method in ProxyHostHandler to handle partial updates by only mutating fields present in the JSON payload.
- Enhanced the handling of nullable foreign keys and locations during updates.
- Removed the requirement for 100% coverage checks for critical backend modules in the CI pipeline.
2025-12-02 21:06:15 +00:00
renovate[bot] e97c46a4b9 fix(deps): update npm minor/patch 2025-12-02 18:39:07 +00:00
GitHub Actions 62ae91d0c3 fix(tests): add Notification model migrations to all handler tests using NotificationService 2025-12-02 04:34:37 +00:00
GitHub Actions d285014358 fix(tests): add missing Notification models to handler test migrations 2025-12-02 04:19:25 +00:00
GitHub Actions 33dc664425 feat(waf): update WAF middleware to evaluate and log suspicious payloads without blocking in monitor mode 2025-12-02 03:53:12 +00:00
GitHub Actions 8d26a631d4 feat(tests): add integration test for WAF middleware behavior and metrics exposure 2025-12-02 03:36:58 +00:00
GitHub Actions 34347b1ff5 Refactor uptime service and tests; add WAF configuration UI and e2e tests
- Refactored `SyncMonitors` method in `uptime_service.go` for better readability.
- Updated unit tests for `UptimeService` to ensure proper functionality.
- Introduced Playwright configuration for end-to-end testing.
- Added e2e tests for WAF blocking and monitoring functionality.
- Enhanced the Security page to include WAF mode and rule set selection.
- Implemented tests for WAF configuration changes and validation.
- Created a `.last-run.json` file to store test results.
2025-12-02 02:51:50 +00:00
GitHub Actions b78d79516e feat(workflow): add WAF integration testing workflow with Docker setup and reporting 2025-12-02 02:10:35 +00:00
GitHub Actions a08edf1895 Refactor WAF handler configuration to use 'include' array instead of 'rules_file'
- Updated the GenerateConfig function to replace 'rules_file' with 'include' for WAF handlers, aligning with the coraza-caddy plugin requirements.
- Modified related tests to check for the presence of 'include' instead of 'rules_file'.
- Enhanced the ApplyConfig method to prepend necessary Coraza directives to ruleset files if not already present.
- Added tests to verify that the SecRuleEngine directives are correctly prepended and that existing directives are not duplicated.
- Implemented debug logging for generated config size and content.
2025-12-02 01:32:47 +00:00
GitHub Actions 4e975421de feat(integration): add integration test for Coraza WAF script execution 2025-12-02 00:32:40 +00:00
GitHub Actions 14859adf87 Enhance GenerateConfig function to accept ruleset paths and update related tests
- Modified the GenerateConfig function to include an additional parameter for ruleset paths.
- Updated multiple test cases across various files to accommodate the new parameter.
- Enhanced the manager's ApplyConfig method to handle ruleset file creation and error handling.
- Added integration tests for Coraza WAF to validate runtime behavior and ruleset application.
- Updated documentation to include instructions for testing Coraza WAF integration locally.
2025-12-01 21:11:17 +00:00
GitHub Actions 76ab163e69 feat(security): integrate Caddy Manager into SecurityHandler and update related tests 2025-12-01 20:16:08 +00:00
GitHub Actions f5fb460cc6 feat(security): add DeleteRuleSet endpoint and implement related service logic 2025-12-01 19:56:15 +00:00
GitHub Actions b0a4d75a2a Refactor security configuration: Remove external CrowdSec mode support
- Updated SecurityConfig model to only support 'local' or 'disabled' modes for CrowdSec.
- Modified related logic in the manager and services to reject external mode.
- Adjusted tests to validate the new restrictions on CrowdSec modes.
- Updated frontend components to remove references to external mode and provide appropriate user feedback.
- Enhanced documentation to reflect the removal of external CrowdSec mode support.
2025-12-01 19:43:45 +00:00
GitHub Actions 570d904019 feat(security): implement decision and ruleset management with logging and retrieval 2025-12-01 18:23:15 +00:00
GitHub Actions 53765afd35 feat(security): implement self-lockout protection and admin whitelist
- Added SecurityConfig model to manage Cerberus settings including admin whitelist and break-glass token.
- Introduced SecurityService for handling security configurations and token generation.
- Updated Manager to check for admin whitelist before applying configurations to prevent accidental lockouts.
- Enhanced frontend with hooks and API calls for managing security settings and generating break-glass tokens.
- Updated documentation to include self-lockout protection measures and best practices for using Cerberus.
2025-12-01 18:10:58 +00:00
GitHub Actions c83928f628 Refactor Caddy configuration management to include security settings
- Updated `GenerateConfig` function calls in tests to include additional security parameters.
- Enhanced `Manager` struct to hold a `SecurityConfig` instance for managing security-related settings.
- Implemented `computeEffectiveFlags` method to determine the effective state of security features based on both static configuration and runtime database settings.
- Added comprehensive tests for the new security configuration handling, ensuring correct behavior for various scenarios including ACL and CrowdSec settings.
- Adjusted existing tests to accommodate the new structure and ensure compatibility with the updated configuration management.
2025-12-01 16:22:21 +00:00
GitHub Actions 1df5999635 feat: enhance ACL handler to properly block access based on geographic restrictions 2025-12-01 16:22:21 +00:00
GitHub Actions 581229e454 feat: ensure ACL is disabled when Cerberus is off in security status response 2025-12-01 16:22:21 +00:00
GitHub Actions 486987cc96 feat: remove IP-based presets from ACL templates for improved security management 2025-12-01 16:22:21 +00:00
GitHub Actions 5717941d45 feat: add runtime override for ACL enabled flag in security handler 2025-12-01 16:22:21 +00:00
GitHub Actions b45ac58f10 feat: add ACL_DBOverride test to validate ACL configuration in security handler 2025-12-01 16:22:21 +00:00
GitHub Actions 4d639698bb Enhance logging security by sanitizing sensitive data
- Implemented filename sanitization in backup, import, and certificate handlers to prevent log injection attacks.
- Added tests to ensure filenames are sanitized correctly in backup and import handlers.
- Updated notification and domain handlers to sanitize domain names before logging.
- Introduced middleware functions for sanitizing request paths and headers to redact sensitive information in logs.
- Enhanced recovery middleware to sanitize logged paths and headers during panic situations.
- Updated various services to log sanitized values for sensitive fields.
2025-12-01 16:22:21 +00:00
GitHub Actions 927bec9374 feat: add trace package with ContextKey type and RequestIDKey constant 2025-12-01 16:22:21 +00:00
GitHub Actions 3403633181 feat: update request ID handling to use trace package constants in notification service 2025-12-01 16:22:21 +00:00