Repository navigation
Queued DM overwrite, storage bucket ownership - #142
athallajovian9-cyber wants to merge 3 commits into
Conversation
…ne sender does not replace the first
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| C# | Oct 12, 2026 1:50p.m. | Review ↗ | |
| C & C++ | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Docker | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Java | Oct 12, 2026 1:50p.m. | Review ↗ | |
| JavaScript | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Python | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Rust | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Secrets | Oct 12, 2026 1:50p.m. | Review ↗ | |
| Code coverage | Oct 12, 2026 2:20p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 4 |
| Duplication | 22 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
i feel like a dead person. |
|
making pull requests just to be ignored. |
|
Sorry, reviewing now. Then you can rebase without the deny.toml |
| .insert(from_agent_id.to_string(), pending.clone()); | ||
| .insert(pending.message_id.clone(), pending.clone()); |
There was a problem hiding this comment.
The intent is to have only one message pending for an agent to another. This is to ensure that the size of the pending messages is kept predicable so that the amount of memory can be constrained and known. It is the responsibility of the agents to use this wisely. I am sorry this hasnt been clearly documented.
If you want a all messages kept, I would accept a Config to allow different modes of message retention.
| /// and a module or runner writing on an agent's behalf does so from this machine. Loopback is therefore | ||
| /// accepted as well. Anything else -- including an agent that never registered a usable address (recorded as | ||
| /// "unknown") or a request with no peer at all -- is a stranger and is refused. | ||
| fn requester_owns_bucket(registered_ip: Option<&str>, peer: Option<std::net::SocketAddr>) -> bool { |
There was a problem hiding this comment.
Avoid using Option in function signatures.
The put logic should also be checking the AgentRecord.state to ensure the agent is still connected.
And we need to dig a bit more into why last_known_ip is an Option at all. And how/why req.peer_addr() can return None.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Three findings from a review of the repository, each fixed with its regression test.
1. Queued direct messages overwrite each other (
libs/edge-toolkit/src/ws_server.rs)queue_directstored pending messages keyed by sender id, so a second message queued from the same sender replaced the first: an offline recipient ended up with only the latest message, and the replaced one could never be acknowledged.The map is now keyed by message id (already a UUIDv7 from
connection.rs, which also keeps arrival order), so messages queue alongside each other.acknowledge_messagelooks entries up by themessage_idcarried on the message instead of by map key, which also acknowledges entries persisted under the old sender-keyed shape — covered by a dedicated test.Proof:
2. Storage writes are not authenticated to the bucket owner (
services/storage/src/routes.rs)PUT /storage/{agent_id}/{filename}only checked that the agent id exists, and the listener binds0.0.0.0(services/ws-server/src/main.rs:136), so any reachable client could write to another registered agent's bucket by naming its id.The write is now accepted only from the address the agent registered from (
last_known_ip, recorded at WebSocket connect) or from loopback, where the server's own runners and modules write on an agent's behalf. Anything else — including an agent that never registered a usable address (persisted asunknown) — gets the newStorageError::RequesterNotBucketOwner(403). Existence of the id is no longer treated as ownership.The bind address is deliberately unchanged: serving agents across interfaces (QR/hotspot deployments) is the product. Ownership now travels with the request instead.
Proof (the four pre-existing PUT tests gained an explicit peer matching the registered address):
3.
cargo-deny-checkfails onunsafe-libyaml(RUSTSEC-2024-0449)The crate is listed in the workspace's unmaintained metadata (
Cargo.toml) but was missing from the advisory ignore list inconfig/deny.toml, so the audit errors:Added the entry with the written rationale the file requires: reached via
serde_yaml(registry save/load and operator-supplied CLI YAML — local files, not attacker input), already allowlisted for the unmaintained scan, no patched version exists, cleared only by a workspace-wide move to a safe-Rust parser.Proof:
cargo deny --config config/deny.toml check→advisories ok, bans ok, licenses ok, sources ok(verified before/after by stashing the entry).Not included
src/behaviour change outside the two fixes; no dependency bumps.GET/HEADon storage and the absence of any WS-level authentication are larger design questions than this PR — happy to open an issue to discuss them rather than smuggle an auth model in here.