registrystack / registrystack/registry-stack
Name the refused secret reference when a BReg source binding fails to build
- Lingua principale
- Rust
- Stelle
- 2
- Fork
- 0
- Merge medio
- 2h 55m
- PR unite (30g)
- 130
Descrizione
### What we hit
Follow-up to #977. Database, audit-journal, and static-JWKS secret failures now name the operator-authored reference and the rule it broke, without echoing secret bytes. The BReg source binding does not.
In `crates/registry-casework-breg/src/config.rs`, `resolve_secret` maps every `SecretError` for `clientIdRef`, `clientAssertionKeyRef`, `webhookSecretRef`, and the optional trust references to `SourceAdapterError::Invalid`. `build_runtime` in `crates/registry-casework/src/runtime.rs` then maps that to `RuntimeError::SourceConfiguration(source_id)`, so the operator sees only:
```
the Casework source binding for source professional-register is invalid
```
A binding declares up to five secret references plus two URLs and a description file, and the message does not say which one was refused or why (missing file, wrong mode, ownership, hard links, NUL byte, or reference grammar).
### Where it maps
- `crates/registry-casework-core/src/adapter.rs`: `SourceAdapterError` has no variant that carries a configuration diagnostic, and the core must stay source-neutral.
- `crates/registry-casework-breg/src/config.rs`: `resolve_secret`, `parse_url`, `read_description` all collapse to `Invalid`.
- `crates/registry-casework/src/runtime.rs`: `build_adapter(...).map_err(|_| RuntimeError::SourceConfiguration(...))`.
- `crates/registry-casework/src/config.rs`: `describe_secret_failure` already produces the bounded sentence the other paths use.
### Ask
Carry a bounded, secret-free diagnostic from adapter construction to the startup error: either a `SourceAdapterError` variant holding the described failure (reference text plus rule, never the resolved bytes or the opened path), or a separate construction error type that `build_adapter` returns and the runtime formats with `describe_secret_failure`. The message must name the source, the setting (`clientIdRef` and so on), and the rule. Add the same test shape as `tests/secret_diagnostics.rs` for a binding with a mode 0644 key file.
`caseworkctl doctor` already preflights `secret:file/` references per setting, so this is only the runtime startup path.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con SourceAdapterError in crates/registry-casework-core/src/adapter.rs, quindi segui resolve_secret, parse_url e read_description in crates/registry-casework-breg/src/config.rs attraverso build_adapter e build_runtime. Leggi describe_secret_failure in crates/registry-casework/src/config.rs e usa tests/secret_diagnostics.rs come modello. Il lavoro è completo quando l'output di avvio indica la sorgente, l'impostazione e la regola senza esporre i byte del secret né i percorsi aperti, incluso il caso del file di chiavi in modalità 0644.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- backend, security
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Attiva
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 68/100