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

Java: Add support for java.util.StringJoiner #10533

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

Conversation

pwntester
Copy link
Contributor

No description provided.

@pwntester pwntester requested a review from a team as a code owner Sep 22, 2022
@github-actions github-actions bot added the Java label Sep 22, 2022
@github-actions
Copy link
Contributor

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

java

Generated file changes for java

  • Changes to framework-coverage-java.rst:
-    Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+    Java Standard Library,``java.*``,3,588,130,28,,,7,,,10
-    Totals,,217,8428,1524,129,6,10,107,33,1,86
+    Totals,,217,8431,1524,129,6,10,107,33,1,86
  • Changes to framework-coverage-java.csv:
- java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
+ java.util,44,,464,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,39,425

@atorralba
Copy link
Contributor

Hey @pwntester, thanks for this! I added some more CSV rows for the fluent methods of StringJoiner, tests, and a change note.

@atorralba atorralba changed the title Add support for java.util.StringJoiner Java: Add support for java.util.StringJoiner Sep 22, 2022
@github-actions
Copy link
Contributor

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

java

Generated file changes for java

  • Changes to framework-coverage-java.rst:
-    Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+    Java Standard Library,``java.*``,3,591,130,28,,,7,,,10
-    Totals,,217,8428,1524,129,6,10,107,33,1,86
+    Totals,,217,8434,1524,129,6,10,107,33,1,86
  • Changes to framework-coverage-java.csv:
- java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
+ java.util,44,,467,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,39,428

@github github deleted a comment from github-actions bot Sep 22, 2022
@github-actions
Copy link
Contributor

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

java

Generated file changes for java

  • Changes to framework-coverage-java.rst:
-    Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+    Java Standard Library,``java.*``,3,592,130,28,,,7,,,10
-    Totals,,217,8428,1524,129,6,10,107,33,1,86
+    Totals,,217,8435,1524,129,6,10,107,33,1,86
  • Changes to framework-coverage-java.csv:
- java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
+ java.util,44,,468,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,40,428

Copy link
Contributor

@Marcono1234 Marcono1234 left a comment

Choose a reason for hiding this comment

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

Hopefully these comments are useful.
Feel free to consider them only as suggestions since I am not a project member.

"java.util;StringJoiner;true;merge;;;Argument[0];Argument[-1];taint;manual",
"java.util;StringJoiner;true;merge;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;true;setEmptyValue;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;true;toString;;;Argument[-1];ReturnValue;taint;manual"
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be useful to add a trailing comma to avoid a diff for this line when new lines are added:

Suggested change
"java.util;StringJoiner;true;toString;;;Argument[-1];ReturnValue;taint;manual"
"java.util;StringJoiner;true;toString;;;Argument[-1];ReturnValue;taint;manual",

@@ -64,7 +64,14 @@ private class StringSummaryCsv extends SummaryModelCsv {
"java.lang;StringBuilder;true;StringBuilder;;;Argument[0];Argument[-1];taint;manual",
"java.lang;CharSequence;true;charAt;;;Argument[-1];ReturnValue;taint;manual",
"java.lang;CharSequence;true;subSequence;;;Argument[-1];ReturnValue;taint;manual",
"java.lang;CharSequence;true;toString;;;Argument[-1];ReturnValue;taint;manual"
"java.lang;CharSequence;true;toString;;;Argument[-1];ReturnValue;taint;manual",
"java.util;StringJoiner;true;StringJoiner;;;Argument[0..2];Argument[-1];taint;manual",
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if it matters, but I think these could all be false because StringJoiner is final.

Suggested change
"java.util;StringJoiner;true;StringJoiner;;;Argument[0..2];Argument[-1];taint;manual",
"java.util;StringJoiner;false;StringJoiner;;;Argument[0..2];Argument[-1];taint;manual",

Copy link
Contributor

Choose a reason for hiding this comment

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

@atorralba, not sure if this is relevant, but the tests still have comments with java.util;StringJoiner;true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, it's better that we stay accurate 😄 Fixed, thanks!

"java.util;StringJoiner;true;add;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;true;merge;;;Argument[0];Argument[-1];taint;manual",
"java.util;StringJoiner;true;merge;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;true;setEmptyValue;;;Argument[-1];ReturnValue;value;manual",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should there also be taint from the setEmptyValue argument to the StringJoiner instance?

@github-actions
Copy link
Contributor

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

java

Generated file changes for java

  • Changes to framework-coverage-java.rst:
-    Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+    Java Standard Library,``java.*``,3,593,130,28,,,7,,,10
-    Totals,,217,8428,1524,129,6,10,107,33,1,86
+    Totals,,217,8436,1524,129,6,10,107,33,1,86
  • Changes to framework-coverage-java.csv:
- java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
+ java.util,44,,469,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,41,428

@atorralba
Copy link
Contributor

Thanks @Marcono1234, those are good suggestions. I had doubts about setEmptyValue and that's why I didn't add it in the first place, but even if taint would only get propagated in certain cases (when no other strings are joined) I guess it makes sense to have the model.

Applied in e849acb.

@github-actions
Copy link
Contributor

⚠️ The head of this PR and the base branch were compared for differences in the framework coverage reports. The generated reports are available in the artifacts of this workflow run. The differences will be picked up by the nightly job after the PR gets merged.

Click to show differences in coverage

java

Generated file changes for java

  • Changes to framework-coverage-java.rst:
-    Java Standard Library,``java.*``,3,585,130,28,,,7,,,10
+    Java Standard Library,``java.*``,3,593,130,28,,,7,,,10
-    Totals,,217,8428,1524,129,6,10,107,33,1,86
+    Totals,,217,8436,1524,129,6,10,107,33,1,86
  • Changes to framework-coverage-java.csv:
- java.util,44,,461,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,36,425
+ java.util,44,,469,,,,,,,,,,,34,,,,,,5,2,,1,2,,,,,,,,,,,,,,41,428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants