Skip to content

feat(tls): version the trust bundle and check its freshness (D8) - #780

Merged
alexis900 merged 1 commit into
developfrom
feat/trust-bundle-version
Nov 17, 2026
Merged

alexis900 merged 1 commit into
developfrom
feat/trust-bundle-version

Conversation

@alexis900

Copy link
Copy Markdown
Collaborator

Segunda parte de D8: el bundle deja de ser una concatenación DER cruda.

Formato

"NDTB" | version u16 | reserved u16 | built u32 | cert_count u32 | certificate…
  • libtls::der::parse_bundle valida magic, versión y que cert_count cuadre con el contenido: un fichero truncado o editado a mano no puede confiar en un subconjunto en silencio (antes un DER cortado parecía un almacén más pequeño).
  • bundle_freshness clasifica la fecha de build contra el reloj fiable (M7).
  • libnet::http_transport::{system_trust, trust_status} devuelven versión/fecha/anclas y aplican la política (Missing/Ok/Future/Stale); siguen aceptando un bundle crudo sin cabecera por compatibilidad.
  • neocurl avisa por stderr (salvo -s) si el bundle está fechado en el futuro o tiene más de dos años. Es aviso, no fallo: las anclas se verifican igual y una máquina sin red sigue funcionando.

NeoDev

NeoDOS-Project/NeoDev#50 escribe la cabecera, con SOURCE_DATE_EPOCH para imágenes reproducibles y count_certificates testeado.

Verificación

  • libtls: 5 tests nuevos de bundle (parseo, rechazo de magic/versión/count, frescura).
  • NeoDev: test de count_certificates (SEQUENCE con longitud corta y larga).
  • Huésped: pendiente de la ejecución en curso (bundle versionado + neocurl https://… sin --ca y sin aviso de frescura).

A raw DER concatenation gives no way to tell a truncated bundle from a valid
one, and no way to warn that the image's roots are years old.

- `libtls::der::parse_bundle` reads a `NDTB` header (format version, build time,
  certificate count) and rejects a mismatch with the payload, so a
  hand-edited file cannot silently trust a subset. `bundle_freshness` classifies
  the build time against the trusted clock.
- `libnet::http_transport::system_trust()` returns version/build time/anchors and
  still accepts an unversioned raw bundle; `trust_status()` applies the clock
  policy (`Missing`/`Ok`/`Future`/`Stale`).
- `neocurl` warns on stderr (unless `-s`) when the bundle is future-dated or
  older than two years. It is a warning, not a failure: anchors are verified as
  usual and offline machines keep working.

NeoDev (external, NeoDOS-Project/NeoDev#48) writes the header, honouring
`SOURCE_DATE_EPOCH` for reproducible images.
@alexis900
alexis900 merged commit ee68eec into develop Nov 17, 2026
4 checks passed
@alexis900
alexis900 deleted the feat/trust-bundle-version branch November 17, 2026 21:47
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