Repository navigation
feat: basic auth on regtest calls - #201
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Resolved: bitkit-core now sends the regtest requests itself, so it stays on |
talosmachina
left a comment
There was a problem hiding this comment.
2 findings (1 P0, 1 P2). Adds an optional user:password basic auth to the five regtest_* exports, defaulted to nil in the bindings, and moves the Blocktank tests to api.stag0.blocktank.to. Reviewed 505c88d, full tier.
What I checked, and 3 candidates I ruled out
Read in full: the diff of src/lib.rs, src/modules/blocktank/api.rs, src/modules/blocktank/tests.rs, Cargo.toml, Cargo.lock, bindings/ios/bitkitcore.swift, bindings/ios/bitkitcoreFFI.h
Call sites traced: every caller of the five BlocktankDB::regtest_* methods (only src/lib.rs and tests.rs), all updated
Not built here: the review is from the code and from CI. with_regtest_auth and the 401 message live in the pinned rust-blocktank-client commit, which I could not read, so that half is unverified.
CI: red on 6 jobs. Android Bindgen, iOS Bindgen, Cargo manifests, paykit-route-tests and wake-tests all stop at fetching rust-blocktank-client (finding 1); usdt-tests stops at cargo fmt --check (finding 2).
Ruled out
- Source break for existing callers:
#[uniffi::export(default(auth = None))]gives Swiftauth: String? = nil, so Swift call sites compile unchanged. The Kotlin bindings are not checked in, so their default is not visible in this diff; uniffi 0.29 generates it from the same attribute. - Auth leaking to non-regtest routes:
regtest_client()clonesself.clientper call and only the five regtest methods use it, so the stored client never carries the credential. - Stale Swift checksums: the five
uniffi_bitkitcore_checksum_func_regtest_*constants changed together with the signatures.
Merge confidence: 1/5, the crate does not build in CI because the pinned dependency cannot be fetched.
coreyphillips
left a comment
There was a problem hiding this comment.
Two independent reviews, nothing blocking a merge.
worth doing, does not block
- Regtest errors expose passwords embedded in the base URL (src/modules/blocktank/api.rs:252)
- Base URL query strings swallow the regtest path (src/modules/blocktank/api.rs:232-235)
nits
- README signatures for the regtest functions omit the new auth parameter (README.md:354-383).
README.md:354-383andsrc/modules/blocktank/README.md:99-120still list the five regtest functions withoutauth: Option<String>. Neither README says the staging regtest routes now needuser:passwordbasic auth.
|
Merged: approved by @coreyphillips, review threads answered and resolved, required checks green (Android Bindgen still running, not required). His two non-blocking points are fixed in #203. |
Staging Blocktank's
/regtest/*routes now require HTTP basic auth, so the apps' Settings > Blocktank Regtest actions (deposit, mine, pay, close channel) get 401 on staging regtest builds.This PR:
auth(user:password) as the last parameter ofregtest_mine,regtest_deposit,regtest_pay,regtest_get_paymentandregtest_close_channel; it defaults tonil/nullin the bindings, so existing callers still compileauthis set; the credentials go only to the regtest routesBlocktank regtest API returned 401 Unauthorized: regtest auth is missing or was rejectedon a 401api.stag0.blocktank.to, the staging host the apps use;api.stag.blocktank.tono longer resolvesrust-blocktank-client0.0.16 can't send auth on these routes. synonymdev/rust-blocktank-client#14 adds it; once 0.0.17 is published, the regtest calls can move back to the client.Tests
Against staging (
api.stag0.blocktank.to):test_regtest_mineandtest_regtest_depositpass withBLOCKTANK_REGTEST_AUTHsetThe order and CJIT tests in
blocktank::testsstill fail against staging withNot foundon order creation, as before this PR.