Skip to content

feat: custom STAC API runtime with collection transactions enabled#97

Open
hrodmn wants to merge 13 commits into
mainfrom
feat/stac-api-collection-transactions
Open

feat: custom STAC API runtime with collection transactions enabled#97
hrodmn wants to merge 13 commits into
mainfrom
feat/stac-api-collection-transactions

Conversation

@hrodmn
Copy link
Copy Markdown
Collaborator

@hrodmn hrodmn commented May 15, 2026

This PR adds a custom STAC API runtime for MAAP that we need in order to enable the transactions extension (for /collections routes only). The plan is to enable collection transactions for the DPS (User) STAC first so users on the MAAP Console can "reserve" collections in the DPS STAC by posting them to the DPS STAC API (via MAAP API). The assumption is that collection-wise authentication will be managed on the JPL side.

I set it up to store a basic auth username/password (stored in secrets manager) for now but eventually we will move to a more advanced authentication scheme that will work with the MAAP Keycloak.

Here is a view of the protected endpoints in the swagger ui!
image

While I was in here I updated some of our unit testing CI and added a local docker network that we can use to test locally.

@hrodmn hrodmn self-assigned this May 15, 2026
@hrodmn hrodmn requested a review from jjfrench May 15, 2026 20:43
@hrodmn hrodmn marked this pull request as ready for review May 15, 2026 20:43
Comment thread .github/workflows/tests.yml Outdated
)


@lru_cache(maxsize=1)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cache would be caching the values being pulled out of the dict, is that right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. load_secret_dict() caches the parsed JSON secret object keyed by ARN, so we do not hit Secrets Manager on every warm invocation. Then get_basic_auth_credentials() caches the extracted (username, password) tuple on top of that. The intent was to keep auth lookups local after the first read within a Lambda execution environment.

Comment on lines +137 to +138
validate_transaction_auth_config()
return [Depends(require_transaction_auth)]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sometimes meant to do a double validation of the auth config?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was intentional. I wanted one validation when wiring the protected routes so misconfiguration fails early, and another inside the request dependency so the auth guard stays self-contained and fails closed at request time too. The second check is cheap because the credential lookup is cached.

handler = Mangum(
app,
lifespan="off",
text_mime_types=["text/", "application/"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this always meant to be broad? is there a benefit to list specific text/ or application/ types?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more explicit list like application/json, application/geo+json, and the other STAC/OpenAPI response types would be clearer and safer, so I can tighten that up.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just following what we do in eoapi-cdk, so maybe we should consider a tighter list over there too.

@hrodmn hrodmn deployed to synthtest May 27, 2026 20:12 — with GitHub Actions Active
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.

2 participants