Commit Graph

750 Commits

Author SHA1 Message Date
GitHub Actions b761d7d4f7 feat(security): seed default SecurityConfig row on application startup
On a fresh install the security_configs table is auto-migrated but
contains no rows. Any code path reading SecurityConfig by name received
an empty Go struct with zero values, producing an all-disabled UI state
that offered no guidance to the user and made the security status
endpoint appear broken.

Adds a SeedDefaultSecurityConfig function that uses FirstOrCreate to
guarantee a default row exists with safe, disabled-by-default values on
every startup. The call is idempotent — existing rows are never modified,
so upgrades are unaffected. If the seed fails the application logs a
warning and continues rather than crashing.

Zero-valued rate-limit fields are intentional and safe: the Cerberus
rate-limit middleware applies hardcoded fallback thresholds when the
stored values are zero, so enabling rate limiting without configuring
thresholds results in sensible defaults rather than a divide-by-zero or
traffic block.

Adds three unit tests covering the empty-database, idempotent, and
do-not-overwrite-existing paths.
2026-03-17 12:33:40 +00:00
GitHub Actions dcd1ec7e95 fix: improve error handling in TestSettingsHandler_UpdateSetting_EmptyValueAccepted 2026-03-17 02:01:48 +00:00
GitHub Actions 4f222b6308 fix: make 'value' field optional in UpdateSettingRequest struct 2026-03-17 01:40:35 +00:00
GitHub Actions 4fe538b37e chore: add unit tests for Slack and Pushover service flags, and validate Pushover dispatch behavior 2026-03-16 21:38:40 +00:00
GitHub Actions b5bf505ab9 fix: update go-sqlite3 to version 1.14.37 and modernc.org/sqlite to version 1.46.2 for improved stability 2026-03-16 18:20:35 +00:00
GitHub Actions 65d02e754e feat: add support for Pushover notification provider
- Updated the list of supported notification provider types to include 'pushover'.
- Enhanced the notifications API tests to validate Pushover integration.
- Modified the notifications form to include fields specific to Pushover, such as API Token and User Key.
- Implemented CRUD operations for Pushover providers in the settings.
- Added end-to-end tests for Pushover provider functionality, including form rendering, payload validation, and security checks.
- Updated translations to include Pushover-specific labels and placeholders.
2026-03-16 18:16:14 +00:00
GitHub Actions 5bafd92edf fix: supply slack webhook token in handler create sub-tests
The slack sub-tests in TestDiscordOnly_CreateRejectsNonDiscord and
TestBlocker3_CreateProviderRejectsNonDiscordWithSecurityEvents were
omitting the required token field from their request payloads.
CreateProvider enforces that Slack providers must have a non-empty
token (the webhook URL) at creation time. Without it the service
returns "slack webhook URL is required", which the handler does not
classify as a 400 validation error, so it falls through to 500.

