From bf7af7876c36a2e5e0df6a6d5b17aebb4f96ff6b Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 2 Nov 2023 18:17:50 +0100 Subject: [PATCH] Python: Disallow examples --- .../lib/semmle/python/frameworks/internal/SubclassFinder.qll | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll b/python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll index 5aa039a9f26..c6dfcb90ad3 100644 --- a/python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll +++ b/python/ql/lib/semmle/python/frameworks/internal/SubclassFinder.qll @@ -113,7 +113,8 @@ module NotExposed { predicate isAllowedModule(Module mod) { // don't include anything found in site-packages - exists(mod.getFile().getRelativePath()) + exists(mod.getFile().getRelativePath()) and + not mod.getFile().getRelativePath().regexpMatch("(?i)(^|/)examples?/.*") } predicate isTestCode(AstNode ast) {