Repository navigation
fix(queue): refuse broker credentials over plaintext amqp:// - #99
Conversation
RabbitQueues::connect and the facade's QueueConfig::parse accepted any amqp:// URL, so a host that forgot its own check could send broker credentials in clear text. Both now apply check_broker_url: an amqp:// URL with userinfo needs a loopback host (localhost, 127.0.0.0/8, ::1) or the explicit opt-in ?insecure=true for a trusted private network. amqps:// and credential-free URLs are unaffected. The opt-in is removed before connecting, so it never reaches the broker, and the error never contains the URL. Hosts may keep a stricter rule of their own. Closes tinyhumansai#79
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Tiny Sweeper reviewReviewed head: FindingsNo active actionable findings. Advisory notes
Verdict: Ready for maintainer review · Priority: medium Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(queue): refuse broker credentials over plaintext amqp://. `QueueConfig::parse` keeps the URL as given while `connect` re-checks and strips the opt-in. No push delta is available: the review state has no trusted base-to-head comparison, so only the whole-pull-request behavior is described. Review snapshot
Completeness: Complete What changedBoth enforcement points now share one rule. `RabbitQueues::connect` calls the check first and opens the link with the returned, opt-in-free URL, so a refused URL never reaches the connection. `QueueConfig::parse` calls the same check before constructing the `RabbitMq` variant but stores the URL as given, deferring stripping to connect. The function is exported from the queue crate and documented in the RabbitMQ spec, including that hosts may apply a stricter rule. Features
TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Summary
RabbitQueues::connectand the facade'sQueueConfig::parseaccepted anyamqp://URL, so a host that forgot its own check could send broker credentials in clear text. Both now apply one rule,tinystoragedrivers_queue::check_broker_url:amqp://with userinfo is refused (InvalidInput) unless the host is loopback (localhost,127.0.0.0/8,::1) or the URL opts in with?insecure=truefor a trusted private network.amqps://, loopback, and credential-free URLs pass unchanged.insecureparameter is removed before connecting, so the opt-in never reaches the broker.QueueConfig::parsekeeps the URL as given;connectchecks it again and strips the opt-in. Hosts may apply a stricter rule. OpenHuman's own guard (inbound/settings.rs) also refuses loopback and keeps doing so.Closes #79
API or behavior changes
New public function
tinystoragedrivers_queue::check_broker_url. Behaviour: a non-loopbackamqp://URL with credentials and no opt-in is now refused at parse and at connect.Validation
On a Linux build host, merged onto main 05acdd9 (and merging cleanly onto v2.1.3, f5a3302):
cargo test --locked -p tinystoragedrivers-queue --features rabbitmq broker_url: 4 passed.cargo test --locked -p tinystoragedrivers --features rabbitmq queues: 4 passed.cargo check --locked -p tinystoragedrivers --no-default-features, and with--features rabbitmq.cargo test --workspace --all-features --locked: 856 passed, 0 failed, 1 ignored.-D warnings(0 items),cargo fmt --check, rustdoc-D warnings.TSD_RABBITMQ_URL(amqp://guest:guest@127.0.0.1…) is loopback, so it is allowed.Tests
rabbitmq/broker_url_tests.rs:insecure=false);queues_tests.rs: the facade refuses, allows and keeps the opt-in on the parsed URL.docs/specs/queue-rabbitmq.mddocuments the rule.