Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support subject validation when using OIDC AuthN mode #1784

Merged
merged 12 commits into from
Jul 29, 2024

Conversation

Code2Life
Copy link
Contributor

Support subject validation when using OIDC AuthN mode, using OPENFGA_AUTHN_OIDC_SUBJECTS env variable or authn-oidc-subjects config.

Description

User story:
As a platform owner, I wanna limit which services could call OpenFGA, so that to avoid unexpected model or relations modifications by none eligible services.

For example, in a Kubernetes cluster, even if Kubernetes's OIDC configured as AuthN approach, any pod using any service account could call OpenFGA. It introduces security risks because no limits of subjects, namely service account.

With subjects limit feature added, platform owner could restrict services authenticated by Kuberenetes or other OIDC providers. For instance, in Kubernetes, the flag/env-var could be configured like this: "system:serviceaccount:{allowed-namespace}:{allowed-kubernetes-service-account}"

References

Review Checklist

  • [√] I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • [√] The correct base branch is being used, if not main
  • [√] I have added tests to validate that the change in functionality is working as expected

@Code2Life Code2Life requested a review from a team as a code owner July 23, 2024 01:06
Copy link

codecov bot commented Jul 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.63%. Comparing base (2d16175) to head (af5caaa).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1784      +/-   ##
==========================================
- Coverage   87.63%   87.63%   -0.00%     
==========================================
  Files         101      101              
  Lines        9812     9824      +12     
==========================================
+ Hits         8598     8608      +10     
  Misses        857      857              
- Partials      357      359       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

adriantam
adriantam previously approved these changes Jul 23, 2024
Co-authored-by: Maria Ines Parnisari <[email protected]>
@Code2Life
Copy link
Contributor Author

Hi @miparnisari Thanks for your detailed code review, all suggestions applied

@aaguiarz
Copy link
Member

@miparnisari @Code2Life please update the docs here after this is merged https://openfga.dev/docs/getting-started/setup-openfga/configure-openfga#oidc

@miparnisari
Copy link
Contributor

openfga/openfga.dev#798

@adriantam adriantam merged commit 0f960ed into openfga:main Jul 29, 2024
13 of 15 checks passed
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.

4 participants