feat(panel): el panel admin vive en la raíz del prefijo, /admin desaparece
deploy-branch / deploy (push) Successful in 2m59s
deploy-branch / teardown (push) Skipped
tests / Unitarias + componente + build (push) Failing after 3m30s
tests / Integración (Nominatim real, opt-in) (push) Skipped
tests / Unitarias + componente + build (pull_request) Failing after 3m25s
tests / Integración (Nominatim real, opt-in) (pull_request) Skipped

La ruta fija /admin del enrutador SPA mostraba el panel sin importar el
prefijo configurado. Ahora AdminPanel se monta solo cuando el pathname
coincide con la raíz de LOCALESP_ADMIN_PREFIX (misma variable única que
backend, build y API): con /administrador, el panel queda en
/administrador y /admin pasa a mostrar la web pública.

- src/main.jsx: enrutado por ADMIN_RUTA derivada del prefijo
- README y artefactos openspec (spec/design) actualizados
This commit is contained in:
2026-10-03 14:33:34 +02:00
parent 34bd421853
commit 4d7d9e19dc
5 changed files with 28 additions and 10 deletions
@@ -21,6 +21,11 @@
> para servidor, proxy de desarrollo y frontend. Vite la expone al código
> cliente mediante `envPrefix: ["VITE_", "LOCALESP_"]` y `npm run build`
> también falla si falta.
>
> **Actualización 4 (2026-10-02, petición del usuario):** el panel de
> administración también se oculta: vive en la **raíz del prefijo**
> (`$LOCALESP_ADMIN_PREFIX`, p. ej. `/administrador`) y la ruta fija `/admin`
> pasa a mostrar la web pública. Una sola variable define URL del panel y API.
## Context
@@ -64,8 +64,9 @@ Admin endpoints under the prefix:
### Requirement: Admin panel routes are fully discoverable
**Reason**: Security concern — admin routes should be harder to discover
**Migration**: Admin users access the panel at `/admin`; its API calls go to
the configured prefix — the same single `LOCALESP_ADMIN_PREFIX` variable at build time
**Migration**: Admin users access the panel at the prefix root
(`$ADMIN_PREFIX`, compiled with the same `LOCALESP_ADMIN_PREFIX`); its API
calls go to the configured prefix
## MODIFIED Requirements
@@ -77,9 +78,12 @@ The requirement SHALL:
`/api/pendientes` returns 404 when a prefix is configured)
#### Scenario: Admin views pending proposals through the panel
- **WHEN** an admin opens the panel at `/admin`
- **WHEN** an admin opens the panel at the prefix root (`$ADMIN_PREFIX`,
e.g. `/administrador`)
- **THEN** the panel fetches `$ADMIN_PREFIX/pendientes` (compiled with
`LOCALESP_ADMIN_PREFIX`) and renders the list exactly as before
- **AND** the legacy `/admin` URL renders the public site (the panel route
no longer exists)
**Design note**: This is obscurity, not security: the prefix ships in the
frontend bundle. It raises the cost of blind route enumeration only. Real