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

[STAL-2713] Handle taint propagation in Java for-each loop statement. #531

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

jasonforal
Copy link
Collaborator

This is a commit from early September that was unintentionally omitted when slicing the larger taint analysis implementation into smaller PRs.


What problem are you trying to solve?

Taint isn't propagated between the "item" and "array" of a for-each loop statement:

void method() {
    String[] strings = {\"a\", \"b\", \"c\"};
    String query = \"\";
    for (String s: strings) {
        // `strings` taints `s`, which then taints `query`,
        query += s;
    }
    System.out.println(query);
}
image

What is your solution?

Add handler for enhanced_for_statement CST nodes.
image

Alternatives considered

What the reviewer should know

@jasonforal jasonforal requested a review from juli1 October 21, 2024 17:15
@jasonforal jasonforal requested a review from a team as a code owner October 21, 2024 17:15
@jasonforal jasonforal merged commit a32c63d into main Oct 24, 2024
70 checks passed
@jasonforal jasonforal deleted the jf/STAL-2713 branch October 24, 2024 14:47
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