Skip to content

Commit 0d2f8f3

Browse files
committed
Merge branch 'master' into ir-this-parameter-2
2 parents f7752b0 + d4e1ee8 commit 0d2f8f3

File tree

135 files changed

+3466
-439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+3466
-439
lines changed

change-notes/1.25/analysis-javascript.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
* TypeScript 3.9 is now supported.
2525

26+
* The analysis of sanitizers has improved, leading to more accurate
27+
results from the security queries.
28+
2629
## New queries
2730

2831
| **Query** | **Tags** | **Purpose** |
@@ -36,15 +39,14 @@
3639

3740
| **Query** | **Expected impact** | **Change** |
3841
|--------------------------------|------------------------------|---------------------------------------------------------------------------|
39-
| Client-side cross-site scripting (`js/xss`) | Fewer results | This query no longer flags optionally sanitized values. |
40-
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Fewer results | This query now recognizes additional safe patterns of doing URL redirects. |
4142
| Client-side cross-site scripting (`js/xss`) | Fewer results | This query now recognizes additional safe patterns of constructing HTML. |
43+
| Client-side URL redirect (`js/client-side-unvalidated-url-redirection`) | Fewer results | This query now recognizes additional safe patterns of doing URL redirects. |
4244
| Code injection (`js/code-injection`) | More results | More potential vulnerabilities involving NoSQL code operators are now recognized. |
4345
| Expression has no effect (`js/useless-expression`) | Fewer results | This query no longer flags an expression when that expression is the only content of the containing file. |
46+
| Hard-coded credentials (`js/hardcoded-credentials`) | More results | This query now recognizes hard-coded credentials sent via HTTP authorization headers. |
4447
| Incomplete URL scheme check (`js/incomplete-url-scheme-check`) | More results | This query now recognizes additional url scheme checks. |
4548
| Misspelled variable name (`js/misspelled-variable-name`) | Message changed | The message for this query now correctly identifies the misspelled variable in additional cases. |
4649
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | More results | This query now recognizes additional utility functions as vulnerable to prototype polution. |
47-
| Prototype pollution in utility function (`js/prototype-pollution-utility`) | More results | This query now recognizes more coding patterns that are vulnerable to prototype pollution. |
4850
| Uncontrolled command line (`js/command-line-injection`) | More results | This query now recognizes additional command execution calls. |
4951
| Uncontrolled data used in path expression (`js/path-injection`) | More results | This query now recognizes additional file system calls. |
5052
| Unknown directive (`js/unknown-directive`) | Fewer results | This query no longer flags directives generated by the Babel compiler. |

change-notes/1.25/analysis-python.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Improvements to Python analysis
2+
3+
The following changes in version 1.25 affect Python analysis in all applications.
4+
5+
## General improvements
6+
7+
8+
## New queries
9+
10+
| **Query** | **Tags** | **Purpose** |
11+
|-----------------------------|-----------|--------------------------------------------------------------------|
12+
13+
14+
## Changes to existing queries
15+
16+
| **Query** | **Expected impact** | **Change** |
17+
|----------------------------|------------------------|------------------------------------------------------------------|
18+
19+
20+
## Changes to libraries
21+
22+
* Importing `semmle.python.web.HttpRequest` will no longer import `UntrustedStringKind` transitively. `UntrustedStringKind` is the most commonly used non-abstract subclass of `ExternalStringKind`. If not imported (by one mean or another), taint-tracking queries that concern `ExternalStringKind` will not produce any results. Please ensure such queries contain an explicit import (`import semmle.python.security.strings.Untrusted`).

config/sync-files.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,41 @@ def file_checksum(filename):
5959
return hashlib.sha1(file_handle.read()).hexdigest()
6060

6161
def check_group(group_name, files, master_file_picker, emit_error):
62-
checksums = {file_checksum(f) for f in files}
62+
extant_files = [f for f in files if path.isfile(f)]
63+
if len(extant_files) == 0:
64+
emit_error(__file__, 0, "No files found from group '" + group_name + "'.")
65+
emit_error(__file__, 0,
66+
"Create one of the following files, and then run this script with "
67+
"the --latest switch to sync it to the other file locations.")
68+
for filename in files:
69+
emit_error(__file__, 0, " " + filename)
70+
return
71+
72+
checksums = {file_checksum(f) for f in extant_files}
6373

