Commit Graph

60 Commits

Author SHA1 Message Date
fuomag9 75044c8d9b fix: harden security post-review (JWT exposure, rate limiter, token expiry, timing)
- Raw JWT never sent to browser: page.tsx uses peekLinkingToken (read-only),
  client sends opaque linkingId, API calls retrieveLinkingToken server-side
- link-account rate limiter now uses isRateLimited/registerFailedAttempt/
  resetAttempts correctly (count only failures, reset on success)
- linking_tokens gains expiresAt column (indexed) + opportunistic expiry
  purge on insert to prevent unbounded table growth
- secureTokenCompare fixed: pad+slice to expected length so timing is
  constant regardless of submitted token length (no length leak)
- autoLinkOAuth uses config.oauth.allowAutoLinking (boolean) instead of
  process.env truthy check that mishandles OAUTH_ALLOW_AUTO_LINKING=false
- Add Permissions-Policy header; restore X-Frame-Options for legacy UAs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 20:58:21 +01:00
fuomag9 66ad3e9431 fix: enforce unique provider+subject constraint and harden sync route
- Change providerSubjectIdx from index to uniqueIndex in schema.ts to
  prevent multiple users sharing the same (provider, subject) pair,
  which caused non-deterministic sign-in resolution via findFirst.
- Add migration 0008_unique_provider_subject.sql: DROP the existing
  non-unique index and CREATE UNIQUE INDEX in its place.
- Validate INSTANCE_SYNC_MAX_BYTES env var in sync route: fall back to
  10 MB default when the value is non-numeric (e.g. 'off') or
  non-positive, preventing NaN comparisons that silently disabled the
  size limit.
- Return a generic error message to callers on applySyncPayload /
  applyCaddyConfig failure instead of leaking the raw error string;
  the original message is still stored internally via setSlaveLastSync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:41:12 +01:00
fuomag9 cb3c0a1536 fix: detect auth failure by response URL not status code to fix rate limiter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:38:25 +01:00
fuomag9 1348c0b4cd fix: add server-side validation for geoblock_mode, access_list_id, redirect_url, response_status, and response_headers keys
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 09:35:06 +01:00
fuomag9 9a189ea342 fix: store OAuth linking token server-side, remove JWT from URL and audit log
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 09:31:27 +01:00
fuomag9 5d219095b3 fix: use rightmost XFF entry in rate limiter to prevent IP spoofing
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 09:25:34 +01:00
fuomag9 0758e5b27a feat: support fail_closed option from caddy-blocker-plugin
New field from upstream plugin: when the real client IP is
indeterminate (trusted proxy present but no usable XFF entry),
fail_closed=true blocks the request instead of passing it through.

