Skip to content

Require a valid token to list ingestions - #656

Open
arpitjain099 wants to merge 1 commit into
NASA-IMPACT:developfrom
arpitjain099:fix/list-ingestions-requires-token
Open

arpitjain099 wants to merge 1 commit into
NASA-IMPACT:developfrom
arpitjain099:fix/list-ingestions-requires-token

Conversation

@arpitjain099

Copy link
Copy Markdown

GET /ingestions is the only route on the ingest API with no token dependency. Listing the dependencies the app actually builds:

GET  /ingestions -> ['ListIngestionRequest', 'get_db']
POST /ingestions -> ['valid_token_dependency', 'get_username', 'get_db']

GET /ingestions/{ingestion_id} is protected too, through fetch_ingestion, which also passes username to fetch_one so a caller only sees their own record. The listing goes to fetch_many, which queries the status index with no owner predicate, so what comes back spans every user: created_by, collection and the assets hrefs included.

I added the same dependency /auth/me uses, since this is a read and the write scopes do not fit. The test compares the GET route's dependencies against the POST route's and fails without the change.

One thing I deliberately left alone: even with a token, the response still covers other users' ingestions. Scoping fetch_many means changing the index query, which is your call rather than mine.

GET /ingestions was the only ingestion route without a token dependency. The
six siblings all carry one, and GET /ingestions/{ingestion_id} gets it through
fetch_ingestion, which also scopes the read to the caller via fetch_one. The
listing queries the status index, so it returns every user's records to anyone
who asks.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant