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

Enforce Array Syntax for Lodash path Parameter #2099

Open
holgerkoser opened this issue Sep 18, 2024 · 0 comments
Open

Enforce Array Syntax for Lodash path Parameter #2099

holgerkoser opened this issue Sep 18, 2024 · 0 comments
Labels
component/dashboard Gardener Dashboard kind/enhancement Enhancement, improvement, extension

Comments

@holgerkoser
Copy link
Member

What would you like to be added:

Lodash's path parameter should always use array syntax. This approach is more secure against injection attacks, reduces the risk of accidental errors, and improves performance as it avoids the unnecessary stringToPath conversion.

Preferred:

const value = get(obj, [key])

Avoid:

const value = get(obj, key)

Why is this needed:

  • Security: Prevents potential injection attacks or errors from dynamically generated string paths.
  • Performance: Using array syntax skips the stringToPath conversion, as detailed in the Lodash source code.

This rule should be enforced across the codebase to maintain consistency and leverage these benefits.

@holgerkoser holgerkoser added kind/enhancement Enhancement, improvement, extension component/dashboard Gardener Dashboard labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/dashboard Gardener Dashboard kind/enhancement Enhancement, improvement, extension
Projects
None yet
Development

No branches or pull requests

1 participant