feat(infisical): add organizationSlug to SecretStore for sub-org support#1
Conversation
Add an optional organizationSlug field to the InfisicalProvider spec so machine identities with access to multiple organizations can target a specific sub-organization during universal auth login. The slug is passed through to the /api/v1/auth/universal-auth/login request body, matching the existing Infisical backend support for the organizationSlug parameter. Co-Authored-By: arsh <arshsb1998@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
| Filename | Overview |
|---|---|
| apis/externalsecrets/v1beta1/secretsstore_infisical_types.go | Adds optional OrganizationSlug string field to InfisicalProvider with correct omitempty JSON tag and kubebuilder marker; backward-compatible |
| pkg/provider/infisical/api/api_models.go | Adds OrganizationSlug to MachineIdentityUniversalAuthLoginRequest with omitempty; omits the field from the JSON body when empty, which is the correct behaviour |
| pkg/provider/infisical/api/api.go | Adds organizationSlug parameter to SetTokenViaMachineIdentity and threads it into the login request; organizationSlug is placed in the JSON body, not the URL, so no SSRF risk is introduced |
| pkg/provider/infisical/provider.go | Reads infisicalSpec.OrganizationSlug and forwards it to SetTokenViaMachineIdentity; correct single call-site, but no test exercises this new propagation path |
Reviews (1): Last reviewed commit: "feat(infisical): add organizationSlug to..." | Re-trigger Greptile
| } | ||
|
|
||
| if err := apiClient.SetTokenViaMachineIdentity(clientID, clientSecret); err != nil { | ||
| if err := apiClient.SetTokenViaMachineIdentity(clientID, clientSecret, infisicalSpec.OrganizationSlug); err != nil { |
There was a problem hiding this comment.
No test coverage for organizationSlug propagation
The existing provider_test.go injects MockInfisicalClient directly (bypassing SetTokenViaMachineIdentity), so there is no test that exercises the new organizationSlug path through NewClient. If a future refactor accidentally drops the slug from the call, the test suite would not catch it. Consider adding an integration-style test or extending MockInfisicalClient.MachineIdentityLoginViaUniversalAuth to capture and assert the OrganizationSlug field.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Problem Statement
When a machine identity has access to multiple organizations (e.g. a root org identity accessing sub-organizations), there is no way to specify which organization to authenticate against in the ESO
SecretStoreconfiguration. This prevents users from using sub-orgs with the External Secrets Operator.Reference: https://external-secrets.io/latest/provider/infisical/
Proposed Changes
Add an optional
organizationSlugfield toInfisicalProviderthat gets passed to the Infisical universal auth login endpoint (/api/v1/auth/universal-auth/login).The Infisical backend already supports
organizationSlugon all machine identity auth endpoints — this change surfaces it in the ESO SecretStore spec.Files changed:
apis/.../secretsstore_infisical_types.go— newOrganizationSlugfield onInfisicalProviderpkg/.../api/api_models.go— addOrganizationSlugto login request structpkg/.../api/api.go— pass slug throughSetTokenViaMachineIdentitypkg/.../provider.go— read slug from spec and forward to authChecklist
git commit --signoffmake testmake reviewableLink to Devin session: https://app.devin.ai/sessions/4892e4b77cc84275ab092612f325b3db
Requested by: @0xArshdeep