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

Update github/codeql-action requirement to main #29

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ql-for-ql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v3
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
- name: Get CodeQL version
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
env:
CONF: ./ql-for-ql-config.yml
- name: Initialize CodeQL
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@main
with:
languages: ql
db-location: ${{ runner.temp }}/db
Expand All @@ -145,7 +145,7 @@ jobs:
PACK: ${{ runner.temp }}/pack

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/analyze@main
with:
category: "ql-for-ql"
- name: Copy sarif file to CWD
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ql-for-ql-dataset_measure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
- uses: actions/cache@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ql-for-ql-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v3
- name: Find codeql
id: find-codeql
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
uses: github/codeql-action/init@main
with:
languages: javascript # does not matter
- uses: actions/cache@v3
Expand Down
4 changes: 4 additions & 0 deletions java/ql/lib/change-notes/2022-09-22-stringjoiner-summaries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* Added new flow steps for `java.util.StringJoiner`.
10 changes: 9 additions & 1 deletion java/ql/lib/semmle/code/java/frameworks/Strings.qll
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,15 @@ 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;false;StringJoiner;;;Argument[0..2];Argument[-1];taint;manual",
"java.util;StringJoiner;false;add;;;Argument[0];Argument[-1];taint;manual",
"java.util;StringJoiner;false;add;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;false;merge;;;Argument[0];Argument[-1];taint;manual",
"java.util;StringJoiner;false;merge;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;false;setEmptyValue;;;Argument[0];Argument[-1];taint;manual",
"java.util;StringJoiner;false;setEmptyValue;;;Argument[-1];ReturnValue;value;manual",
"java.util;StringJoiner;false;toString;;;Argument[-1];ReturnValue;taint;manual",
]
}
}
92 changes: 92 additions & 0 deletions java/ql/test/library-tests/dataflow/taint/StringJoinerTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import java.util.StringJoiner;

public class StringJoinerTests {

Object taint() {
return null;
}

void sink(Object o) {}

public void test() throws Exception {
{
// "java.util;StringJoiner;false;StringJoiner;(CharSequence);;Argument[0];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out = new StringJoiner(in);
sink(out);
}
{
// "java.util;StringJoiner;false;StringJoiner;(CharSequence,CharSequence,CharSequence);;Argument[0];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out = new StringJoiner(in, null, null);
sink(out);
}
{
// "java.util;StringJoiner;false;StringJoiner;(CharSequence,CharSequence,CharSequence);;Argument[1];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out = new StringJoiner(null, in, null);
sink(out);
}
{
// "java.util;StringJoiner;false;StringJoiner;(CharSequence,CharSequence,CharSequence);;Argument[2];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out = new StringJoiner(null, null, in);
sink(out);
}
{
// "java.util;StringJoiner;false;add;;;Argument[-1];ReturnValue;value;manual"
StringJoiner out = null;
StringJoiner in = (StringJoiner) taint();
out = in.add(null);
sink(out);
}
{
// "java.util;StringJoiner;false;add;;;Argument[0];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out.add(in);
sink(out);
}
{
// "java.util;StringJoiner;false;merge;;;Argument[-1];ReturnValue;value;manual"
StringJoiner out = null;
StringJoiner in = (StringJoiner) taint();
out = in.merge(null);
sink(out);
}
{
// "java.util;StringJoiner;false;merge;;;Argument[0];Argument[-1];taint;manual"
StringJoiner out = null;
StringJoiner in = (StringJoiner) taint();
out.merge(in);
sink(out);
}
{
// "java.util;StringJoiner;false;setEmptyValue;;;Argument[-1];ReturnValue;taint;manual"
StringJoiner out = null;
StringJoiner in = (StringJoiner) taint();
out = in.setEmptyValue(null);
sink(out);
}
{
// "java.util;StringJoiner;false;setEmptyValue;;;Argument[0];Argument[-1];taint;manual"
StringJoiner out = null;
CharSequence in = (CharSequence) taint();
out.setEmptyValue(in);
sink(out);
}
{
// "java.util;StringJoiner;false;toString;;;Argument[-1];ReturnValue;taint;manual"
String out = null;
StringJoiner in = (StringJoiner) taint();
out = in.toString();
sink(out);
}

}

}
11 changes: 11 additions & 0 deletions java/ql/test/library-tests/dataflow/taint/test.expected
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@
| StringBuilderTests.java:70:15:70:21 | taint(...) | StringBuilderTests.java:73:10:73:26 | new String(...) |
| StringBuilderTests.java:79:15:79:21 | taint(...) | StringBuilderTests.java:80:10:80:40 | toString(...) |
| StringBuilderTests.java:86:15:86:21 | taint(...) | StringBuilderTests.java:87:10:87:27 | substring(...) |
| StringJoinerTests.java:15:37:15:43 | taint(...) | StringJoinerTests.java:17:9:17:11 | out |
| StringJoinerTests.java:22:37:22:43 | taint(...) | StringJoinerTests.java:24:9:24:11 | out |
| StringJoinerTests.java:29:37:29:43 | taint(...) | StringJoinerTests.java:31:9:31:11 | out |
| StringJoinerTests.java:36:37:36:43 | taint(...) | StringJoinerTests.java:38:9:38:11 | out |
| StringJoinerTests.java:43:37:43:43 | taint(...) | StringJoinerTests.java:45:9:45:11 | out |
| StringJoinerTests.java:50:37:50:43 | taint(...) | StringJoinerTests.java:52:9:52:11 | out |
| StringJoinerTests.java:57:37:57:43 | taint(...) | StringJoinerTests.java:59:9:59:11 | out |
| StringJoinerTests.java:64:37:64:43 | taint(...) | StringJoinerTests.java:66:9:66:11 | out |
| StringJoinerTests.java:71:37:71:43 | taint(...) | StringJoinerTests.java:73:9:73:11 | out |
| StringJoinerTests.java:78:37:78:43 | taint(...) | StringJoinerTests.java:80:9:80:11 | out |
| StringJoinerTests.java:85:37:85:43 | taint(...) | StringJoinerTests.java:87:9:87:11 | out |
| Varargs.java:7:8:7:14 | taint(...) | Varargs.java:14:10:14:10 | s |
| Varargs.java:8:8:8:14 | taint(...) | Varargs.java:19:10:19:10 | s |
| Varargs.java:8:17:8:23 | taint(...) | Varargs.java:19:10:19:10 | s |
Expand Down