Repository navigation
Conversation
There was a problem hiding this comment.
馃煛 Changes recommended
Credential-name collisions and incomplete failure recovery can disrupt other deployments or leave active keys behind.
4 open issues
What changed in this PR
Replaces developer credentials in Flash worker templates with per-app keys stored as RunPod secrets.
Changes:
- Adds credential creation, reuse, and deletion for deployed environments and dev sessions.
- Injects secret references while preserving explicit resource credentials.
- Moves secret operations to REST and adds credential tests.
| File | Description |
|---|---|
| tests/鈥媡est_apps/鈥媡est_worker_credentials.py | Tests credential lifecycle and worker authentication. |
| tests/鈥媡est_apps/鈥媡est_dev.py | Verifies developer keys are not forwarded. |
| tests/鈥媡est_apps/鈥媡est_api_client.py | Tests REST secret operations. |
| runpod/鈥媋pps/鈥媘anage.py | Adds credential cleanup during deletion. |
| runpod/鈥媋pps/鈥媎ev.py | Supplies dev workers with secret references. |
| runpod/鈥媋pps/鈥媎eploy.py | Supplies deployed workers with secret references. |
| runpod/鈥媋pps/鈥媋pp_key.py | Implements credential naming and lifecycle. |
| runpod/鈥媋pps/鈥媋pi.py | Adds key operations and REST secret access. |
| runpod/鈥媋pi/鈥媞ueries/鈥媋pps.py | Adds API-key listing query. |
| runpod/鈥媋pi/鈥媘utations/鈥媋pps.py | Adds key creation and revocation mutations. |
Review effort: Balanced
| # (serverless:read), launch and terminate task pods (pods), resolve | ||
| # task mounts (volumes), and resolve registry credentials and secret | ||
| # references for task pods (secrets:read) | ||
| APP_KEY_SCOPES = [ |
There was a problem hiding this comment.
Previously workers ran on the deployer's own key. Now createApiKeyNew needs the caller to hold API key create permission, and the backend rejects any requested scope outside the caller's grantable set (scoped calling key or restricted org role) with "Scope(s) not grantable by the caller". A user deploying with a scoped key that lacks, for example, volumes:write or authentication:write would now fail every deploy that previously worked. Is that intended, and should the error tell them to set RUNPOD_API_KEY in the resource env instead?
Separately, have these six scopes been exercised end to end from a worker: deployCpuPod / podFindAndDeployOnDemand for task pods, GET /v2/registries for registry auth, DELETE /v2/pods/{id}, volume create, and endpoint resolution plus invocation through the sentinel? The unit tests mock the API, so a missing scope would only show up as a 401/403 inside a worker.

Workers authenticate with a key minted for their app environment (or for the app's dev sessions), never with the developer's own key. The key is stored as a RunPod secret named
flash-app-key.<app>.<env>(flash-dev-key.<app>for dev) and every endpoint template references it as{{ RUNPOD_SECRET_... }}, so the platform decrypts it at boot and the value never lands in a template, an env payload, or a log. A resource that sets its ownRUNPOD_API_KEYin env keeps it.The key is minted on the first deploy that needs it and reused after that. Its scopes cover what flash runtime does from a worker: calling and listing endpoints, launching and terminating task pods, resolving volumes, and resolving registry credentials and secrets for task pods. Deleting an environment or an app revokes its key and deletes the secret.
Secrets go through the v2 REST routes. API keys stay on GraphQL because REST has no key routes.