source-cooperative / source-cooperative/data.source.coop

list_buckets panics via unimplemented!(); reachable by an unauthenticated non-GET request to /

Open Beginner friendly
#218 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.