source-cooperative / source-cooperative/data.source.coop
list_buckets panics via unimplemented!(); reachable by an unauthenticated non-GET request to /
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24
- Forks
- 6
- Avg merge
- 1h 32m
- Merged PRs (30d)
- 1
Description
Summary
SourceCoopRegistry::list_buckets is unimplemented!(), which panics rather than returning an error. It is reachable from a non-GET request to /.
Evidence
https://github.com/source-cooperative/data.source.coop/blob/main/src/source_api/registry.rs#L82-L88
async fn list_buckets(
&self,
_identity: &ResolvedIdentity,
) -> Result<Vec<BucketEntry>, ProxyError> {
unimplemented!("Bucket listing is not supported")
}
The signature already returns Result<_, ProxyError>, so a panic is avoidable at no cost.
Reachability: multistore dispatches ListBuckets for a request to / (multistore-0.7.2/src/proxy.rs:874). IndexHandler intercepts / but only claims GET:
// src/handlers.rs
if req.method == http::Method::GET {
Some(ProxyResult::json(200, format!("Source Cooperative Data Proxy v{}", VERSION)))
} else {
None // falls through to the gateway
}
So e.g. HEAD / or POST / falls through to the gateway and reaches list_buckets.
Impact
A panic in a Worker aborts the isolate and returns an opaque error to the caller, with no structured S3 error body. It is trivially reachable by an unauthenticated request. Not a data-integrity or disclosure risk, but it is an unauthenticated remote panic and it produces useless diagnostics.
Suggested fix
Return a proper S3 error instead of panicking — ProxyError::AccessDenied, or a NotImplemented-style error if one is a better fit for the S3 surface. Optionally have IndexHandler claim all methods on / so the fall-through cannot happen.
Note that implementing real bucket listing is a separate, larger question (it depends on the Role-ceiling work in the ADR set); this issue is only about not panicking.
Notes
Found while auditing the ADRs in #115 against the implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/source_api/registry.rs at SourceCoopRegistry::list_buckets, then read the non-GET fall-through in src/handlers.rs and the ListBuckets dispatch noted in multistore-0.7.2/src/proxy.rs. Verify HEAD or POST requests to / no longer panic and instead return a structured S3 error; check whether existing request tests cover this path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100