Skip to content

Commit d1fcbb6

Browse files
committed
[analyzer] Moving TaintPropagation checker out of alpha
This commit renames alpha.security.taint.TaintPropagation checker to optin.security.taint.TaintPropagation. This checker was stabilized and improved by recent commits thus it's ready for production use. The checker is placed in the optin package as it implements an optional security analysis.
1 parent 10edd5d commit d1fcbb6

25 files changed

+295
-290
lines changed

clang/docs/analyzer/checkers.rst

Lines changed: 248 additions & 244 deletions
Large diffs are not rendered by default.

clang/docs/analyzer/user-docs/TaintAnalysisConfiguration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Taint Analysis Configuration
33
============================
44

55
The Clang Static Analyzer uses taint analysis to detect security-related issues in code.
6-
The backbone of taint analysis in the Clang SA is the `GenericTaintChecker`, which the user can access via the :ref:`alpha-security-taint-TaintPropagation` checker alias and this checker has a default taint-related configuration.
6+
The backbone of taint analysis in the Clang SA is the `GenericTaintChecker`, which the user can access via the :ref:`optin-security-taint-TaintPropagation` checker alias and this checker has a default taint-related configuration.
77
The built-in default settings are defined in code, and they are always in effect once the checker is enabled, either directly or via the alias.
88
The checker also provides a configuration interface for extending the default settings by providing a configuration file in `YAML <http://llvm.org/docs/YamlIO.html#introduction-to-yaml>`_ format.
99
This documentation describes the syntax of the configuration file and gives the informal semantics of the configuration options.
@@ -18,7 +18,7 @@ ________
1818

1919
Taint analysis works by checking for the occurrence of special operations during the symbolic execution of the program.
2020
Taint analysis defines sources, sinks, and propagation rules. It identifies errors by detecting a flow of information that originates from a taint source, reaches a taint sink, and propagates through the program paths via propagation rules.
21-
A source, sink, or an operation that propagates taint is mainly domain-specific knowledge, but there are some built-in defaults provided by :ref:`alpha-security-taint-TaintPropagation`.
21+
A source, sink, or an operation that propagates taint is mainly domain-specific knowledge, but there are some built-in defaults provided by :ref:`optin-security-taint-TaintPropagation`.
2222
It is possible to express that a statement sanitizes tainted values by providing a ``Filters`` section in the external configuration (see :ref:`clangsa-taint-configuration-example` and :ref:`clangsa-taint-filter-details`).
2323
There are no default filters defined in the built-in settings.
2424
The checker's documentation also specifies how to provide a custom taint configuration with command-line options.

clang/include/clang/StaticAnalyzer/Checkers/Checkers.td

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def Performance : Package<"performance">, ParentPackage<OptIn>;
6868

6969
def Security : Package <"security">;
7070
def InsecureAPI : Package<"insecureAPI">, ParentPackage<Security>;
71+
def SecurityOptIn : Package<"security">, ParentPackage<OptIn>;
72+
def Taint : Package<"taint">, ParentPackage<SecurityOptIn>;
7173
def SecurityAlpha : Package<"security">, ParentPackage<Alpha>;
72-
def Taint : Package<"taint">, ParentPackage<SecurityAlpha>;
7374

7475
def CERT : Package<"cert">, ParentPackage<SecurityAlpha>;
7576
def POS : Package<"pos">, ParentPackage<CERT>;
@@ -1050,11 +1051,11 @@ def GenericTaintChecker : Checker<"TaintPropagation">,
10501051
"Config",
10511052
"Specifies the name of the configuration file.",
10521053
"",
1053-
InAlpha>,
1054+
Released>,
10541055
]>,
10551056
Documentation<HasDocumentation>;
10561057

1057-
} // end "alpha.security.taint"
1058+
} // end "optin.security.taint"
10581059

10591060
//===----------------------------------------------------------------------===//
10601061
// Mac OS X, Cocoa, and Core Foundation checkers.

