fix(homelab-wiki): per-host tokens via X-DokuWiki-Token, password-file unlock #19

Merged
Grok merged 1 commit from fix/homelab-wiki-per-host-tokens into main 2026-10-03 23:19:59 +00:00
Member

Fixes the homelab-wiki helper failing with 401 on every call.

Why the helper got 401s: the helper sent Authorization: Bearer or fell back to HTTP Basic. theboss drops Authorization, and the vault item had no token field, so every call went out with Basic auth and failed. Each wiki (hlw.valleygeek.net, hlw.loopcamp.win) also issues its own tokens, so one token cannot serve both hosts.

Helper (skills/homelab-wiki/scripts/wiki.py):

  • picks the token by the host in --wiki-base:
    • hlw.valleygeek.net uses vault field api_token or /home/box/.secrets/dokuwiki-hlw-token
    • hlw.loopcamp.win uses api_token_loopcamp or /home/box/.secrets/dokuwiki-hlw-loopcamp-token
    • any other host or a non-https base is refused
  • --token-source auto|file|vault; auto uses the host token file when it exists, else the vault field
  • sends the token only as X-DokuWiki-Token, always with a browser User-Agent; Bearer and Basic are removed
  • refuses HTTP redirects, so the token never follows to another URL
  • vault unlock reads the master password from BW_PASSWORD / VAULTWARDEN_PASSWORD, or silently from a 0600 file named by BW_PASSWORDFILE / BW_PASSWORD_FILE / VAULTWARDEN_PASSWORD_FILE (the same convention as with-secrets)
  • validate checks identity with core.whoAmI (must be grok); new whoami subcommand that prints no email

Docs:

  • updated SKILL.md, configs/_shared/homelab-wiki.md (vault item name was stale; now has the per-host token table and operator setup), loopcamp.md, grok-build README, and the skills and configs READMEs
  • added skills/homelab-wiki/env.example

Tests (Bot box, no secrets printed):

Host validate (vault, password-file env) validate (file) whoami get homelab:start
hlw.valleygeek.net OK, username=grok, 2026-07-14c OK grok 43072 bytes
hlw.loopcamp.win OK, username=grok, 2026-07-14a OK grok 37081 bytes

Also tested: an env using the BW_PASSWORDFILE key works; an env with no password key, an unknown host, and an http base all fail cleanly.

Fixes the homelab-wiki helper failing with 401 on every call. **Why the helper got 401s:** the helper sent `Authorization: Bearer` or fell back to HTTP Basic. theboss drops `Authorization`, and the vault item had no token field, so every call went out with Basic auth and failed. Each wiki (hlw.valleygeek.net, hlw.loopcamp.win) also issues its own tokens, so one token cannot serve both hosts. **Helper (`skills/homelab-wiki/scripts/wiki.py`):** - picks the token by the host in `--wiki-base`: - hlw.valleygeek.net uses vault field `api_token` or `/home/box/.secrets/dokuwiki-hlw-token` - hlw.loopcamp.win uses `api_token_loopcamp` or `/home/box/.secrets/dokuwiki-hlw-loopcamp-token` - any other host or a non-https base is refused - `--token-source auto|file|vault`; auto uses the host token file when it exists, else the vault field - sends the token only as `X-DokuWiki-Token`, always with a browser User-Agent; Bearer and Basic are removed - refuses HTTP redirects, so the token never follows to another URL - vault unlock reads the master password from `BW_PASSWORD` / `VAULTWARDEN_PASSWORD`, or silently from a 0600 file named by `BW_PASSWORDFILE` / `BW_PASSWORD_FILE` / `VAULTWARDEN_PASSWORD_FILE` (the same convention as `with-secrets`) - `validate` checks identity with `core.whoAmI` (must be grok); new `whoami` subcommand that prints no email **Docs:** - updated SKILL.md, `configs/_shared/homelab-wiki.md` (vault item name was stale; now has the per-host token table and operator setup), `loopcamp.md`, grok-build README, and the skills and configs READMEs - added `skills/homelab-wiki/env.example` **Tests (Bot box, no secrets printed):** | Host | validate (vault, password-file env) | validate (file) | whoami | get homelab:start | |---|---|---|---|---| | hlw.valleygeek.net | OK, username=grok, 2026-07-14c | OK | grok | 43072 bytes | | hlw.loopcamp.win | OK, username=grok, 2026-07-14a | OK | grok | 37081 bytes | Also tested: an env using the `BW_PASSWORDFILE` key works; an env with no password key, an unknown host, and an http base all fail cleanly.
Grok merged commit f35a7efebf into main 2026-10-03 23:19:59 +00:00
Grok deleted branch fix/homelab-wiki-per-host-tokens 2026-10-03 23:19:59 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ai-collab/agents!19
No description provided.