Skip to content

feat: daemon auth hardening + CYD token#9

Merged
opariffazman merged 4 commits into
masterfrom
feat/daemon-auth-hardening
May 25, 2026
Merged

feat: daemon auth hardening + CYD token#9
opariffazman merged 4 commits into
masterfrom
feat/daemon-auth-hardening

Conversation

@opariffazman

Copy link
Copy Markdown
Owner

wat

daemon expose usage metrics. was open to world. bad.

fix

  • bind localhost default. LAN users set OHMYCLAWD_LISTEN=:8787
  • optional bearer token via OHMYCLAWD_TOKEN env. no token = no auth (backward-compat)
  • /healthz always open (CF Tunnel health checks need it)
  • crypto/subtle constant-time compare. no timing oracle
  • CYD gets "Daemon Token" field in WiFiManager captive portal. stored NVS. sent as Authorization: Bearer header

use

scenario LISTEN TOKEN
local only 127.0.0.1:8787 (default) unset
LAN no auth :8787 unset
LAN + auth :8787 <secret>
CF Tunnel 127.0.0.1:8787 <secret>

test

  • 24 go tests pass
  • smoke: no token → open access
  • smoke: with token → 401 without, 200 with correct bearer
  • /healthz bypasses auth always
  • CYD firmware compiles (pio run -e cyd)

🤖 Generated with Claude Code

opariffazman and others added 4 commits May 26, 2026 02:47
Uses crypto/subtle for constant-time comparison.
No-op when OHMYCLAWD_TOKEN is unset (backward-compat).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Default OHMYCLAWD_LISTEN changes from :8787 to 127.0.0.1:8787.
/healthz bypasses auth for CF Tunnel health checks.
/usage and /metrics require Bearer token when OHMYCLAWD_TOKEN is set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
New 'Daemon Token' field in WiFiManager captive portal.
Stored in NVS Preferences. Sent as Authorization header.
Empty = no header (backward-compat with unauthenticated daemons).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@opariffazman
opariffazman merged commit 4a1aa3d into master May 25, 2026
2 checks passed
@opariffazman
opariffazman deleted the feat/daemon-auth-hardening branch May 25, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant