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(java): add EL injection rule (CWE-917) #200

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

elsapet
Copy link
Collaborator

@elsapet elsapet commented Jan 29, 2024

Description

Add Java rule to check for EL injection

Relates to #197

Checklist

  • I've added a snapshot that shows my rule works as expected.
  • My rule has adequate metadata to explain its use.
  • PR title follows Conventional Commits format

Comment on lines +26 to +35
- id: java_lang_expression_language_injection_string_method_arg
patterns:
- pattern: |
class $<...>$<_> $<...>{
$<...>$<_> $<_>($<...>$<JAVA_SHARED_LANG_INSTANCE_TYPE> $<JAVA_SHARED_LANG_INSTANCE_VARIABLE>$<...>)$<...>{}
}
focus: JAVA_SHARED_LANG_INSTANCE_VARIABLE
filters:
- variable: JAVA_SHARED_LANG_INSTANCE_TYPE
regex: \A(java\.lang\.)?String\z
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We don't use java_shared_lang_instance here because we only want String instances that are method arguments

@elsapet elsapet requested a review from cfabianski January 29, 2024 12:43
@elsapet elsapet merged commit 8156e6c into main Jan 29, 2024
19 checks passed
@elsapet elsapet deleted the feat/java/add-expression-language-injection-rule branch January 29, 2024 13:19
@elsapet elsapet changed the title feat(java): add EL injection rule feat(java): add EL injection rule (CWE-917) Feb 2, 2024
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.

2 participants