clang/test/Analysis/analyzer-config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// CHECK-NEXT: alpha.osx.cocoa.DirectIvarAssignment:AnnotatedFunctions = false
1212
// CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtExec = 0x04
1313
// CHECK-NEXT: alpha.security.MmapWriteExec:MmapProtRead = 0x01
14-
// CHECK-NEXT: alpha.security.taint.TaintPropagation:Config = ""
1514
// CHECK-NEXT: alpha.unix.Errno:AllowErrnoReadOutsideConditionExpressions = true
1615
// CHECK-NEXT: alpha.unix.StdCLibraryFunctions:DisplayLoadedSummaries = false
1716
// CHECK-NEXT: alpha.unix.StdCLibraryFunctions:ModelPOSIX = false
@@ -112,6 +111,7 @@
112111
// CHECK-NEXT: optin.cplusplus.VirtualCall:ShowFixIts = false
113112
// CHECK-NEXT: optin.osx.cocoa.localizability.NonLocalizedStringChecker:AggressiveReport = false
114113
// CHECK-NEXT: optin.performance.Padding:AllowedPad = 24
114+
// CHECK-NEXT: optin.security.taint.TaintPropagation:Config = ""
115115
// CHECK-NEXT: osx.NumberObjectConversion:Pedantic = false
116116
// CHECK-NEXT: osx.cocoa.RetainCount:TrackNSCFStartParam = false
117117
// CHECK-NEXT: prune-paths = true

clang/test/Analysis/assume-controlled-environment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// RUN: %clang_analyze_cc1 -verify=untrusted-env %s \
22
// RUN: -analyzer-checker=core \
3-
// RUN: -analyzer-checker=alpha.security.taint \
3+
// RUN: -analyzer-checker=optin.security.taint \
44
// RUN: -analyzer-checker=debug.TaintTest
55

66
// RUN: %clang_analyze_cc1 -verify %s -DEXPECT_NO_WARNINGS \
77
// RUN: -analyzer-config assume-controlled-environment=true \
88
// RUN: -analyzer-checker=core \
9-
// RUN: -analyzer-checker=alpha.security.taint \
9+
// RUN: -analyzer-checker=optin.security.taint \
1010
// RUN: -analyzer-checker=debug.TaintTest
1111

1212

clang/test/Analysis/bool-assignment.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.BoolAssignment,alpha.security.taint -verify -std=c99 -Dbool=_Bool %s
2-
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.BoolAssignment,alpha.security.taint -verify -x c++ %s
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.BoolAssignment,optin.security.taint -verify -std=c99 -Dbool=_Bool %s
2+
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core.BoolAssignment,optin.security.taint -verify -x c++ %s
33

44
// Test C++'s bool and C's _Bool.
55
// FIXME: We stopped warning on these when SValBuilder got smarter about

clang/test/Analysis/cxx-method-names.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,osx,alpha.unix,alpha.security.taint -verify %s
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,osx,alpha.unix,optin.security.taint -verify %s
22
// expected-no-diagnostics
33

44
class Evil {

clang/test/Analysis/debug-exprinspection-istainted.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %clang_analyze_cc1 -verify %s \
22
// RUN: -analyzer-checker=core \
33
// RUN: -analyzer-checker=debug.ExprInspection \
4-
// RUN: -analyzer-checker=alpha.security.taint
4+
// RUN: -analyzer-checker=optin.security.taint
55

66
int scanf(const char *restrict format, ...);
77
void clang_analyzer_isTainted(char);

clang/test/Analysis/diagnostics/sarif-diagnostics-taint-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=optin.security.taint,debug.TaintTest %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-diagnostics-taint-test.c.sarif -
22
#include "../Inputs/system-header-simulator.h"
33

44
int atoi(const char *nptr);

clang/test/Analysis/diagnostics/sarif-multi-diagnostic-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.security.taint,debug.TaintTest,unix.Malloc %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif -
1+
// RUN: %clang_analyze_cc1 -analyzer-checker=core,optin.security.taint,debug.TaintTest,unix.Malloc %s -verify -analyzer-output=sarif -o - | %normalize_sarif | diff -U1 -b %S/Inputs/expected-sarif/sarif-multi-diagnostic-test.c.sarif -
22
#include "../Inputs/system-header-simulator.h"
33
#include "../Inputs/system-header-simulator-for-malloc.h"
44
#define ERR -1

0 commit comments

Comments
 (0)