Add a token field to each test struct, populate it for the slack
case with a valid-format Slack webhook URL, and use
WithSlackURLValidator to bypass the real format check in unit tests —
matching the pattern used in all existing service-level Slack tests.
2026-03-15 15:17:23 +00:00
GitHub Actions 6e4294dce1 fix: validate Slack webhook URL at provider create/update time 2026-03-15 12:23:27 +00:00
GitHub Actions 72598ed2ce fix: inject Slack URL validator via constructor option instead of field mutation 2026-03-15 11:27:51 +00:00
GitHub Actions ab4dee5fcd fix: make Slack webhook URL validator injectable on NotificationService 2026-03-15 11:15:10 +00:00
Jeremy 0ce35f2d64 Merge branch 'development' into feature/beta-release 2026-03-14 23:47:43 -04:00
GitHub Actions fd58f9d99a fix(auth): update SameSite cookie policy description for clarity 2026-03-15 03:23:06 +00:00
GitHub Actions f33ab83b7c fix(auth): rename isLocalHost to isLocalOrPrivateHost and update related tests 2026-03-15 03:20:11 +00:00
GitHub Actions 6777f6e8ff feat(auth): implement Bearer token fallback in fetchSessionUser for private network HTTP connections
- Expanded fetchSessionUser to include Bearer token from localStorage as a fallback for authentication when Secure cookies fail.
- Updated headers to conditionally include Authorization if a token is present.
- Ensured compatibility with the recent fix for the Secure cookie flag on private network connections.
2026-03-15 02:25:07 +00:00
GitHub Actions 0c419d8f85 chore: add Slack provider validation tests for payload and webhook URL 2026-03-13 12:09:35 +00:00
GitHub Actions 26be592f4d feat: add Slack notification provider support
- Updated the notification provider types to include 'slack'.
- Modified API tests to handle 'slack' as a valid provider type.
- Enhanced frontend forms to display Slack-specific fields (webhook URL and channel name).
- Implemented CRUD operations for Slack providers, ensuring proper payload structure.
- Added E2E tests for Slack notification provider, covering form rendering, validation, and security checks.
- Updated translations to include Slack-related text.
- Ensured that sensitive information (like tokens) is not exposed in API responses.
2026-03-13 03:40:02 +00:00
GitHub Actions 593694a4b4 fix(deps): update goccy/go-json to version 0.10.6 2026-03-12 17:49:05 +00:00
GitHub Actions 442164cc5c fix(deps): update golang.org/x/crypto and golang.org/x/net dependencies to latest versions 2026-03-12 10:05:51 +00:00
renovate[bot] 7932188dae fix(deps): update non-major-updates 2026-03-12 09:30:08 +00:00
GitHub Actions b76c1d7efc chore: update golang.org/x/sync dependency to v0.20.0 and remove outdated golang.org/x/text v0.34.0 2026-03-11 15:54:36 +00:00
renovate[bot] 065ac87815 fix(deps): update non-major-updates 2026-03-11 14:53:49 +00:00
GitHub Actions c977c6f9a4 fit(notification): enhance Telegram integration with dynamic API base URL and improved payload validation 2026-03-11 00:34:39 +00:00
GitHub Actions 9000c1f4ba chore: add comprehensive tests for Telegram notification service functionality 2026-03-10 23:32:29 +00:00
GitHub Actions 2fc5b10d3d fix(notifications): surface provider API error details in test failure messages 2026-03-10 17:30:31 +00:00
GitHub Actions ef71f66029 feat: add Telegram notification provider support
- Updated API to support Telegram as a notification provider type.
- Enhanced tests to cover Telegram provider creation, updates, and token handling.
- Modified frontend forms to include Telegram-specific fields and validation.
- Added localization strings for Telegram provider.
- Implemented security measures to ensure bot tokens are not exposed in API responses.
2026-03-10 12:14:57 +00:00
GitHub Actions 3414c7c941 fix: update modernc.org/libc to v1.70.0 and golang.org/x/mod to v0.33.0 2026-03-09 13:10:46 +00:00
GitHub Actions 0f823956c6 fix: add email service check in ShouldUseNotify method 2026-03-09 00:49:07 +00:00
GitHub Actions 799ca8c5f9 fix: enhance decompression limit check to prevent false positives for valid files 2026-03-09 00:42:23 +00:00
GitHub Actions 791e812c3c fix: add assertion for ExpiresAt field in ManualChallenge struct 2026-03-09 00:09:14 +00:00
GitHub Actions d7de28a040 fix: allow saving email notification providers and render HTML body correctly 2026-03-08 20:26:13 +00:00
GitHub Actions d1baf6f1b0 feat: implement email provider testing functionality and corresponding unit tests 2026-03-08 16:14:08 +00:00
GitHub Actions 3201830405 chore: update dependencies for golang.org/x/time, golang.org/x/arch, and golang.org/x/sys 2026-03-08 15:52:44 +00:00
GitHub Actions c4e8d6c8ae chore: add unit tests for certificate handler, logs websocket upgrader, config loading, and mail service 2026-03-08 05:45:21 +00:00
GitHub Actions 65b82a8e08 feat: add email notification provider with HTML templates
- Implemented email notification functionality in the NotificationService.
- Added support for rendering email templates based on event types.
- Created HTML templates for various notification types (security alerts, SSL events, uptime events, and system events).
- Updated the dispatchEmail method to utilize the new email templates.
- Added tests for email template rendering and fallback mechanisms.
- Enhanced documentation to include email notification setup and usage instructions.
- Introduced end-to-end tests for the email notification provider in the settings.
2026-03-07 19:54:21 +00:00
GitHub Actions c144bb2b97 fix: enhance email notification formatting with HTML for improved readability 2026-03-07 05:53:46 +00:00
GitHub Actions ca3c1085ac fix: update notification messages for various handlers to improve clarity and consistency 2026-03-07 05:16:07 +00:00
GitHub Actions 744b6aeff5 fix: improve pagination handling and prevent decompression bombs in backup service
fix: enhance JWT secret management to avoid hardcoded values and ensure security
feat: add SMTP address sanitization to prevent email header injection vulnerabilities
2026-03-07 03:39:54 +00:00
GitHub Actions 81497beb4b fix: update opentelemetry dependencies to latest versions for improved performance 2026-03-07 02:06:15 +00:00
Jeremy 801760add1 Potential fix for code scanning alert no. 1271: Email content injection
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-03-06 15:30:55 -05:00
GitHub Actions 4ebf8d23fe fix: enhance email sanitization by trimming whitespace and normalizing input 2026-03-06 20:18:51 +00:00
GitHub Actions b527470e75 fix: update opentelemetry dependencies to v1.42.0 for improved functionality and performance 2026-03-06 19:58:19 +00:00
GitHub Actions 89b4d88eb1 fix: enhance email content sanitization to prevent CR/LF injection and improve security 2026-03-06 19:56:22 +00:00
GitHub Actions a69f698440 fix: enhance WebSocket origin check and improve email validation in mail service 2026-03-06 13:50:59 +00:00
GitHub Actions ee224adcf1 fix: update notification provider type in tests and enhance email injection sanitization 2026-03-06 06:31:11 +00:00
Jeremy 99ff0a34e3 Merge pull request #808 from Wikid82/renovate/feature/beta-release-non-major-updates
chore(deps): update non-major-updates (feature/beta-release)
2026-03-05 21:07:44 -05:00
GitHub Actions ed89295012 feat: wire MailService into notification dispatch pipeline (Stage 3)
Unifies the two previously independent email subsystems — MailService
(net/smtp transport) and NotificationService (HTTP-based providers) —
so email can participate in the notification dispatch pipeline.

