Secret Manager `list_secrets` silently returns empty when both `organization_id` and `project_id` are set
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
Research direction
Start at SecretV1Beta1API.list_secrets and list_secrets_all, then trace how Client injects default_organization_id into requests. Reproduce the project-scoped listing with request logging and compare behavior when the organization ID is omitted; done means the intended handling of both scope parameters is implemented or clearly documented and covered by a regression test.
Written by the indexing model from the issue text.
Description
Description
SecretV1Beta1API.list_secrets (and list_secrets_all) returns an empty result set with HTTP 200 — no error — when the request includes both organization_id and project_id, even though matching secrets exist and the same request without organization_id returns them correctly.
The Client auto-fills default_organization_id from the profile/config on every request. Since list_secrets also accepts an explicit project_id (or falls back to default_project_id), nearly every call ends up sending both parameters — silently breaking listing for anyone who authenticates via a project-scoped API key (created for a single Project, not the whole Organization), which is a documented/recommended way to scope credentials.
Reproduction
from scaleway import Client
from scaleway.secret.v1beta1 import SecretV1Beta1API
client = Client.from_config_file_and_env() # picks up default_organization_id + default_project_id
api = SecretV1Beta1API(client)
r = api.list_secrets(scheduled_for_deletion=False, project_id=client.default_project_id)
print(r.total_count) # -> 0
Enabling request logging shows the outgoing request includes both IDs:
GET https://api.scaleway.com/secret-manager/v1beta1/regions/fr-par/secrets?organization_id=<ORG_ID>&project_id=<PROJECT_ID>&scheduled_for_deletion=False
Calling the same endpoint directly with curl, omitting organization_id, returns the expected secrets:
curl -H "X-Auth-Token: $SCW_SECRET_KEY"
"https://api.scaleway.com/secret-manager/v1beta1/regions/fr-par/secrets?project_id=<PROJECT_ID>&scheduled_for_deletion=false"
# -> {"secrets": [...], "total_count": 9}
Re-adding organization_id to that same curl request reproduces the empty result:
curl -H "X-Auth-Token: $SCW_SECRET_KEY"
"https://api.scaleway.com/secret-manager/v1beta1/regions/fr-par/secrets?organization_id=<ORG_ID>&project_id=<PROJECT_ID>&scheduled_for_deletion=false"
# -> {"secrets": [], "total_count": 0}
So this looks like API-side behavior (the two filters may be ANDed against an internal scope in a way that a project-scoped key can't satisfy when organization_id is present), but the SDK makes it very easy to hit unknowingly, since organization_id is injected automatically and silently, with no error/warning that the combination yields zero rows.
Environment
scalewaySDK version: 2.11.0- Python: 3.12
- Auth: project-scoped API key (via
scwconfig file /SCW_ACCESS_KEY+SCW_SECRET_KEY)
Expected behavior
Either:
- The SDK should not auto-send
organization_idwhen an explicit (or default)project_idis already being used for a request, or - The API should return an explicit error (e.g. 403) instead of an empty 200 when the org/project combination can't be satisfied, or
- This should be documented so it's discoverable without reverse-engineering.
Workaround
Explicitly clear client.default_organization_id = None before calling list_secrets/list_secrets_all when authenticating with a project-scoped key.
- Dominant language
- Python
- Stars
- 37
- Forks
- 16
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 57
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.
More from scaleway/scaleway-sdk-python
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
scaleway/scaleway-sdk-python#2131 ·
-
agent enhancement
scaleway/scaleway-sdk-python#1954 · 1 assignee ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 52/100
scaleway/scaleway-sdk-python#1673 ·
-
bug
scaleway/scaleway-sdk-python#1309 · 1 reaction · 1 assignee ·
-
scaleway/scaleway-sdk-python#1139 · 1 assignee ·
All issues in scaleway/scaleway-sdk-python
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100