Skip to content

Commit

Permalink
Merge branch 'main' into redsun82/swift-6
Browse files Browse the repository at this point in the history
  • Loading branch information
redsun82 authored Dec 13, 2024
2 parents 5ca89ea + 7925044 commit 92ec7e8
Show file tree
Hide file tree
Showing 37 changed files with 1,042 additions and 132 deletions.
9 changes: 6 additions & 3 deletions config/identical-files.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@
"CryptoAlgorithms Python/JS/Ruby": [
"javascript/ql/lib/semmle/javascript/security/CryptoAlgorithms.qll",
"python/ql/lib/semmle/python/concepts/CryptoAlgorithms.qll",
"ruby/ql/lib/codeql/ruby/security/CryptoAlgorithms.qll"
"ruby/ql/lib/codeql/ruby/security/CryptoAlgorithms.qll",
"rust/ql/lib/codeql/rust/security/CryptoAlgorithms.qll"
],
"CryptoAlgorithmNames Python/JS/Ruby": [
"javascript/ql/lib/semmle/javascript/security/internal/CryptoAlgorithmNames.qll",
"python/ql/lib/semmle/python/concepts/internal/CryptoAlgorithmNames.qll",
"ruby/ql/lib/codeql/ruby/security/internal/CryptoAlgorithmNames.qll"
"ruby/ql/lib/codeql/ruby/security/internal/CryptoAlgorithmNames.qll",
"rust/ql/lib/codeql/rust/security/internal/CryptoAlgorithmNames.qll"
],
"SensitiveDataHeuristics Python/JS": [
"javascript/ql/lib/semmle/javascript/security/internal/SensitiveDataHeuristics.qll",
Expand All @@ -254,7 +256,8 @@
"Concepts Python/Ruby/JS": [
"python/ql/lib/semmle/python/internal/ConceptsShared.qll",
"ruby/ql/lib/codeql/ruby/internal/ConceptsShared.qll",
"javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll"
"javascript/ql/lib/semmle/javascript/internal/ConceptsShared.qll",
"rust/ql/lib/codeql/rust/internal/ConceptsShared.qll"
],
"ApiGraphModels": [
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModels.qll",
Expand Down
17 changes: 13 additions & 4 deletions cpp/ql/lib/semmle/code/cpp/PrintAST.qll
Original file line number Diff line number Diff line change
Expand Up @@ -954,17 +954,26 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
expr.(C11GenericExpr).getAssociationExpr(n) = ele and pred = "getAssociationExpr(" + n + ")"
)
or
expr.(Call).getQualifier() = ele and pred = "getQualifier()"
or
exists(int n | expr.(Call).getArgument(n) = ele and pred = "getArgument(" + n.toString() + ")")
// OverloadedArrayExpr::getArrayBase/0 also considers qualifiers, and is already handled below.
not expr.(OverloadedArrayExpr).getArrayBase() = expr.(Call).getQualifier() and
expr.(Call).getQualifier() = ele and
pred = "getQualifier()"
or
// OverloadedArrayExpr::getArrayBase/0 and OverloadedArrayExpr::getArrayOffset/0 also consider arguments, and are already handled below.
exists(int n, Expr arg | expr.(Call).getArgument(n) = arg |
not expr.(OverloadedArrayExpr).getArrayBase() = arg and
not expr.(OverloadedArrayExpr).getArrayOffset() = arg and
arg = ele and
pred = "getArgument(" + n.toString() + ")"
)
or
expr.(ExprCall).getExpr() = ele and pred = "getExpr()"
or
expr.(OverloadedArrayExpr).getArrayBase() = ele and pred = "getArrayBase()"
or
expr.(OverloadedArrayExpr).getArrayOffset() = ele and pred = "getArrayOffset()"
or
// OverloadedPointerDereferenceExpr::getExpr/0 also considers qualifiers, which are already handled above for all Call classes.
// OverloadedPointerDereferenceExpr::getExpr/0 also considers qualifiers, and is already handled above for all Call classes.
not expr.(OverloadedPointerDereferenceExpr).getQualifier() =
expr.(OverloadedPointerDereferenceExpr).getExpr() and
expr.(OverloadedPointerDereferenceExpr).getExpr() = ele and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,22 @@ private int getSuccessorIndex(IRBlock pred, IRBlock succ) {
* has the given `value`.
*/
query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key, string value) {
exists(EdgeKind kind, IRBlock predBlock, IRBlock succBlock |
exists(IRBlock predBlock, IRBlock succBlock |
predBlock = pred.getBlock() and
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
key = "semmle.label" and
exists(string kinds |
kinds =
strictconcat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(_) = succBlock
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and
Expand Down
20 changes: 13 additions & 7 deletions cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/PrintIR.qll
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,22 @@ private int getSuccessorIndex(IRBlock pred, IRBlock succ) {
* has the given `value`.
*/
query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key, string value) {
exists(EdgeKind kind, IRBlock predBlock, IRBlock succBlock |
exists(IRBlock predBlock, IRBlock succBlock |
predBlock = pred.getBlock() and
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
key = "semmle.label" and
exists(string kinds |
kinds =
strictconcat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(_) = succBlock
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,16 +422,22 @@ private int getSuccessorIndex(IRBlock pred, IRBlock succ) {
* has the given `value`.
*/
query predicate edges(PrintableIRBlock pred, PrintableIRBlock succ, string key, string value) {
exists(EdgeKind kind, IRBlock predBlock, IRBlock succBlock |
exists(IRBlock predBlock, IRBlock succBlock |
predBlock = pred.getBlock() and
succBlock = succ.getBlock() and
predBlock.getSuccessor(kind) = succBlock and
(
(
key = "semmle.label" and
if predBlock.getBackEdgeSuccessor(kind) = succBlock
then value = kind.toString() + " (back edge)"
else value = kind.toString()
key = "semmle.label" and
exists(string kinds |
kinds =
strictconcat(EdgeKind k |
predBlock.getSuccessor(k) = succBlock
|
k.toString(), "|" order by k.toString()
)
|
if predBlock.getBackEdgeSuccessor(_) = succBlock
then value = kinds + " (back edge)"
else value = kinds
)
or
key = "semmle.order" and
Expand Down
32 changes: 32 additions & 0 deletions cpp/ql/test/library-tests/ir/ir/PrintAST.expected
Original file line number Diff line number Diff line change
Expand Up @@ -24086,6 +24086,38 @@ ir.cpp:
# 2717| ValueCategory = prvalue
# 2717| getThen(): [BlockStmt] { ... }
# 2718| getStmt(16): [ReturnStmt] return ...
# 2720| [CopyAssignmentOperator] WithBracketOperator& WithBracketOperator::operator=(WithBracketOperator const&)
# 2720| <params>:
#-----| getParameter(0): [Parameter] (unnamed parameter 0)
#-----| Type = [LValueReferenceType] const WithBracketOperator &
# 2720| [MoveAssignmentOperator] WithBracketOperator& WithBracketOperator::operator=(WithBracketOperator&&)
# 2720| <params>:
#-----| getParameter(0): [Parameter] (unnamed parameter 0)
#-----| Type = [RValueReferenceType] WithBracketOperator &&
# 2721| [ConstMemberFunction] char const& WithBracketOperator::operator[](int) const
# 2721| <params>:
# 2721| getParameter(0): [Parameter] pos
# 2721| Type = [IntType] int
# 2724| [TopLevelFunction] char UseBracketOperator(WithBracketOperator const, int)
# 2724| <params>:
# 2724| getParameter(0): [Parameter] x
# 2724| Type = [SpecifiedType] const WithBracketOperator
# 2724| getParameter(1): [Parameter] i
# 2724| Type = [IntType] int
# 2724| getEntryPoint(): [BlockStmt] { ... }
# 2725| getStmt(0): [ReturnStmt] return ...
# 2725| getExpr(): [OverloadedArrayExpr] call to operator[]
# 2725| Type = [LValueReferenceType] const char &
# 2725| ValueCategory = prvalue
# 2725| getArrayBase(): [VariableAccess] x
# 2725| Type = [SpecifiedType] const WithBracketOperator
# 2725| ValueCategory = lvalue
# 2725| getArrayOffset(): [VariableAccess] i
# 2725| Type = [IntType] int
# 2725| ValueCategory = prvalue(load)
# 2725| getExpr().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference)
# 2725| Type = [PlainCharType] char
# 2725| ValueCategory = prvalue(load)
many-defs-per-use.cpp:
# 34| [TopLevelFunction] void many_defs_per_use()
# 34| <params>:
Expand Down
27 changes: 27 additions & 0 deletions cpp/ql/test/library-tests/ir/ir/aliased_ir.expected
Original file line number Diff line number Diff line change
Expand Up @@ -19713,6 +19713,33 @@ ir.cpp:
# 2698| v2698_10(void) = AliasedUse : m2698_3
# 2698| v2698_11(void) = ExitFunction :

# 2724| char UseBracketOperator(WithBracketOperator const, int)
# 2724| Block 0
# 2724| v2724_1(void) = EnterFunction :
# 2724| m2724_2(unknown) = AliasedDefinition :
# 2724| m2724_3(unknown) = InitializeNonLocal :
# 2724| m2724_4(unknown) = Chi : total:m2724_2, partial:m2724_3
# 2724| r2724_5(glval<WithBracketOperator>) = VariableAddress[x] :
# 2724| m2724_6(WithBracketOperator) = InitializeParameter[x] : &:r2724_5
# 2724| m2724_7(unknown) = Chi : total:m2724_4, partial:m2724_6
# 2724| r2724_8(glval<int>) = VariableAddress[i] :
# 2724| m2724_9(int) = InitializeParameter[i] : &:r2724_8
# 2725| r2725_1(glval<char>) = VariableAddress[#return] :
# 2725| r2725_2(glval<WithBracketOperator>) = VariableAddress[x] :
# 2725| r2725_3(glval<unknown>) = FunctionAddress[operator[]] :
# 2725| r2725_4(glval<int>) = VariableAddress[i] :
# 2725| r2725_5(int) = Load[i] : &:r2725_4, m2724_9
# 2725| r2725_6(char &) = Call[operator[]] : func:r2725_3, this:r2725_2, 0:r2725_5
# 2725| m2725_7(unknown) = ^CallSideEffect : ~m2724_7
# 2725| m2725_8(unknown) = Chi : total:m2724_7, partial:m2725_7
# 2725| v2725_9(void) = ^IndirectReadSideEffect[-1] : &:r2725_2, ~m2725_8
# 2725| r2725_10(char) = Load[?] : &:r2725_6, ~m2725_8
# 2725| m2725_11(char) = Store[#return] : &:r2725_1, r2725_10
# 2724| r2724_10(glval<char>) = VariableAddress[#return] :
# 2724| v2724_11(void) = ReturnValue : &:r2724_10, m2725_11
# 2724| v2724_12(void) = AliasedUse : ~m2725_8
# 2724| v2724_13(void) = ExitFunction :

many-defs-per-use.cpp:
# 34| void many_defs_per_use()
# 34| Block 0
Expand Down
8 changes: 8 additions & 0 deletions cpp/ql/test/library-tests/ir/ir/ir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2717,4 +2717,12 @@ void branch_on_integral_in_cpp(int x1, int x2) {
if(!x_1_and_2) {}
}

struct WithBracketOperator {
const char& operator[](int pos) const;
};

char UseBracketOperator(const WithBracketOperator x, int i) {
return x[i];
}

// semmle-extractor-options: -std=c++20 --clang
24 changes: 24 additions & 0 deletions cpp/ql/test/library-tests/ir/ir/raw_ir.expected
Original file line number Diff line number Diff line change
Expand Up @@ -18031,6 +18031,30 @@ ir.cpp:
# 2698| v2698_9(void) = AliasedUse : ~m?
# 2698| v2698_10(void) = ExitFunction :

# 2724| char UseBracketOperator(WithBracketOperator const, int)
# 2724| Block 0
# 2724| v2724_1(void) = EnterFunction :
# 2724| mu2724_2(unknown) = AliasedDefinition :
# 2724| mu2724_3(unknown) = InitializeNonLocal :
# 2724| r2724_4(glval<WithBracketOperator>) = VariableAddress[x] :
# 2724| mu2724_5(WithBracketOperator) = InitializeParameter[x] : &:r2724_4
# 2724| r2724_6(glval<int>) = VariableAddress[i] :
# 2724| mu2724_7(int) = InitializeParameter[i] : &:r2724_6
# 2725| r2725_1(glval<char>) = VariableAddress[#return] :
# 2725| r2725_2(glval<WithBracketOperator>) = VariableAddress[x] :
# 2725| r2725_3(glval<unknown>) = FunctionAddress[operator[]] :
# 2725| r2725_4(glval<int>) = VariableAddress[i] :
# 2725| r2725_5(int) = Load[i] : &:r2725_4, ~m?
# 2725| r2725_6(char &) = Call[operator[]] : func:r2725_3, this:r2725_2, 0:r2725_5
# 2725| mu2725_7(unknown) = ^CallSideEffect : ~m?
# 2725| v2725_8(void) = ^IndirectReadSideEffect[-1] : &:r2725_2, ~m?
# 2725| r2725_9(char) = Load[?] : &:r2725_6, ~m?
# 2725| mu2725_10(char) = Store[#return] : &:r2725_1, r2725_9
# 2724| r2724_8(glval<char>) = VariableAddress[#return] :
# 2724| v2724_9(void) = ReturnValue : &:r2724_8, ~m?
# 2724| v2724_10(void) = AliasedUse : ~m?
# 2724| v2724_11(void) = ExitFunction :

many-defs-per-use.cpp:
# 34| void many_defs_per_use()
# 34| Block 0
Expand Down
4 changes: 2 additions & 2 deletions csharp/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"paket": {
"version": "9.0.1",
"version": "9.0.2",
"commands": [
"paket"
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,16 @@ private bool IsFeedReachable(string feed, int timeoutMilliSeconds, int tryCount,
{
httpClientHandler.ServerCertificateCustomValidationCallback = (message, cert, chain, _) =>
{
if (chain is null || cert is null)
{
var msg = cert is null && chain is null
? "certificate and chain"
: chain is null
? "chain"
: "certificate";
logger.LogWarning($"Dependabot proxy certificate validation failed due to missing {msg}");
return false;
}
chain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust;
chain.ChainPolicy.CustomTrustStore.Add(this.dependabotProxy.Certificate);
return chain.Build(cert);
Expand Down
10 changes: 5 additions & 5 deletions csharp/paket.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 92ec7e8

Please sign in to comment.