From 023e8cbe3e00a1207d641f8f8139e942275b585d Mon Sep 17 00:00:00 2001 From: Kylie Stradley <4666485+KyFaSt@users.noreply.github.com> Date: Mon, 21 Oct 2024 20:59:42 -0400 Subject: [PATCH] factor semver to separate function --- .../actions/security/UseOfUnversionedImmutableAction.qll | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ql/lib/codeql/actions/security/UseOfUnversionedImmutableAction.qll b/ql/lib/codeql/actions/security/UseOfUnversionedImmutableAction.qll index 2be71612f26..3f65a2ffc72 100644 --- a/ql/lib/codeql/actions/security/UseOfUnversionedImmutableAction.qll +++ b/ql/lib/codeql/actions/security/UseOfUnversionedImmutableAction.qll @@ -6,6 +6,11 @@ class UnversionedImmutableAction extends UsesStep { UnversionedImmutableAction() { immutableActionsDataModel(immutable_action) and this.getCallee() = immutable_action and - not this.getVersion().regexpMatch("^(v)?[0-9]+(\\.[0-9]+)*(\\.[xX])?$") + isNotSemVer(this.getVersion()) } } + +bindingset[version] +predicate isNotSemVer(string version) { + not version.regexpMatch("^(v)?[0-9]+(\\.[0-9]+)*(\\.[xX])?$") +}