Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(ci): make DevSkim test exclusions workspace-aware (#6202)

LearningCircuite35dcde861da
diff --git a/.github/SECURITY_ALERTS.md b/.github/SECURITY_ALERTS.md
index 45f9ce31a8..e696bb6ef4 100644
--- a/.github/SECURITY_ALERTS.md
+++ b/.github/SECURITY_ALERTS.md
@@ -44,10 +44,12 @@ intentional mock data for testing.
- `password="testpass"`
- `sample_data_with_secrets()`
-2. **DevSkim already excludes tests** - The `.github/workflows/devskim.yml`
- configuration includes:
+2. **DevSkim excludes tests** - The pinned action scans an absolute
+ `$GITHUB_WORKSPACE` path, so each repository-directory exclusion needs a
+ leading `**/`. Explicit exclusions replace the action's defaults, so
+ `.git` and `bin` are retained in the `.github/workflows/devskim.yml` configuration:
```yaml
- ignore-globs: 'examples/**,tests/**'
+ ignore-globs: '**/tests/**,**/examples/**,**/docs/**,**/node_modules/**,**/.git/**,**/bin/**'
```
3. **Never real credentials** - All test values are obviously fake
diff --git a/.github/workflows/devskim.yml b/.github/workflows/devskim.yml
index bb009c7337..bd52a3ecb0 100644
--- a/.github/workflows/devskim.yml
+++ b/.github/workflows/devskim.yml
@@ -45,7 +45,18 @@ jobs:
# - examples/: Example code with placeholder values
# - docs/: Documentation with example URLs
# - node_modules/: Third-party code
- ignore-globs: 'tests/**,examples/**,docs/**,node_modules/**,**/node_modules/**'
+ # The action expands `directory-to-scan` to an absolute
+ # `$GITHUB_WORKSPACE/...` path, so a relative glob can't be
+ # root-anchored to it here; `**/tests/**` instead matches a
+ # directory named `tests` at ANY depth under that absolute path
+ # (same for the examples/docs exclusions below). No such directory
+ # exists under `src/` today, so this does not exclude production
+ # code as a side effect.
+ # Supplying `ignore-globs` at all replaces the DevSkim action's own
+ # defaults (`**/.git/**,**/bin/**`) instead of adding to them, so
+ # those two are repeated explicitly below to keep `.git/` and
+ # `bin/` out of the scan.
+ ignore-globs: '**/tests/**,**/examples/**,**/docs/**,**/node_modules/**,**/.git/**,**/bin/**'
# Exclude rules that produce false positives in this codebase:
#
diff --git a/tests/ci/test_devskim_workflow.py b/tests/ci/test_devskim_workflow.py
new file mode 100644
index 0000000000..b263999e83
--- /dev/null
+++ b/tests/ci/test_devskim_workflow.py
@@ -0,0 +1,55 @@
+"""Contracts for repository-local DevSkim scan scope."""
+
+from pathlib import Path
+
+import yaml
+
+
+REPO_ROOT = Path(__file__).resolve().parents[2]
+WORKFLOW = REPO_ROOT / ".github" / "workflows" / "devskim.yml"
+
+
+def _devskim_action_step() -> dict:
+ workflow = yaml.safe_load(WORKFLOW.read_text(encoding="utf-8"))
+ steps = workflow["jobs"]["devskim-scan"]["steps"]
+ return next(
+ step
+ for step in steps
+ if str(step.get("uses", "")).startswith("microsoft/DevSkim-Action@")
+ )
+
+
+def test_repository_directory_ignores_match_absolute_scan_target():
+ """The action passes an absolute workspace path to DevSkim.
+
+ Root-relative globs such as ``tests/**`` do not match that target and let
+ test-only TLS, certificate, token, and eval fixtures reach code scanning.
+
+ Supplying ``ignore-globs`` at all also replaces the DevSkim action's own
+ defaults (``**/.git/**,**/bin/**``) instead of adding to them, so those
+ two are repeated in the configured list. This test catches a revert that
+ either drops the ``**/`` prefix from the repository-directory globs, or
+ drops the repeated ``**/.git/**``/``**/bin/**`` defaults.
+ """
+ raw_globs = _devskim_action_step()["with"]["ignore-globs"]
+ globs = {glob.strip() for glob in raw_globs.split(",")}
+
+ assert {
+ "**/tests/**",
+ "**/examples/**",
+ "**/docs/**",
+ "**/node_modules/**",
+ "**/.git/**",
+ "**/bin/**",
+ } <= globs
+ assert (
+ not {
+ "tests/**",
+ "examples/**",
+ "docs/**",
+ "node_modules/**",
+ ".git/**",
+ "bin/**",
+ }
+ & globs
+ )