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:
1 parent
36eadabc7c
commit
90ece32dac
17 files changed
+369
-28
No files matched your search
+17
-7
@@ -15,14 +15,24 @@ dashboard/executive report.
|
||||
Usage: xexeu serve [OPTIONS]
|
||||
|
||||
Options:
|
||||
--bind <BIND> [default: 0.0.0.0:8788]
|
||||
--config <CONFIG> [default: config/xexeu.toml]
|
||||
--sweeps <SWEEPS> [default: data/sweeps]
|
||||
--data-dir <DATA_DIR> [default: data/xexeu]
|
||||
--bind <BIND> [default: 0.0.0.0:8788]
|
||||
--config <CONFIG> [default: config/xexeu.toml]
|
||||
--sweeps <SWEEPS> [default: data/sweeps]
|
||||
--data-dir <DATA_DIR> [default: data/xexeu]
|
||||
--admin-token <ADMIN_TOKEN> Token required by the API routes that change state.
|
||||
Without it, a random token is generated at startup
|
||||
and printed once [env: XEXEU_ADMIN_TOKEN]
|
||||
```
|
||||
|
||||
This is the `xexeu` Compose service's entrypoint.
|
||||
|
||||
Reads (`GET`) are open; the routes that change the configuration
|
||||
(`POST`/`PUT`/`DELETE /api/config/groups…`) need the admin token in
|
||||
`Authorization: Bearer <token>` or `X-Xexeu-Token`, and a browser `Origin`, when
|
||||
present, must match `Host`. Without `XEXEU_ADMIN_TOKEN`, `serve` prints a fresh
|
||||
`http://…/?token=…` link at each start; opening it logs the dashboard in for
|
||||
that tab.
|
||||
|
||||
## `xexeu scanner`
|
||||
|
||||
Runs the continuous scheduler and scan engine, writing sweep batches —
|
||||
@@ -75,7 +85,7 @@ Options:
|
||||
```
|
||||
|
||||
Exits non-zero on an invalid configuration — safe to use in a pre-push hook
|
||||
or CI step, which is exactly what `scripts/verificar.sh` does.
|
||||
or CI step, which is exactly what `scripts/check.sh` does.
|
||||
|
||||
## `xexeu feeds sync` / `xexeu feeds import`
|
||||
|
||||
@@ -142,11 +152,11 @@ Options:
|
||||
|
||||
```
|
||||
$ xexeu doctor
|
||||
Xexéu v0.1.0 - Diagnóstico do Ambiente
|
||||
Xexéu v1.0.0 - Diagnóstico do Ambiente
|
||||
================================================================================
|
||||
Item Status Detalhe
|
||||
--------------------------------------------------------------------------------
|
||||
versao ok xexeu v0.1.0
|
||||
versao ok xexeu v1.0.0
|
||||
config ok configuração válida (4 grupo(s))
|
||||
net_raw ok CAP_NET_RAW disponível (motor nativo ativo)
|
||||
sqlite ok banco SQLite acessível em data/xexeu/xexeu.db
|
||||
|
||||
Reference in new issue
Block a user