Merge branch 'main' into atorralba/promote-mvel-injection

This commit is contained in:
Tony Torralba
2021-06-16 15:44:43 +02:00
committed by GitHub
800 changed files with 15540 additions and 6277 deletions

View File

@@ -1,5 +1,6 @@
{ "provide": [ "*/ql/src/qlpack.yml",
"*/ql/test/qlpack.yml",
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
"*/ql/examples/qlpack.yml",
"*/upgrades/qlpack.yml",
"misc/legacy-support/*/qlpack.yml",

View File

@@ -70,8 +70,8 @@ jobs:
with:
name: rst-flow-model-coverage
path: flow-model-coverage-*.rst
- name: Check coverage files
if: github.event.pull_request
run: |
python script/misc/scripts/library-coverage/compare-files.py codeqlModels
# - name: Check coverage files
# if: github.event.pull_request
# run: |
# python script/misc/scripts/library-coverage/compare-files.py codeqlModels

View File

@@ -0,0 +1,4 @@
lgtm,codescanning
* Added definitions for types found in `cstdint`. Added types `FixedWidthIntegralType`, `MinimumWidthIntegralType`, `FastestMinimumWidthIntegralType`, and `MaximumWidthIntegralType` to describe types such as `int8_t`, `int_least8_t`, `int_fast8_t`, and `intmax_t` respectively.
* Changed definition of `Intmax_t` and `Uintmax_t` to be part of the new type structure.
* Added a type `FixedWidthEnumType` which describes enums based on a fixed-width integer type. For instance, `enum e: uint8_t = { a, b };`.

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/offset-use-before-range-check
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @tags reliability
* security

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/descriptor-may-not-be-closed
* @problem.severity warning
* @security-severity 5.9
* @tags efficiency
* security
* external/cwe/cwe-775

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/descriptor-never-closed
* @problem.severity warning
* @security-severity 5.9
* @tags efficiency
* security
* external/cwe/cwe-775

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/file-may-not-be-closed
* @problem.severity warning
* @security-severity 5.9
* @tags efficiency
* security
* external/cwe/cwe-775

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/file-never-closed
* @problem.severity warning
* @security-severity 5.9
* @tags efficiency
* security
* external/cwe/cwe-775

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/global-use-before-init
* @problem.severity warning
* @security-severity 6.9
* @tags reliability
* security
* external/cwe/cwe-457

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/inconsistent-nullness-testing
* @problem.severity warning
* @security-severity 3.6
* @tags reliability
* security
* external/cwe/cwe-476

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/initialization-not-run
* @problem.severity warning
* @security-severity 6.4
* @tags reliability
* security
* external/cwe/cwe-456

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/late-negative-test
* @problem.severity warning
* @security-severity 10.0
* @tags reliability
* security
* external/cwe/cwe-823

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/memory-may-not-be-freed
* @problem.severity warning
* @security-severity 3.6
* @tags efficiency
* security
* external/cwe/cwe-401

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/memory-never-freed
* @problem.severity warning
* @security-severity 3.6
* @tags efficiency
* security
* external/cwe/cwe-401

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/missing-negativity-test
* @problem.severity warning
* @security-severity 10.0
* @tags reliability
* security
* external/cwe/cwe-823

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/missing-null-test
* @problem.severity recommendation
* @security-severity 3.6
* @tags reliability
* security
* external/cwe/cwe-476

View File

@@ -3,6 +3,7 @@
* @description An object that was allocated with 'malloc' or 'new' is being freed using a mismatching 'free' or 'delete'.
* @kind problem
* @problem.severity warning
* @security-severity 3.6
* @precision high
* @id cpp/new-free-mismatch
* @tags reliability

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/overflow-calculated
* @problem.severity warning
* @security-severity 5.9
* @tags reliability
* security
* external/cwe/cwe-131

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/overflow-destination
* @problem.severity warning
* @security-severity 10.0
* @precision low
* @tags reliability
* security

View File

@@ -4,6 +4,7 @@
* may result in a buffer overflow.
* @kind problem
* @problem.severity warning
* @security-severity 10.0
* @precision medium
* @id cpp/static-buffer-overflow
* @tags reliability

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/return-stack-allocated-object
* @problem.severity warning
* @security-severity 2.9
* @tags reliability
* security
* external/cwe/cwe-562

View File

@@ -4,6 +4,7 @@
* an instance of the type of the pointer may result in a buffer overflow
* @kind problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/allocation-too-small
* @tags reliability

View File

@@ -4,6 +4,7 @@
* multiple instances of the type of the pointer may result in a buffer overflow
* @kind problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/suspicious-allocation-size
* @tags reliability

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/use-after-free
* @problem.severity warning
* @security-severity 5.9
* @tags reliability
* security
* external/cwe/cwe-416

View File

@@ -6,6 +6,7 @@
* to a larger type.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision very-high
* @id cpp/bad-addition-overflow-check
* @tags reliability

View File

@@ -4,6 +4,7 @@
* be a sign that the result can overflow the type converted from.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision high
* @id cpp/integer-multiplication-cast-to-long
* @tags reliability

View File

@@ -5,6 +5,7 @@
* unsigned integer values.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision high
* @id cpp/signed-overflow-check
* @tags correctness

View File

@@ -6,6 +6,7 @@
* use the width of the base type, leading to misaligned reads.
* @kind path-problem
* @problem.severity warning
* @security-severity 10.0
* @precision high
* @id cpp/upcast-array-pointer-arithmetic
* @tags correctness

View File

@@ -6,6 +6,7 @@
* from an untrusted source, this can be used for exploits.
* @kind problem
* @problem.severity recommendation
* @security-severity 6.9
* @precision high
* @id cpp/non-constant-format
* @tags maintainability

View File

@@ -3,6 +3,7 @@
* @description Using the return value from snprintf without proper checks can cause overflow.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision high
* @id cpp/overflowing-snprintf
* @tags reliability

View File

@@ -4,6 +4,7 @@
* a source of security issues.
* @kind problem
* @problem.severity error
* @security-severity 2.9
* @precision high
* @id cpp/wrong-number-format-arguments
* @tags reliability

View File

@@ -4,6 +4,7 @@
* behavior.
* @kind problem
* @problem.severity error
* @security-severity 6.4
* @precision high
* @id cpp/wrong-type-format-argument
* @tags reliability

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/incorrect-not-operator-usage
* @problem.severity warning
* @security-severity 3.6
* @precision medium
* @tags security
* external/cwe/cwe-480

View File

@@ -3,6 +3,7 @@
* @description Using alloca in a loop can lead to a stack overflow
* @kind problem
* @problem.severity warning
* @security-severity 3.6
* @precision high
* @id cpp/alloca-in-loop
* @tags reliability

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/improper-null-termination
* @problem.severity warning
* @security-severity 5.9
* @tags security
* external/cwe/cwe-170
* external/cwe/cwe-665

View File

@@ -4,6 +4,7 @@
* on undefined behavior and may lead to memory corruption.
* @kind problem
* @problem.severity error
* @security-severity 2.9
* @precision high
* @id cpp/pointer-overflow-check
* @tags reliability

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/potential-buffer-overflow
* @problem.severity warning
* @security-severity 10.0
* @tags reliability
* security
* external/cwe/cwe-676

View File

@@ -4,6 +4,7 @@
* as the third argument may result in a buffer overflow.
* @kind problem
* @problem.severity warning
* @security-severity 10.0
* @precision medium
* @id cpp/bad-strncpy-size
* @tags reliability

View File

@@ -7,6 +7,7 @@
* @kind problem
* @id cpp/suspicious-call-to-memset
* @problem.severity recommendation
* @security-severity 10.0
* @precision medium
* @tags reliability
* correctness

View File

@@ -3,6 +3,7 @@
* @description Calling 'strncat' with an incorrect size argument may result in a buffer overflow.
* @kind problem
* @problem.severity warning
* @security-severity 10.0
* @precision medium
* @id cpp/unsafe-strncat
* @tags reliability

View File

@@ -5,6 +5,7 @@
* the machine pointer size.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/suspicious-sizeof
* @tags reliability

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/uninitialized-local
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @tags security
* external/cwe/cwe-665

View File

@@ -4,6 +4,7 @@
* may result in a buffer overflow
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/unsafe-strcat
* @tags reliability

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/self-assignment-check
* @problem.severity warning
* @security-severity 5.9
* @tags reliability
* security
* external/cwe/cwe-826

View File

@@ -6,6 +6,7 @@
* @kind path-problem
* @id cpp/unsafe-use-of-this
* @problem.severity error
* @security-severity 3.6
* @precision very-high
* @tags correctness
* language-features

View File

@@ -7,6 +7,7 @@
* undefined data.
* @kind problem
* @problem.severity error
* @security-severity 2.9
* @precision very-high
* @id cpp/too-few-arguments
* @tags correctness

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/memset-may-be-deleted
* @problem.severity warning
* @security-severity 6.4
* @precision high
* @tags security
* external/cwe/cwe-14

View File

@@ -5,6 +5,7 @@
* @kind path-problem
* @precision low
* @problem.severity error
* @security-severity 5.9
* @tags security external/cwe/cwe-20
*/

View File

@@ -5,6 +5,7 @@
* @kind path-problem
* @precision low
* @problem.severity error
* @security-severity 5.9
* @tags security external/cwe/cwe-20
*/

View File

@@ -4,6 +4,7 @@
* attacker to access unexpected resources.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/path-injection
* @tags security

View File

@@ -5,6 +5,7 @@
* to command injection.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision low
* @id cpp/command-line-injection
* @tags security

View File

@@ -4,6 +4,7 @@
* allows for a cross-site scripting vulnerability.
* @kind path-problem
* @problem.severity error
* @security-severity 2.9
* @precision high
* @id cpp/cgi-xss
* @tags security

View File

@@ -5,6 +5,7 @@
* to SQL Injection.
* @kind path-problem
* @problem.severity error
* @security-severity 6.4
* @precision high
* @id cpp/sql-injection
* @tags security

View File

@@ -5,6 +5,7 @@
* commands.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.0
* @precision medium
* @id cpp/uncontrolled-process-operation
* @tags security

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/overflow-buffer
* @problem.severity recommendation
* @security-severity 10.0
* @tags security
* external/cwe/cwe-119
* external/cwe/cwe-121

View File

@@ -5,6 +5,7 @@
* overflow.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision high
* @id cpp/badly-bounded-write
* @tags reliability

View File

@@ -4,6 +4,7 @@
* of data written may overflow.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision medium
* @id cpp/overrunning-write
* @tags reliability

View File

@@ -5,6 +5,7 @@
* take extreme values.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision medium
* @id cpp/overrunning-write-with-float
* @tags reliability

View File

@@ -4,6 +4,7 @@
* of data written may overflow.
* @kind path-problem
* @problem.severity error
* @security-severity 5.9
* @precision medium
* @id cpp/unbounded-write
* @tags reliability

View File

@@ -5,6 +5,7 @@
* a specific value to terminate the argument list.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/unterminated-variadic-call
* @tags reliability

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/unclear-array-index-validation
* @problem.severity warning
* @security-severity 5.9
* @tags security
* external/cwe/cwe-129
*/

View File

@@ -5,6 +5,7 @@
* terminator can cause a buffer overrun.
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision high
* @id cpp/no-space-for-terminator
* @tags reliability

View File

@@ -5,6 +5,7 @@
* or data representation problems.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.9
* @precision high
* @id cpp/tainted-format-string
* @tags reliability

View File

@@ -5,6 +5,7 @@
* or data representation problems.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.9
* @precision high
* @id cpp/tainted-format-string-through-global
* @tags reliability

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/user-controlled-null-termination-tainted
* @problem.severity warning
* @security-severity 10.0
* @tags security
* external/cwe/cwe-170
*/

View File

@@ -4,6 +4,7 @@
* not validated can cause overflows.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision low
* @id cpp/tainted-arithmetic
* @tags security

View File

@@ -4,6 +4,7 @@
* validated can cause overflows.
* @kind path-problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/uncontrolled-arithmetic
* @tags security

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/arithmetic-with-extreme-values
* @problem.severity warning
* @security-severity 5.9
* @precision low
* @tags security
* reliability

View File

@@ -5,6 +5,7 @@
* @id cpp/comparison-with-wider-type
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision high
* @tags reliability
* security

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/integer-overflow-tainted
* @problem.severity warning
* @security-severity 5.9
* @precision low
* @tags security
* external/cwe/cwe-190

View File

@@ -4,11 +4,13 @@
* user can result in integer overflow.
* @kind path-problem
* @problem.severity error
* @security-severity 5.9
* @precision medium
* @id cpp/uncontrolled-allocation-size
* @tags reliability
* security
* external/cwe/cwe-190
* external/cwe/cwe-789
*/
import cpp

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/unsigned-difference-expression-compared-zero
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @tags security
* correctness

View File

@@ -4,6 +4,7 @@
* @kind problem
* @id cpp/hresult-boolean-conversion
* @problem.severity error
* @security-severity 4.2
* @precision high
* @tags security
* external/cwe/cwe-253

View File

@@ -5,6 +5,7 @@
* vulnerable to spoofing attacks.
* @kind path-problem
* @problem.severity warning
* @security-severity 5.8
* @precision medium
* @id cpp/user-controlled-bypass
* @tags security

View File

@@ -4,6 +4,7 @@
* to an attacker.
* @kind path-problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/cleartext-storage-buffer
* @tags security

View File

@@ -4,6 +4,7 @@
* to an attacker.
* @kind problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/cleartext-storage-file
* @tags security

View File

@@ -4,6 +4,7 @@
* database can expose it to an attacker.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/cleartext-storage-database
* @tags security

View File

@@ -4,6 +4,7 @@
* an attacker to compromise security.
* @kind problem
* @problem.severity error
* @security-severity 5.2
* @precision medium
* @id cpp/weak-cryptographic-algorithm
* @tags security
@@ -28,7 +29,7 @@ Function getAnInsecureEncryptionFunction() {
/**
* A function with additional evidence it is related to encryption.
*/
Function getAdditionalEvidenceFunction() {
Function getAnAdditionalEvidenceFunction() {
(
isEncryptionAdditionalEvidence(result.getName()) or
isEncryptionAdditionalEvidence(result.getAParameter().getName())
@@ -47,7 +48,7 @@ Macro getAnInsecureEncryptionMacro() {
/**
* A macro with additional evidence it is related to encryption.
*/
Macro getAdditionalEvidenceMacro() {
Macro getAnAdditionalEvidenceMacro() {
isEncryptionAdditionalEvidence(result.getName()) and
exists(result.getAnInvocation())
}
@@ -63,61 +64,78 @@ EnumConstant getAnInsecureEncryptionEnumConst() { isInsecureEncryption(result.ge
EnumConstant getAdditionalEvidenceEnumConst() { isEncryptionAdditionalEvidence(result.getName()) }
/**
* A function call we have a high confidence is related to use of an insecure
* encryption algorithm.
* A function call we have a high confidence is related to use of an insecure encryption algorithm, along
* with an associated `Element` which might be the best point to blame, and a description of that element.
*/
class InsecureFunctionCall extends FunctionCall {
Element blame;
string explain;
predicate getInsecureEncryptionEvidence(FunctionCall fc, Element blame, string description) {
// find use of an insecure algorithm name
(
fc.getTarget() = getAnInsecureEncryptionFunction() and
blame = fc and
description = "call to " + fc.getTarget().getName()
or
exists(MacroInvocation mi |
(
mi.getAnExpandedElement() = fc or
mi.getAnExpandedElement() = fc.getAnArgument()
) and
mi.getMacro() = getAnInsecureEncryptionMacro() and
blame = mi and
description = "invocation of macro " + mi.getMacro().getName()
)
or
exists(EnumConstantAccess ec |
ec = fc.getAnArgument() and
ec.getTarget() = getAnInsecureEncryptionEnumConst() and
blame = ec and
description = "access of enum constant " + ec.getTarget().getName()
)
) and
// find additional evidence that this function is related to encryption.
(
fc.getTarget() = getAnAdditionalEvidenceFunction()
or
exists(MacroInvocation mi |
(
mi.getAnExpandedElement() = fc or
mi.getAnExpandedElement() = fc.getAnArgument()
) and
mi.getMacro() = getAnAdditionalEvidenceMacro()
)
or
exists(EnumConstantAccess ec |
ec = fc.getAnArgument() and
ec.getTarget() = getAdditionalEvidenceEnumConst()
)
)
}
InsecureFunctionCall() {
// find use of an insecure algorithm name
(
getTarget() = getAnInsecureEncryptionFunction() and
blame = this and
explain = "function call"
or
exists(MacroInvocation mi |
(
mi.getAnExpandedElement() = this or
mi.getAnExpandedElement() = this.getAnArgument()
) and
mi.getMacro() = getAnInsecureEncryptionMacro() and
blame = mi and
explain = "macro invocation"
)
or
exists(EnumConstantAccess ec |
ec = this.getAnArgument() and
ec.getTarget() = getAnInsecureEncryptionEnumConst() and
blame = ec and
explain = "enum constant access"
)
) and
// find additional evidence that this function is related to encryption.
(
getTarget() = getAdditionalEvidenceFunction()
or
exists(MacroInvocation mi |
(
mi.getAnExpandedElement() = this or
mi.getAnExpandedElement() = this.getAnArgument()
) and
mi.getMacro() = getAdditionalEvidenceMacro()
)
or
exists(EnumConstantAccess ec |
ec = this.getAnArgument() and
ec.getTarget() = getAdditionalEvidenceEnumConst()
)
/**
* An element that is the `blame` of an `InsecureFunctionCall`.
*/
class BlamedElement extends Element {
string description;
BlamedElement() { getInsecureEncryptionEvidence(_, this, description) }
/**
* Holds if this is the `num`-th `BlamedElement` in `f`.
*/
predicate hasFileRank(File f, int num) {
exists(int loc |
getLocation().charLoc(f, loc, _) and
loc =
rank[num](BlamedElement other, int loc2 | other.getLocation().charLoc(f, loc2, _) | loc2)
)
}
Element getBlame() { result = blame }
string getDescription() { result = explain }
string getDescription() { result = description }
}
from InsecureFunctionCall c
select c.getBlame(),
"This " + c.getDescription() + " specifies a broken or weak cryptographic algorithm."
from File f, BlamedElement firstResult, BlamedElement thisResult
where
firstResult.hasFileRank(f, 1) and
thisResult.hasFileRank(f, _)
select firstResult,
"This file makes use of a broken or weak cryptographic algorithm (specified by $@).", thisResult,
thisResult.getDescription()

View File

@@ -4,6 +4,7 @@
* attackers to retrieve portions of memory.
* @kind problem
* @problem.severity error
* @security-severity 5.2
* @precision very-high
* @id cpp/openssl-heartbleed
* @tags security

View File

@@ -5,6 +5,7 @@
* the two operations.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/toctou-race-condition
* @tags security

View File

@@ -4,6 +4,7 @@
* @id cpp/unsafe-create-process-call
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision medium
* @msrc.severity important
* @tags security

View File

@@ -5,6 +5,7 @@
* state, and reading the variable may result in undefined behavior.
* @kind problem
* @problem.severity warning
* @security-severity 6.9
* @opaque-id SM02313
* @id cpp/conditionally-uninitialized-variable
* @tags security

View File

@@ -4,6 +4,7 @@
* can cause buffer overflow conditions.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/suspicious-pointer-scaling
* @tags security

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/incorrect-pointer-scaling-char
* @problem.severity warning
* @security-severity 5.9
* @precision low
* @tags security
* external/cwe/cwe-468

View File

@@ -4,6 +4,7 @@
* can cause buffer overflow conditions.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/suspicious-pointer-scaling-void
* @tags security

View File

@@ -5,6 +5,7 @@
* implicitly scaled.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision high
* @id cpp/suspicious-add-sizeof
* @tags security

View File

@@ -5,6 +5,7 @@
* attack plan.
* @kind problem
* @problem.severity warning
* @security-severity 3.6
* @precision medium
* @id cpp/system-data-exposure
* @tags security

View File

@@ -3,6 +3,7 @@
* @description Use of a standard library function that does not guard against buffer overflow.
* @kind problem
* @problem.severity error
* @security-severity 10.0
* @precision very-high
* @id cpp/dangerous-function-overflow
* @tags reliability

View File

@@ -4,6 +4,7 @@
* may be dangerous.
* @kind problem
* @problem.severity error
* @security-severity 10.0
* @precision high
* @id cpp/dangerous-cin
* @tags reliability

View File

@@ -3,6 +3,7 @@
* @description Use of a standard library function that is not thread-safe.
* @kind problem
* @problem.severity warning
* @security-severity 10.0
* @precision high
* @id cpp/potentially-dangerous-function
* @tags reliability

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/incorrect-string-type-conversion
* @problem.severity error
* @security-severity 5.9
* @precision high
* @tags security
* external/cwe/cwe-704

View File

@@ -3,6 +3,7 @@
* @description Creating a file that is world-writable can allow an attacker to write to the file.
* @kind problem
* @problem.severity warning
* @security-severity 5.9
* @precision medium
* @id cpp/world-writable-file-creation
* @tags security

View File

@@ -7,6 +7,7 @@
* @id cpp/unsafe-dacl-security-descriptor
* @kind problem
* @problem.severity error
* @security-severity 5.9
* @precision high
* @tags security
* external/cwe/cwe-732

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/lock-order-cycle
* @problem.severity error
* @security-severity 6.9
* @tags security
* external/cwe/cwe-764
* external/cwe/cwe-833

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/twice-locked
* @problem.severity error
* @security-severity 6.9
* @precision low
* @tags security
* external/cwe/cwe-764

View File

@@ -5,6 +5,7 @@
* @kind problem
* @id cpp/unreleased-lock
* @problem.severity error
* @security-severity 6.9
* @precision low
* @tags security
* external/cwe/cwe-764

View File

@@ -5,6 +5,7 @@
* attack.
* @kind path-problem
* @problem.severity warning
* @security-severity 6.4
* @precision medium
* @id cpp/tainted-permissions-check
* @tags security

View File

@@ -6,6 +6,7 @@
* @kind problem
* @id cpp/infinite-loop-with-unsatisfiable-exit-condition
* @problem.severity warning
* @security-severity 3.6
* @tags security
* external/cwe/cwe-835
*/

View File

@@ -0,0 +1,17 @@
/**
* @name Total lines of user written C/C++ code in the database
* @description The total number of lines of C/C++ code from the source code directory, excluding auto-generated files. This query counts the lines of code, excluding whitespace or comments. Note: If external libraries are included in the codebase either in a checked-in virtual environment or as vendored code, that will currently be counted as user written code.
* @kind metric
* @tags summary
* lines-of-code
* @id cpp/summary/lines-of-user-code
*/
import cpp
import semmle.code.cpp.AutogeneratedFile
select sum(File f |
f.fromSource() and exists(f.getRelativePath()) and not f instanceof AutogeneratedFile
|
f.getMetrics().getNumberOfLinesOfCode()
)

View File

@@ -128,7 +128,9 @@ deprecated library class LocationExpr extends Location, @location_expr { }
* Gets the length of the longest line in file `f`.
*/
pragma[nomagic]
private int maxCols(File f) { result = max(Location l | l.getFile() = f | l.getEndColumn()) }
private int maxCols(File f) {
result = max(Location l | l.getFile() = f | l.getStartColumn().maximum(l.getEndColumn()))
}
/**
* A C/C++ element that has a location in a file

Some files were not shown because too many files have changed in this diff Show More