Remove unused STELLAR_GATEWAY_SECRET - #203
Merged
Manuel1234477 merged 4 commits intoJul 25, 2026
Merged
Conversation
Per-IP rate limiting on POST /payments needs ConnectInfo<SocketAddr>, but the test server was built from a plain Router (mock transport, no connection info), causing every request to 500. Wrap the test router with into_make_service_with_connect_info to match main.rs.
This reverts commit 05106df.
The gateway only ever watches STELLAR_GATEWAY_PUBLIC for incoming payments; it never signs or submits Stellar transactions, so gateway_secret had no consumer anywhere outside config.rs. Overpayment refunds are documented as a merchant-side action triggered by the payment.overpaid webhook, not something the gateway performs. Asking operators to mount a live wallet secret key into a process that can't use it needlessly widens the blast radius of a compromise, so the variable, its validation, and its docs are removed rather than building an unused signing/refund path. Closes StellarGateLabs#75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gateway_secret(fromSTELLAR_GATEWAY_SECRET) was read, validated, and redacted inDebug, but had no consumer anywhere outsideconfig.rs— the gateway never signs or submits Stellar transactions.payment.overpaidwebhook event, not something the gateway performs itself, so there's no outbound/signing feature that actually needs the secret.Changes
gateway_secretfield, itsfrom_env()wiring,validate_gateway_secret(), itsDebugredaction, and its dedicated unit tests fromsrc/config.rs.gateway_secret: String::new()entries from testConfigfixtures (src/expiry.rs,tests/*.rs).STELLAR_GATEWAY_SECRETfrom.env.exampleand the env var table inREADME.md, and added a short note clarifying the gateway never holds a secret key / never signs transactions, and that refunds remain a merchant-side action.gateway_public(STELLAR_GATEWAY_PUBLIC) is untouched — it's actively used as the destination address the Horizon poller/stream watches.Test plan
cargo check --lib— compiles cleanlycargo test --lib— 89 passed, 0 failedgrep -rn "gateway_secret\|GATEWAY_SECRET" src/ tests/ README.md .env.example— no resultsNote: this repo's
maincurrently has a pre-existing, unrelated compile break insrc/main.rs(ajoin_task!macro moves eachJoinHandlebefore a later use, plus a missingtask_healthfield in one test fixture) that predates this change and is unrelated to issue #75 — confirmed viagit stashagainstorigin/mainbefore making any edits. I left it out of this PR to keep it scoped to the gateway secret removal; happy to open a separate PR for it if useful.Closes #75