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: add tag filtering to external JWT authentication #4425

Merged
merged 4 commits into from
Sep 25, 2024

Conversation

HugoCasa
Copy link
Contributor

@HugoCasa HugoCasa commented Sep 23, 2024

Important

Add tag filtering for JWT authentication by modifying scope handling and SQL queries in the backend.

  • Behavior:
    • Add tag filtering for JWT authentication in windmill-api/src/jobs.rs and windmill-api/src/users.rs.
    • Modify check_scopes to handle jobs: and run: scope prefixes.
    • Introduce get_scope_tags to extract tags from JWT scopes.
  • JWT Claims:
    • Add scopes field to JWTAuthClaims in auth.rs.
  • SQL Queries:
    • Update SQL queries in list_queue_jobs_query and list_completed_jobs_query to filter by tags.
  • Misc:
    • Update ee-repo-ref.txt to new commit hash.

This description was created by Ellipsis for 20e2c24. It will automatically update as commits are pushed.

Copy link

cloudflare-workers-and-pages bot commented Sep 23, 2024

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 20e2c24
Status: ✅  Deploy successful!
Preview URL: https://05a394cf.windmill.pages.dev
Branch Preview URL: https://hugo-win-373-tag-filtering-j.windmill.pages.dev

View logs

@HugoCasa HugoCasa marked this pull request as ready for review September 24, 2024 09:35
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 20e2c24 in 31 seconds

More details
  • Looked at 263 lines of code in 6 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. backend/windmill-api/src/users.rs:705
  • Draft comment:
    Ensure that tags is not empty after splitting, to avoid unexpected behavior if tags are expected to be non-empty.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The get_scope_tags function is used to extract tags from the scopes of an ApiAuthed object. However, the function is not handling the case where the tags variable is empty after splitting. This could lead to unexpected behavior if the tags are expected to be non-empty.
2. backend/windmill-api/src/users.rs:693
  • Draft comment:
    Ensure that the scopes vector is not empty before checking for the required scope, to avoid unexpected behavior if scopes are expected to be non-empty.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The check_scopes function is used to verify if the required scope is present in the ApiAuthed object. However, the function does not handle the case where the scopes vector is empty. This could lead to unexpected behavior if the scopes are expected to be non-empty.
3. backend/windmill-worker/src/worker.rs:198
  • Draft comment:
    Consider if scopes should be set to a value other than None in JWTAuthClaims if scopes are needed for the token.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The create_token_for_owner function in worker.rs sets the scopes field of JWTAuthClaims to None. This might be intentional, but if scopes are needed for the token, this should be revisited.

Workflow ID: wflow_6X7EM4mmMmfeNJsg


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@HugoCasa HugoCasa changed the title feat: tag filtering jwt ext auth feat: add tag filtering to external JWT authentication Sep 24, 2024
@rubenfiszel rubenfiszel merged commit 590321f into main Sep 25, 2024
3 checks passed
@rubenfiszel rubenfiszel deleted the hugo/win-373-tag-filtering-jwt-ext-auth branch September 25, 2024 09:21
@github-actions github-actions bot locked and limited conversation to collaborators Sep 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants