Commit graph

63 commits

Author SHA1 Message Date
12fd2f2e70 fix(security): prevent username enumeration via timing attack
All checks were successful
continuous-integration/drone/push Build is passing
Perform a dummy LDAP bind when SearchDN fails so that the response time
is indistinguishable between unknown users and wrong passwords.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 12:42:41 +07:00
e64db9d923 style: improve altcha widget integration and button alignment
Some checks reported errors
continuous-integration/drone/push Build was killed
- Style altcha widget to match theme using CSS variables (border, background, colors, dark mode)
- Make buttons in .btn-group stretch full width to align with inputs
- Center altcha widget with max-width: 100%

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 12:38:08 +07:00
121efb6b62 Add a custom theme for dexidp
Some checks reported errors
continuous-integration/drone/push Build was killed
2026-03-08 12:26:40 +07:00
20c757cb76 feat: move brand outside card and simplify logo/name display logic
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 12:26:26 +07:00
51813d3957 feat: update theme color to green and add sky-inspired background gradient
All checks were successful
continuous-integration/drone/push Build is passing
Replace violet/indigo accent colors with #2fa700 green, and update the
background from a flat color to a diagonal gradient evoking a sky over
green landscape (light: sky blue → meadow green; dark: midnight → forest).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 11:55:28 +07:00
99def55e80 feat: replace Bootstrap with custom CSS and add profile page
All checks were successful
continuous-integration/drone/push Build is passing
- Add self-hosted style.css replacing Bootstrap CDN dependency
- Add profile.html with tabbed view (account info, emails/aliases, API token)
- Refactor login handler to pass structured data to template instead of building HTML strings
- Add brand-name and brand-logo flags/env vars for UI customization
- Update CSP to allow brand logo domain and remove CDN references
- Update all templates to pass template vars to header/footer and use new CSS classes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 11:49:51 +07:00
910dd7b47a Add log to know LDAP server in use 2026-03-08 11:48:34 +07:00
439dc2cd07 refactor: modernize Go idioms across codebase
Replace map[string]interface{} with map[string]any, ioutil.ReadAll with
io.ReadAll, and simplify redundant fmt.Sprintf/w.Write calls.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 11:48:34 +07:00
8933055358 feat: add -dev flag for local HTTP testing
In development mode (-dev):
- HSTS header is omitted (prevents browser caching HTTPS-only requirement)
- CSRF cookie Secure flag is cleared (allows cookies over plain HTTP)
- A warning is logged on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 10:56:37 +07:00
28f55960de feat(security): add altcha proof-of-work CAPTCHA to all sensitive forms
Integrate go-altcha to protect login, change password, lost password,
and reset password forms against automated submissions. Serves the
altcha widget JS from the embedded library, exposes a challenge
endpoint, validates responses server-side with replay prevention, and
updates the CSP to allow self-hosted scripts and WebAssembly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-08 10:56:16 +07:00
7b0f3bc61d fix(security): strengthen password policy
Increase minimum password length from 8 to 12 characters and require
at least one uppercase letter, one lowercase letter, and one digit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
9870fa7831 fix(security): use crypto/rand for alias prefix generation
Replace math/rand.Intn with crypto/rand for generating random alias
prefixes. While aliases are not security tokens, using a CSPRNG ensures
consistent use of cryptographically secure randomness throughout.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
78c4e9c3b0 fix(security): enforce domain allowlist for email alias creation
Add ALIAS_ALLOWED_DOMAINS env var (comma-separated) that restricts which
domains users may create aliases under. Alias creation is disabled when
the env var is not set. Prevents users from creating aliases with arbitrary
domains (e.g. for phishing/spoofing).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
5451ec3918 fix(security): add HTTP security headers middleware
Set X-Frame-Options, X-Content-Type-Options, Referrer-Policy, CSP,
and Strict-Transport-Security on all responses to mitigate clickjacking,
MIME sniffing, XSS, and downgrade attacks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
7b568607a6 fix(security): require configurable secret for X-Special-Auth docker registry bypass
Replace hardcoded "docker-registry" check with a configurable secret via
DOCKER_REGISTRY_SECRET env var. When the env var is unset, the anonymous
docker registry bypass is disabled entirely, closing the unauthenticated
access path if the service is accidentally exposed directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
2a9eec233a fix(security): add per-IP rate limiting to all authentication endpoints
Implement sliding window rate limiter to prevent brute-force attacks:
- /auth and /login: 20 requests/minute per IP
- /change: 10 POST requests/minute per IP
- /lost: 5 POST requests/minute per IP (prevents email spam and user enumeration)
- /reset: 10 POST requests/minute per IP
- /api/v1/aliases: 30 requests/minute per IP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
93673510d8 fix(security): escape LDAP attribute data in HTML output to prevent XSS (CWE-79)
Use html.EscapeString for attribute names and values when building HTML.
Move dynamic data (alias URL, API token) to data-* attributes and use
a self-contained onclick function to read them, eliminating JS string
injection via LDAP-controlled values.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
57775bbf89 fix(security): redesign password reset tokens using crypto/rand with server-side storage
- Replace SHA512-based deterministic token with 32-byte crypto/rand token
- Store tokens server-side with 1-hour expiry and single-use semantics
- Remove genToken (previously broken due to time.Add immutability bug)
- Add CSRF double-submit cookie protection to change/lost/reset forms
- Remove token from form action URL (use hidden fields only, POST body)
- Add MailFrom field and SMTP_FROM env var for configurable sender address
- Add SMTP_PASSWORD_FILE env var for secure SMTP password loading
- Add PUBLIC_URL env var and --public-url flag for configurable reset link domain
- Use generic error messages in handlers to avoid information disclosure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
a2f368eb02 fix(security): add missing return after redirect in resetPassword handler
http.Redirect only sets response headers; without return, handler execution
continued with empty login/token strings, potentially causing unexpected
LDAP queries and information leakage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
10f41e4ef8 fix(security): escape LDAP filter inputs to prevent filter injection (CWE-90)
Use ldap.EscapeFilter() on all user-controlled inputs before interpolating
them into LDAP search filter strings in SearchDN and SearchMailAlias.
Prevents authentication bypass via filter manipulation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 15:30:48 +07:00
121770c18a chore(deps): update dependency go to v1.26.0 2026-03-06 15:30:48 +07:00
4b7405fc61 chore(deps): update dependency go to v1.25.5 2026-03-06 15:30:48 +07:00
000f04a8f6 chore(deps): update module github.com/go-ldap/ldap/v3 to v3.4.12 2026-03-06 15:30:48 +07:00
399e8b6367 chore(deps): update module github.com/go-ldap/ldap/v3 to v3.4.11 2026-03-06 15:30:48 +07:00
6836e70e83 Can launch the executable with arguments to get reset token 2026-03-06 15:30:48 +07:00
0197446952 chore(deps): update module github.com/go-ldap/ldap/v3 to v3.4.10 2026-03-06 15:30:48 +07:00
ee1f8ce69f Hide krbPrincipalKey 2026-03-06 15:30:48 +07:00
65d0d4a53e Can delete own aliases 2026-03-06 15:30:48 +07:00
e6a4271a75 Add an API compatibly with addy.io to generate aliases
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-31 16:19:53 +02:00
b197fcd9af Replace bindata by embed 2024-05-31 15:52:25 +02:00
6fddff0b9c ci: Add triggers to avoid pull
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-24 10:40:20 +02:00
e724173bfe Update module github.com/go-ldap/ldap/v3 to v3.4.8
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2024-04-16 17:04:11 +00:00
5f4467750b Update module github.com/go-ldap/ldap/v3 to v3.4.6
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2023-09-16 12:08:02 +00:00
61165a3265 Update module github.com/go-ldap/ldap/v3 to v3.4.5
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2023-06-09 19:09:35 +00:00
dec12304a1 Update module github.com/go-ldap/ldap/v3 to v3.4.4 2022-07-28 09:19:01 +00:00
907f496b91 Add button to display the password fields
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-29 00:53:20 +02:00
b85f9b42c1 Update module github.com/go-ldap/ldap/v3 to v3.4.3
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2022-04-24 13:14:51 +00:00
3d948da818 Update github.com/amoghe/go-crypt commit hash to 20eada5
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2022-02-22 12:05:04 +00:00
d4a12f8205 Make go binaries lighter
All checks were successful
continuous-integration/drone/push Build is passing
2022-02-19 15:57:45 +01:00
1c55277edf Run container as user 2022-02-19 15:57:45 +01:00
86676c61e5 Update module github.com/go-ldap/ldap/v3 to v3.4.2
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2022-02-15 14:05:21 +00:00
8be6706460 docker-registry: Also need pass to display /, to have a working UI
All checks were successful
continuous-integration/drone/push Build is passing
2021-11-28 16:36:39 +01:00
e5046b108b Allow login of simpleSecurityObjects
All checks were successful
continuous-integration/drone/push Build is passing
2021-09-15 18:25:11 +02:00
5643713c54 /auth: special case for docker-registry 2021-09-15 18:25:11 +02:00
82233a4b84 Update module github.com/go-ldap/ldap/v3 to v3.4.1
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-08-17 18:38:49 +00:00
9a7e8be351 Update module gopkg.in/ldap.v2 to v3
Some checks reported errors
continuous-integration/drone/pr Build was killed
continuous-integration/drone/push Build is passing
2021-08-12 03:32:34 +02:00
e9019026ff Include username in response header (for use by nginx auth_request)
All checks were successful
continuous-integration/drone/push Build is passing
2021-08-11 18:33:14 +02:00
f54f54e538 Add renovate.json
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is passing
2021-08-03 09:02:00 +00:00
b014c3fb3c Can send mail through a smtp relay
All checks were successful
continuous-integration/drone/push Build is passing
2021-06-12 10:03:32 +02:00
fa494910cf chldapasswd is now a go module 2021-02-03 15:16:19 +01:00