64-
if len(checksums) == 1:
74+
if len(checksums) == 1 and len(extant_files) == len(files):
75+
# All files are present and identical.
6576
return
6677

67-
master_file = master_file_picker(files)
78+
master_file = master_file_picker(extant_files)
6879
if master_file is None:
6980
emit_error(__file__, 0,
7081
"Files from group '"+ group_name +"' not in sync.")
7182
emit_error(__file__, 0,
7283
"Run this script with a file-name argument among the "
7384
"following to overwrite the remaining files with the contents "
74-
"of that file or run with the --latest switch to update each "
85+
"of that file, or run with the --latest switch to update each "
7586
"group of files from the most recently modified file in the group.")
76-
for filename in files:
87+
for filename in extant_files:
7788
emit_error(__file__, 0, " " + filename)
7889
else:
7990
print(" Syncing others from", master_file)
8091
for filename in files:
8192
if filename == master_file:
8293
continue
8394
print(" " + filename)
84-
os.replace(filename, filename + '~')
95+
if path.isfile(filename):
96+
os.replace(filename, filename + '~')
8597
shutil.copy(master_file, filename)
8698
print(" Backups written with '~' appended to file names")
8799

cpp/ql/src/semmle/code/cpp/AutogeneratedFile.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides a class and predicate for recognizing files that are likely to have been generated
3+
* automatically.
4+
*/
5+
16
import semmle.code.cpp.Comments
27
import semmle.code.cpp.File
38
import semmle.code.cpp.Preprocessor

cpp/ql/src/semmle/code/cpp/Class.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing C++ classes, including structs, unions, and template classes.
3+
*/
4+
15
import semmle.code.cpp.Type
26
import semmle.code.cpp.UserType
37
import semmle.code.cpp.metrics.MetricClass

cpp/ql/src/semmle/code/cpp/Comments.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing C and C++ comments.
3+
*/
4+
15
import semmle.code.cpp.Location
26
import semmle.code.cpp.Element
37

cpp/ql/src/semmle/code/cpp/Compilation.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides a class representing individual compiler invocations that occurred during the build.
3+
*/
4+
15
import semmle.code.cpp.File
26

37
/*

cpp/ql/src/semmle/code/cpp/Declaration.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes for working with C and C++ declarations.
3+
*/
4+
15
import semmle.code.cpp.Element
26
import semmle.code.cpp.Specifier
37
import semmle.code.cpp.Namespace

cpp/ql/src/semmle/code/cpp/Diagnostics.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
/**
2+
* Provides classes representing warnings generated during compilation.
3+
*/
4+
15
import semmle.code.cpp.Location
26

37
/** A compiler-generated error, warning or remark. */

cpp/ql/src/semmle/code/cpp/Element.qll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Provides the `Element` class, which is the base class for all classes representing C or C++
3+
* program elements.
4+
*/
5+
16
import semmle.code.cpp.Location
27
private import semmle.code.cpp.Enclosing
38
private import semmle.code.cpp.internal.ResolveClass
@@ -261,8 +266,14 @@ private predicate isFromUninstantiatedTemplateRec(Element e, Element template) {
261266
class StaticAssert extends Locatable, @static_assert {
262267
override string toString() { result = "static_assert(..., \"" + getMessage() + "\")" }
263268

269+
/**
270+
* Gets the expression which this static assertion ensures is true.
271+
*/
264272
Expr getCondition() { static_asserts(underlyingElement(this), unresolveElement(result), _, _) }
265273

274+
/**
275+
* Gets the message which will be reported by the compiler if this static assertion fails.
276+
*/
266277
string getMessage() { static_asserts(underlyingElement(this), _, result, _) }
267278

268279
override Location getLocation() { static_asserts(underlyingElement(this), _, _, result) }

0 commit comments

Comments
 (0)