Key changes:
- SendEmail signature updated to accept context.Context and []string
  recipients to enable timeout propagation and multi-recipient dispatch
- NotificationService.dispatchEmail() wires MailService as a first-class
  provider type with IsConfigured() guard and 30s context timeout
- 'email' added to isSupportedNotificationProviderType() and
  supportsJSONTemplates() returns false for email (plain/HTML only)
- settings_handler.go test-email endpoint updated to new SendEmail API
- Frontend: 'email' added to provider type union in notifications.ts,
  Notifications.tsx shows recipient field and hides URL/token fields for
  email providers
- All existing tests updated to match new SendEmail signature
- New tests added covering dispatchEmail paths, IsConfigured guards,
  recipient validation, and context timeout behaviour

Also fixes confirmed false-positive CodeQL go/email-injection alerts:
- smtp.SendMail, sendSSL w.Write, and sendSTARTTLS w.Write sites now
  carry inline codeql[go/email-injection] annotations as required by the
  CodeQL same-line suppression spec; preceding-line annotations silently
  no-op in current CodeQL versions
- auth_handler.go c.SetCookie annotated for intentional Secure=false on
  local non-HTTPS loopback (go/cookie-secure-not-set warning only)

Closes part of #800
2026-03-06 02:06:49 +00:00
renovate[bot] 834907cb5d chore(deps): update non-major-updates 2026-03-06 02:02:10 +00:00
GitHub Actions 5fa0cff274 fix: eliminate wall-clock race in TestApplyRepullsOnCacheExpired
The test used a 5ms TTL with a 10ms wall-clock sleep to simulate cache
expiry. On loaded CI runners (Azure eastus), the repull HTTP round-trip
plus disk I/O for Store easily exceeded 5ms, causing the freshly written
cache entry to also appear expired when Load was called immediately after,
producing a spurious 'cache expired' error.

HubCache already exposes a nowFn field for deterministic time injection.
Replace the sleep-based approach with a nowFn that advances the clock 2
hours, making the initial entry appear expired to Apply while keeping the
freshly re-stored entry (retrieved_at ≈ now+2h, TTL=1h) valid for the
final assertion.
2026-03-05 20:20:14 +00:00
GitHub Actions f2cf5c3508 chore: add coverage for default false state of email notifications feature flag 2026-03-05 14:58:21 +00:00
GitHub Actions ddc79865bc test: cover email provider paths in SendExternal and TestProvider
Two unit tests cover the code paths introduced when email was registered
as a recognised notification provider type in Stage 2.

- TestSendExternal_EmailProviderSkipsJSONTemplate exercises the goroutine
  warn path where an enabled email provider passes isDispatchEnabled but
  fails supportsJSONTemplates, producing a warning log without panicking
- TestTestProvider_EmailRejectsJSONTemplateStep asserts TestProvider
  returns a clear error for email providers because the JSON template
  dispatch path does not apply to email delivery

Patch coverage: 6/6 changed lines covered (100%)
2026-03-05 06:57:37 +00:00