feat(api): require an admin token for configuration changes

Group CRUD decides what the scanner sweeps, yet any client that reached the
API could change it. Writes now need XEXEU_ADMIN_TOKEN (or a token generated
at startup and printed as a ?token= link, like sabia ui), compared in
constant time, and a browser Origin must match Host. The dashboard keeps the
token for the tab and asks for it on 401. Reads are unchanged.

Also track .env.example: '.env*' in .gitignore had kept it out of the
repository, although the README tells operators to copy it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-03 10:17:14 -03:00
1 parent 36eadabc7c
commit 90ece32dac
17 files changed
+369 -28

No files matched your search

+5 -1
View File
@@ -38,7 +38,11 @@ docker compose up -d --build
```
O dashboard sobe em `http://127.0.0.1:8788` por padrão (`XEXEU_PUBLISH` no
`.env` pra trocar endereço/porta).
`.env` pra trocar endereço/porta). Pra adicionar, editar ou remover grupos
por ele, defina `XEXEU_ADMIN_TOKEN` no `.env` (`openssl rand -hex 32`) ou,
deixando vazio, pegue o link avulso em `docker compose logs xexeu`; dentro do
contêiner ele aparece como `http://0.0.0.0:8788/?token=…`, então troque o host
pelo endereço publicado.
## Por que o `scanner` roda como `uid 0` restrito a `NET_RAW`