From 754f96d49f2a79a03b90ad5926250daba07dc865 Mon Sep 17 00:00:00 2001 From: alex <53851759+alxxjohn@users.noreply.github.com> Date: Tue, 16 Jun 2026 16:59:11 -0400 Subject: [PATCH] Potential fix for code scanning alert no. 1: Missing regular expression anchor Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- internal/codeguard/checks/quality/quality_ai_style_drift.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/codeguard/checks/quality/quality_ai_style_drift.go b/internal/codeguard/checks/quality/quality_ai_style_drift.go index addc27b..485609b 100644 --- a/internal/codeguard/checks/quality/quality_ai_style_drift.go +++ b/internal/codeguard/checks/quality/quality_ai_style_drift.go @@ -14,7 +14,7 @@ var ( goErrorfWrapPattern = regexp.MustCompile(`fmt\.Errorf\([^\n]*%w`) goErrorfPattern = regexp.MustCompile(`fmt\.Errorf\(`) goErrorsNewPattern = regexp.MustCompile(`errors\.New\(`) - goPkgErrorsPattern = regexp.MustCompile(`errors\.(?:Wrap|Wrapf|WithStack|WithMessage)\(|github\.com/pkg/errors`) + goPkgErrorsPattern = regexp.MustCompile(`(?:^|[^A-Za-z0-9_])(errors\.(?:Wrap|Wrapf|WithStack|WithMessage)\(|github\.com/pkg/errors)(?:$|[^A-Za-z0-9_])`) scriptThrowNewPattern = regexp.MustCompile(`throw\s+new\s+([A-Za-z_$][\w$]*)\s*\(`) )