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

[Authz] Eslint Rule for Security Config #193187

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

elena-shostak
Copy link
Contributor

@elena-shostak elena-shostak commented Sep 17, 2024

Summary

ESLint rule is introduced to enforce the migration of access tags in route configurations to the security.authz.requiredPrivileges field. It ensures that security configurations are correctly applied in both standard and versioned routes. Will be enabled after #191973 is merged.

The rule covers:

  • Access Tag Migration. Moves access:<privilege> tags from the options.tags property to security.authz.requiredPrivileges. Preserves any non-access tags in the tags property.

  • Missing Security Config Detection. Reports an error if no security config is found in the route or version.
    Suggests adding a default security configuration authz: { enabled: false }.

Note

There is an indentation issues with the test, dedent doesn't solve most of the issues and since RuleTester was designed to test a single rule at a time,I couldn't enable multiple fixes (including indent ones) before checking output.
Manually adjusted the indentation.

Checklist

Fixes: #191715
Related: #191710

@elena-shostak elena-shostak added Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! release_note:skip Skip the PR/issue when compiling release notes labels Sep 19, 2024
@elena-shostak elena-shostak requested a review from a team September 19, 2024 10:43
@elena-shostak elena-shostak changed the title 191715 eslint security config [Authz] Eslint Rule for Security Config Sep 19, 2024
@elena-shostak elena-shostak added Feature:Security/Authorization Platform Security - Authorization enhancement New value added to drive a business result labels Sep 19, 2024
@elena-shostak
Copy link
Contributor Author

@elasticmachine merge upstream

@elena-shostak
Copy link
Contributor Author

/ci

@elena-shostak
Copy link
Contributor Author

@elasticmachine merge upstream

@elena-shostak
Copy link
Contributor Author

/ci

@elena-shostak elena-shostak marked this pull request as ready for review September 23, 2024 10:46
@elena-shostak elena-shostak requested a review from a team as a code owner September 23, 2024 10:46
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@elena-shostak elena-shostak added the backport:skip This commit does not require backporting label Sep 23, 2024
@kc13greiner kc13greiner self-requested a review September 23, 2024 12:06
@elena-shostak
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting enhancement New value added to drive a business result Feature:Security/Authorization Platform Security - Authorization release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement ESLint Check for Route Authorization Configuration
6 participants