From bec381a1dc9ff9e4eafd483414aeb20c3f9e93e8 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Tue, 20 Sep 2022 12:38:34 +0200 Subject: [PATCH 1/5] remove unused predicate from NfaUtilsSpecific.qll --- .../semmle/code/java/security/regexp/NfaUtilsSpecific.qll | 8 -------- 1 file changed, 8 deletions(-) diff --git a/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll b/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll index d72d6770848..d2ddb24d79e 100644 --- a/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll +++ b/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll @@ -58,14 +58,6 @@ module RegExpFlags { root.getLiteral().isIgnoreCase() } - /** - * Gets the flags for `root`, or the empty string if `root` has no flags. - */ - string getFlags(RegExpTerm root) { - root.isRootTerm() and - result = root.getLiteral().getFlags() - } - /** * Holds if `root` has the `s` flag for multi-line matching. */ From 8eefa4c1b0a428774804c86ae3eae4a7789e62d7 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Tue, 20 Sep 2022 12:39:41 +0200 Subject: [PATCH 2/5] deprecate internal predicate that was never used --- java/ql/lib/semmle/code/java/controlflow/Guards.qll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/ql/lib/semmle/code/java/controlflow/Guards.qll b/java/ql/lib/semmle/code/java/controlflow/Guards.qll index 321af254c35..8634127cf01 100644 --- a/java/ql/lib/semmle/code/java/controlflow/Guards.qll +++ b/java/ql/lib/semmle/code/java/controlflow/Guards.qll @@ -218,12 +218,12 @@ predicate guardControls_v1(Guard guard, BasicBlock controlled, boolean branch) { } /** - * INTERNAL: Use `Guards.controls` instead. + * DEPRECATED: Use `Guards.controls` instead. * * Holds if `guard.controls(controlled, branch)`, except this doesn't rely on * RangeAnalysis. */ -predicate guardControls_v2(Guard guard, BasicBlock controlled, boolean branch) { +deprecated predicate guardControls_v2(Guard guard, BasicBlock controlled, boolean branch) { guard.directlyControls(controlled, branch) or exists(Guard g, boolean b | From 70eced62b62e95a97635eca45aba5307d2bda030 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Tue, 20 Sep 2022 12:40:39 +0200 Subject: [PATCH 3/5] delete unused predicate that couldn't be imported from outside the folder --- .../Naming Conventions/Shadowing.qll | 4 ---- 1 file changed, 4 deletions(-) diff --git a/java/ql/src/Violations of Best Practice/Naming Conventions/Shadowing.qll b/java/ql/src/Violations of Best Practice/Naming Conventions/Shadowing.qll index 0451956977e..e58016bdff9 100644 --- a/java/ql/src/Violations of Best Practice/Naming Conventions/Shadowing.qll +++ b/java/ql/src/Violations of Best Practice/Naming Conventions/Shadowing.qll @@ -1,9 +1,5 @@ import java -predicate initializedToField(LocalVariableDecl d, Field f) { - exists(LocalVariableDeclExpr e | e.getVariable() = d and f.getAnAccess() = e.getInit()) -} - predicate getterFor(Method m, Field f) { m.getName().matches("get%") and m.getDeclaringType() = f.getDeclaringType() and From b61bd56d70c8d8e477798f79635380f9552944e5 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Thu, 22 Sep 2022 13:42:50 +0200 Subject: [PATCH 4/5] un-deprecate `guardControls_v2` --- java/ql/lib/semmle/code/java/controlflow/Guards.qll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/ql/lib/semmle/code/java/controlflow/Guards.qll b/java/ql/lib/semmle/code/java/controlflow/Guards.qll index 8634127cf01..321af254c35 100644 --- a/java/ql/lib/semmle/code/java/controlflow/Guards.qll +++ b/java/ql/lib/semmle/code/java/controlflow/Guards.qll @@ -218,12 +218,12 @@ predicate guardControls_v1(Guard guard, BasicBlock controlled, boolean branch) { } /** - * DEPRECATED: Use `Guards.controls` instead. + * INTERNAL: Use `Guards.controls` instead. * * Holds if `guard.controls(controlled, branch)`, except this doesn't rely on * RangeAnalysis. */ -deprecated predicate guardControls_v2(Guard guard, BasicBlock controlled, boolean branch) { +predicate guardControls_v2(Guard guard, BasicBlock controlled, boolean branch) { guard.directlyControls(controlled, branch) or exists(Guard g, boolean b | From a8929b640002d95e08c2a932e19f2317992f7d31 Mon Sep 17 00:00:00 2001 From: erik-krogh Date: Thu, 22 Sep 2022 13:43:42 +0200 Subject: [PATCH 5/5] deprecate `RegExpFlags::getFlags` instead of deleting it --- .../semmle/code/java/security/regexp/NfaUtilsSpecific.qll | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll b/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll index d2ddb24d79e..742229eacca 100644 --- a/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll +++ b/java/ql/lib/semmle/code/java/security/regexp/NfaUtilsSpecific.qll @@ -58,6 +58,14 @@ module RegExpFlags { root.getLiteral().isIgnoreCase() } + /** + * Gets the flags for `root`, or the empty string if `root` has no flags. + */ + deprecated string getFlags(RegExpTerm root) { + root.isRootTerm() and + result = root.getLiteral().getFlags() + } + /** * Holds if `root` has the `s` flag for multi-line matching. */