- Add fail_closed to GeoBlockSettings type
- Include in mergeGeoBlockSettings (OR semantics: either global or host enables it)
- Emit fail_closed in buildBlockerHandler (only when true)
- Parse geoblock_fail_closed from form in both settings and proxy-host actions
- Add Checkbox UI in the Advanced accordion of GeoBlockFields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 09:14:46 +01:00
fuomag9 f80b0c4735 feat: add geoip-status API route with auth
Returns whether GeoLite2-Country and GeoLite2-ASN databases are loaded,
used by the UI to show the GeoIP ready indicator in GeoBlockFields.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 08:20:48 +01:00
fuomag9 25e1f2acee fix: make geoip-status a public endpoint (no auth required) 2026-02-25 01:31:06 +01:00
fuomag9 1231150550 fix: require auth on geoip-status endpoint 2026-02-25 01:24:11 +01:00
fuomag9 ccef82cca8 feat: add GeoIP status API route and improved geoblock UI 2026-02-25 01:22:04 +01:00
fuomag9 c5a5c6b743 fix: add syncInstances to updateGeoBlockSettingsAction for consistency
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:39 +01:00
fuomag9 066c2851e4 feat: add global geoblocking section to settings page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9 c233c77bd8 fix: use consistent form parsing helpers in parseGeoBlockConfig
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9 bca740fcea feat: add parseGeoBlockConfig to proxy host actions
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9 bb8a0d1023 implemented upstream pinning 2026-02-22 01:11:56 +01:00
fuomag9 7e4df5e50b removed redirect feature 2026-02-13 22:53:11 +01:00
fuomag9 eecacfb271 The static response feature has been completely removed 2026-02-09 01:15:28 +01:00
fuomag9 6d56cf2288 deprecate deadhosts, move it to the GUI as a custom response feature 2026-02-07 00:51:48 +01:00
fuomag9 90916bd709 various security fixes
Sync secrets encrypted at rest
Sync endpoint hardening
Avatar upload SVG restriction
2026-01-25 11:27:14 +01:00
fuomag9 6fb39dc809 Implement slave-master architecture 2026-01-25 01:39:36 +01:00
fuomag9 7f93e9e784 Implement custom dns servers 2026-01-22 20:47:56 +01:00
fuomag9 49cf4f5ed1 added load balancing settings 2026-01-21 22:23:17 +01:00
fuomag9 d874cb9a69 add duplicate button and fix http protocol parsing in case user inputs protocol 2026-01-20 01:01:16 +01:00
fuomag9 ce741c98c6 fix alignment issue and missing background 2026-01-15 01:20:19 +01:00
fuomag9 85c7a0f8c7 finalized UI and website for 1.0 release 2026-01-15 01:16:25 +01:00
fuomag9 d3b77a394e better multiple upstreams parsing 2026-01-14 23:46:32 +01:00
fuomag9 d6fde6c001 implemented multiple upstreams, http visual protocol, made UI better 2026-01-14 23:26:01 +01:00
fuomag9 a0324d7574 fix folder permission for rootles, this should also fix arm64 builds 2026-01-12 00:08:31 +01:00
fuomag9 f2e34ec17f Update actions.ts 2026-01-05 15:37:28 +01:00
fuomag9 c9838a23eb Partial Revert "fix some permission stuff" 2026-01-04 22:29:00 +01:00
fuomag9 8ec483b14f fix some permission stuff 2026-01-04 18:49:24 +01:00
fuomag9 18ebdd0011 Updated menu tab on ui 2025-12-28 21:23:59 +01:00
fuomag9 be21f46ad5 Added user tab and oauth2, streamlined readme 2025-12-28 15:14:56 +01:00
fuomag9 6fe098c03b Better Icons on Main Page, Fixed Background Regeneration, update packages 2025-11-19 20:58:23 +01:00
fuomag9 57f0fbfaf5 better names and better default for authentik outpost 2025-11-19 20:48:07 +01:00
fuomag9 7ae51ad034 enforce admin role by reading user role instead of hardcoding 2025-11-19 18:06:24 +01:00
fuomag9 06dc28fabd Added user logs functionality 2025-11-14 23:27:05 +01:00
fuomag9 58ec7e321e undo loki stuff 2025-11-12 23:22:30 +01:00
fuomag9 a172595790 I've corrected the Caddy configuration structure. The error was because I placed logging inside the apps object, but in Caddy's JSON config, logging must be at the root level, alongside admin and apps. 2025-11-12 22:28:59 +01:00
fuomag9 ec580d2385 Add the ability to log to loki 2025-11-12 22:07:51 +01:00
fuomag9 6fa1eb756b Added search feature 2025-11-12 19:32:26 +01:00
fuomag9 88b25cee65 Add Caddy restart detection, auto-recovery, and metrics exposure
- Implemented health monitoring service that detects Caddy restarts/crashes
- Automatically reapplies configuration when Caddy restarts
- Added metrics settings UI for enabling Prometheus/Grafana monitoring
- Caddy metrics exposed on separate port (default: 9090) via reverse proxy
- Admin API (port 2019) kept internal-only for security
- Updated docker-compose.yml with metrics port documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-09 19:36:40 +01:00
fuomag9 1c09acf515 fix not being able to create multiple proxy hosts in succession without needing to refresh the page
also add recommendation for not disabling Set Host Header
2025-11-08 14:37:50 +01:00
fuomag9 70c5fa831c Now when users configure Authentik defaults in Settings, those values will automatically pre-fill when creating new proxy hosts, but can still be customized per host
also allow instant enable/disable of hosts directly from the table/list views without needing to edit each host
2025-11-08 14:15:55 +01:00
fuomag9 b17ae54fbd Squashed commit of the following:
commit b5a751005850115c84fd8fddb83f32a52835a422
Author: fuomag9 <1580624+fuomag9@users.noreply.github.com>
Date:   Sat Nov 8 13:54:22 2025 +0100

    Update ProxyHostsClient.tsx

commit c93b3898c31b9c206fba74605dad5a578e326ce4
Author: fuomag9 <1580624+fuomag9@users.noreply.github.com>
Date:   Sat Nov 8 13:43:00 2025 +0100

    test-protected-paths
2025-11-08 13:55:23 +01:00
fuomag9 6fb16c3cd7 Fixed Too Many history.replaceState() Calls 2025-11-08 11:25:52 +01:00
fuomag9 ee8813ac95 The certificates page has been completely redesigned 2025-11-08 11:11:36 +01:00
fuomag9 3be4e1bf7d Rewritten to use drizzle instead of prisma
commit c0894548dac5133bd89da5b68684443748fa2559
Author: fuomag9 <1580624+fuomag9@users.noreply.github.com>
Date:   Fri Nov 7 18:38:30 2025 +0100

    Update config.ts

commit 5a4f1159d2123ada0f698a10011c24720bf6ea6f
Author: fuomag9 <1580624+fuomag9@users.noreply.github.com>
Date:   Fri Nov 7 15:58:13 2025 +0100

    first drizzle rewrite
2025-11-07 19:26:32 +01:00
fuomag9 102bd04d4c Fix auto certificate not showing in GUI when editing proxy host
When editing a proxy host with certificate_id set to null (auto), the
dropdown would not show "Managed by Caddy (Auto)" as selected and it
would revert to another certificate. There were two issues:

1. Form submission: Empty string from dropdown was treated as falsy,
   returning undefined instead of null (means "don't change")

2. Database update: The ?? operator treated null as falsy and fell back
   to existing value instead of saving null

Changes:
- app/(dashboard)/proxy-hosts/actions.ts: Check formData.has() and
  explicitly convert empty string to null for auto mode
- src/lib/models/proxy-hosts.ts: Use !== undefined instead of ?? to
  allow null values to be saved
- app/(dashboard)/proxy-hosts/ProxyHostsClient.tsx: Add Certificate
  column to table showing "Managed by Caddy (Auto)" for auto certs

Applied same fixes to access_list_id for consistency.

Now when users select "Managed by Caddy (Auto)", it correctly sets
certificate_id to null, displays properly on subsequent edits, and
shows in the table view.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 11:51:41 +01:00