fix(security): permit fail-closed + ban http API keys + pin rust-toolchain - #211
Conversation
…chain Permit fetch/decode errors now fail metagraph_at instead of an empty map that would let a pure vector through. ctx refuses X-Lium-Api-Key on http://. release-ctx pins dtolnay/rust-toolchain by commit SHA. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Co-authored-by: Mathis <echobt@users.noreply.github.com>
|
Review (Développeur) — LGTM on the three #210 P1s; cannot APPROVE via API (PR authored as echobt).
HOLD: do not ship gateway/validator images to cortex-production until this merges with CI + Greptile green. |
|
@greptileai review |
Greptile SummaryThe client rejects configured cleartext gateways when an API key is present, but automatic redirects can still send that key to a cleartext destination. This must be addressed before merging. Confidence Score: 3/5Not safe to merge: keyed requests can disclose API keys when a gateway redirects to HTTP. A reproduced security failure affects the complete request path after the initial gateway URL check. Files Needing Attention: bins/ctx/src/api.rs needs an HTTPS-only redirect policy or must disable redirects for keyed requests.
|
reqwest follows redirects by default and resends headers to Location, including http://. Keyed gateway calls now use Policy::none() so a 302 cannot put the API key on cleartext. Regression test: 302 to a second origin is returned and the target is never contacted. Co-authored-by: Mathis <echobt@users.noreply.github.com>
Rebase of #207 onto main post #210/#211. Live catalog stays bounty+proof. ctx relearn|image|agent remain for local stacks and print an off warning. xtask now pins DEFAULT_GATEWAY from the binary and refuses miner-doc placeholders and operator env names. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Mathis <echobt@users.noreply.github.com>
Security hotfix on
mainafter #210. Three focused fail-closed changes only. Does not merge.Summary
Permit map fail-closed (
chain-live) —ValidatorPermitread or SCALE-decode errors now failmetagraph_atinstead of substituting an empty vec. Missing storage, RPC faults, truncated bytes, and a decoded map whose length does not match hotkeys all fail closed. An empty map used to look like “no UID is a validator”, which would let a pure burn/vector through. Validator submit already skips when metagraph fetch fails.ctxkeyed calls are HTTPS-only —X-Lium-Api-Keyis never attached onhttp://. Constructing a client with a key and a cleartext gateway fails with a clear error that does not echo the key.http://without a key remains allowed for local stacks.release-ctx.ymlpinsdtolnay/rust-toolchainto commitd1031067263f94b142dd6c0ce24c5eb9d02d52a0(never@masterundercontents: write).No Modal. No secrets in git.
Greptile
Every PR is reviewed by Greptile before merge. Config:
.greptile/.@greptileai reviewTest plan
cargo test -p chain-live --lib(59 passed, ignored live testnet)cargo test -p ctx(30 passed)cargo fmt --all -- --checkcargo clippy -p chain-live -p chain -p ctx --all-targets -- -D warningscargo run -p xtask -- loc-capRisk
Live validators skip
set_weights/ timelocked submit whenValidatorPermitcannot be read or decoded, instead of submitting a vector that could pay a validator UID.ctxminers using--gateway http://...together withLIUM_API_KEYmust switch to HTTPS.Naming
I did not rename
BASE_*environment variables, deployed host paths (/opt/base,/run/base, …), GHCRbaseintelligence/basepackage names, orbase-*-v1cryptographic domain tags.