Skip to content

Commit 919cb07

Browse files
committed
Sync ApiGraphModels.qll
1 parent f3fab58 commit 919cb07

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ private API::Node getNodeFromPath(string type, AccessPath path, int n) {
454454
or
455455
// Apply a type step
456456
typeStep(getNodeFromPath(type, path, n), result)
457+
or
458+
// Apply a fuzzy step (without advancing 'n')
459+
path.getToken(n).getName() = "Fuzzy" and
460+
result = Specific::getAFuzzySuccessor(getNodeFromPath(type, path, n))
461+
or
462+
// Skip a fuzzy step (advance 'n' without changing the current node)
463+
path.getToken(n - 1).getName() = "Fuzzy" and
464+
result = getNodeFromPath(type, path, n - 1)
457465
}
458466

459467
/**
@@ -500,6 +508,14 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath, int n)
500508
// will themselves find by following type-steps.
501509
n > 0 and
502510
n < subPath.getNumToken()
511+
or
512+
// Apply a fuzzy step (without advancing 'n')
513+
subPath.getToken(n).getName() = "Fuzzy" and
514+
result = Specific::getAFuzzySuccessor(getNodeFromSubPath(base, subPath, n))
515+
or
516+
// Skip a fuzzy step (advance 'n' without changing the current node)
517+
subPath.getToken(n - 1).getName() = "Fuzzy" and
518+
result = getNodeFromSubPath(base, subPath, n - 1)
503519
}
504520

505521
/**
@@ -561,7 +577,7 @@ private Specific::InvokeNode getInvocationFromPath(string type, AccessPath path)
561577
*/
562578
bindingset[name]
563579
private predicate isValidTokenNameInIdentifyingAccessPath(string name) {
564-
name = ["Argument", "Parameter", "ReturnValue", "WithArity", "TypeVar"]
580+
name = ["Argument", "Parameter", "ReturnValue", "WithArity", "TypeVar", "Fuzzy"]
565581
or
566582
Specific::isExtraValidTokenNameInIdentifyingAccessPath(name)
567583
}
@@ -572,7 +588,7 @@ private predicate isValidTokenNameInIdentifyingAccessPath(string name) {
572588
*/
573589
bindingset[name]
574590
private predicate isValidNoArgumentTokenInIdentifyingAccessPath(string name) {
575-
name = "ReturnValue"
591+
name = ["ReturnValue", "Fuzzy"]
576592
or
577593
Specific::isExtraValidNoArgumentTokenInIdentifyingAccessPath(name)
578594
}

ruby/ql/lib/codeql/ruby/frameworks/data/internal/ApiGraphModels.qll

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,14 @@ private API::Node getNodeFromPath(string type, AccessPath path, int n) {
454454
or
455455
// Apply a type step
456456
typeStep(getNodeFromPath(type, path, n), result)
457+
or
458+
// Apply a fuzzy step (without advancing 'n')
459+
path.getToken(n).getName() = "Fuzzy" and
460+
result = Specific::getAFuzzySuccessor(getNodeFromPath(type, path, n))
461+
or
462+
// Skip a fuzzy step (advance 'n' without changing the current node)
463+
path.getToken(n - 1).getName() = "Fuzzy" and
464+
result = getNodeFromPath(type, path, n - 1)
457465
}
458466

459467
/**
@@ -500,6 +508,14 @@ private API::Node getNodeFromSubPath(API::Node base, AccessPath subPath, int n)
500508
// will themselves find by following type-steps.
501509
n > 0 and
502510
n < subPath.getNumToken()
511+
or
512+
// Apply a fuzzy step (without advancing 'n')
513+
subPath.getToken(n).getName() = "Fuzzy" and
514+
result = Specific::getAFuzzySuccessor(getNodeFromSubPath(base, subPath, n))
515+
or
516+
// Skip a fuzzy step (advance 'n' without changing the current node)
517+
subPath.getToken(n - 1).getName() = "Fuzzy" and
518+
result = getNodeFromSubPath(base, subPath, n - 1)
503519
}
504520

505521
/**
@@ -561,7 +577,7 @@ private Specific::InvokeNode getInvocationFromPath(string type, AccessPath path)
561577
*/
562578
bindingset[name]
563579
private predicate isValidTokenNameInIdentifyingAccessPath(string name) {
564-
name = ["Argument", "Parameter", "ReturnValue", "WithArity", "TypeVar"]
580+
name = ["Argument", "Parameter", "ReturnValue", "WithArity", "TypeVar", "Fuzzy"]
565581
or
566582
Specific::isExtraValidTokenNameInIdentifyingAccessPath(name)
567583
}
@@ -572,7 +588,7 @@ private predicate isValidTokenNameInIdentifyingAccessPath(string name) {
572588
*/
573589
bindingset[name]
574590
private predicate isValidNoArgumentTokenInIdentifyingAccessPath(string name) {
575-
name = "ReturnValue"
591+
name = ["ReturnValue", "Fuzzy"]
576592
or
577593
Specific::isExtraValidNoArgumentTokenInIdentifyingAccessPath(name)
578594
}

0 commit comments

Comments
 (0)