Commit Graph

175 Commits

Author SHA1 Message Date
fuomag9
3442beba19 fix: expand private_ranges to CIDRs before passing to caddy-blocker-plugin
The blocker plugin only accepts literal IP/CIDR strings; Caddy's built-in
'private_ranges' shorthand is not understood by third-party modules.
Expand it to the equivalent CIDR list at config-build time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 01:25:08 +01:00
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
b2238f3101 fix: gate unsafe-eval to dev, drop redundant X-Frame-Options, document PKCE+state
- CSP script-src 'unsafe-eval' is now dev-only; Next.js HMR needs it in
  development but the production standalone build does not
- Remove X-Frame-Options: DENY since frame-ancestors 'none' in CSP supersedes
  it in all modern browsers; keeping both creates a maintenance hazard
- Add comment explaining why state check is added alongside PKCE default

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 20:36:43 +01:00
fuomag9
b5b15c2496 fix: use explicit empty Buffer as HKDF salt and log legacy key fallback
- Replace empty string "" salt with Buffer.alloc(0) for explicit intent
  in security-critical HKDF call
- Add console.warn when legacy SHA-256 decryption path is taken so
  operators can track when all secrets have been re-encrypted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 20:33:45 +01:00
fuomag9
48385684f9 fix: add PKCE to OAuth checks and HTTP security response headers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:43:00 +01:00
fuomag9
a1c18cf09c fix: derive AES key with HKDF for key separation from JWT signing key
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:42:46 +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
618982484c fix: verify OAuth provider email against pending link to prevent account takeover
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 18:36:41 +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
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
ccef82cca8 feat: add GeoIP status API route and improved geoblock UI 2026-02-25 01:22:04 +01:00
fuomag9
18c890bb21 feat: redesign GeoBlockFields UI with tabs, Autocomplete tag inputs, and accordion 2026-02-23 23:55:40 +01:00
fuomag9
9254d8e910 fix: use node:http for Caddy admin API calls to avoid Sec-Fetch-Mode CORS triggering 2026-02-23 23:49:05 +01:00
fuomag9
85af993c77 fix: add Origin header to Caddy admin API requests to satisfy CORS origin check 2026-02-23 22:27:31 +01:00
fuomag9
497e58db14 fix: include admin origins in generated Caddy config so they survive /load 2026-02-23 21:50:50 +01:00
fuomag9
b0abb407c6 feat: add GeoBlockFields to create and edit proxy host dialogs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9
7165dc4b05 fix: always render geoblock_mode hidden input regardless of showModeSelector
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9
821842b3a9 feat: add GeoBlockFields UI component
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:38 +01:00
fuomag9
fd9aa986d9 fix: correct enabled logic in geoblock merge and route injection 2026-02-23 19:56:37 +01:00
fuomag9
80177bf067 feat: inject blocker handler into proxy routes for geoblocking
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:37 +01:00
fuomag9
f54b7db96f fix: align GeoBlock hydrators with existing patterns in proxy host model
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:37 +01:00
fuomag9
e6e35646c0 feat: add GeoBlock types and hydration to proxy host model
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:37 +01:00
fuomag9
15208313a8 feat: add GeoBlockSettings type and helpers to settings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 19:56:37 +01:00
fuomag9
32f232ebee better UI for dns pinning 2026-02-22 10:00:52 +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
648d12bf16 The fix now properly merges the DNS resolver config into the existing transport, preserving TLS settings for HTTPS upstreams 2026-01-22 22:44:31 +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
85c7a0f8c7 finalized UI and website for 1.0 release 2026-01-15 01:16:25 +01:00
fuomag9
8ec483b14f fix some permission stuff 2026-01-04 18:49:24 +01:00
fuomag9
be21f46ad5 Added user tab and oauth2, streamlined readme 2025-12-28 15:14:56 +01:00
fuomag9
9ca8bb4f15 Revert "Fix Authentik outpost callback by preserving original Host header"
This reverts commit b2183bf856.
2025-11-19 20:25:01 +01:00
fuomag9
454edba677 Fix outpost upstream dial address parsing
The outpost upstream was being passed directly to Caddy's dial field with the
full URL (http://host:port), but Caddy expects just host:port. This was causing
DNS lookup errors with a leading slash (/authentik.bologna.local.fuo.fi).

Now properly parses the URL to extract just the hostname and port.
2025-11-19 20:22:38 +01:00
fuomag9
b2183bf856 Fix Authentik outpost callback by preserving original Host header
The outpost route now preserves the original request host (e.g., email.fuo.fi)
instead of changing it to the upstream host. This allows Authentik to properly
construct redirect URLs after processing authentication callbacks.
2025-11-19 20:06:15 +01:00
fuomag9
5cad15e20e re-ordered paths for allowing custom paths correctly 2025-11-19 18:35:00 +01:00
fuomag9
7ae51ad034 enforce admin role by reading user role instead of hardcoding 2025-11-19 18:06:24 +01:00
fuomag9
bc3e28d5ab fix callback on protected paths 2025-11-19 17:57:14 +01:00
fuomag9
ab64b67844 Potential fix for code scanning alert no. 5: Prototype-polluting function
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-11-15 10:25:13 +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
fa65dc1b2c Corrected Configuration for trea/caddy-loki-logger 2025-11-12 22:38:58 +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
2155aec746 Revert "Fix Caddy monitoring service detection and error logging"
This reverts commit 97a9d7947d, reversing
changes made to 88b25cee65.
2025-11-09 21:45:26 +01:00