Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(tier1): keep authored eval files in the Gitleaks secret scan (#552)
Narendran Raghavana3d316db8539
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ac3f6ee8..6e9df00c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -541,6 +541,14 @@ All notable changes to SkillEvaluator are documented in this file.`/bin/bash -lc 'cat skills/x/SKILL.md'`, which some agent harnesses recordinstead of the bare command. Searches inside a wrapper (`bash -c 'grep SKILLconfig.json'`) are still not counted.+- The Tier 1 Gitleaks secret scan now reads authored eval files, including+ `evals/evals.json`, graders such as `evals/grader.py`, and `evals/files`+ inputs, so a credential committed there is reported. Generated Tier 3 output+ in `evals/results` is still skipped, and so is every file under a `tests/`,+ `examples/`, `fixtures/`, or `mocks/` folder, or the singular form, such as+ a Harbor task grader in `evals/harbor/<case>/tests/`. To keep an intentional test token, add a+ `gitleaks:allow` comment on its line or list the finding in a+ `.gitleaksignore` file at the skill root.- Tier 3 reads the native Codex wrapper that runs a literal command arraythrough `.map`, so a skill read batched that way is graded instead of scoringas an unsupported wrapper. The decoder stays a bounded static one: every arraydiff --git a/docs/reports.mdx b/docs/reports.mdxindex 9d885702..d13dcea1 100644--- a/docs/reports.mdx+++ b/docs/reports.mdx@@ -384,13 +384,18 @@ are treated according to the host filesystem, while a case-distinct authoredname on a case-sensitive filesystem remains covered. A same-named file belowanother authored directory is still included. Tier 3 runtime projection andfull `--copy-repo` staging omit the same generated inputs so excluded generated-bytes inside the target cannot affect evaluation evidence. Tier 1 and Tier 2-skip the generated-artifact names (`results`, `versions`, `evals`, their dot-variants, `BENCHMARK.md`, `skill-card.md`, and `skill.oms.sig`) at any depth.-When one of those names appears below the target root, the digest would certify-content that no scan read, so the Tier 1 run records the path and publication-stays `INCOMPLETE` until it is renamed. The root `evals/` directory holds Tier 3-inputs and is outside the Tier 1 scans by design.+bytes inside the target cannot affect evaluation evidence. The Tier 1+file-walk checks and Tier 2 skip the generated-artifact names (`results`,+`versions`, `evals`, their dot variants, `BENCHMARK.md`, `skill-card.md`, and+`skill.oms.sig`) at any depth. When one of those names appears below the target+root, the digest would certify content that those checks never read, so the+Tier 1 run records the path and publication stays `INCOMPLETE` until it is+renamed. The root `evals/` directory holds Tier 3 inputs. The Tier 1 file-walk+checks skip it by design, while the Gitleaks secret scan and SkillSpector read+its authored files. Both still skip generated output such as `evals/results`.+Gitleaks also skips every file under a `tests/`, `examples/`, `fixtures/`, or+`mocks/` folder, or the singular form, such as a Harbor task grader in+`evals/harbor/<case>/tests/`.Split-job results must match this identity exactly. Tier 3 runs that stage anylinked/full repository context or external reference/workspace skills, or taskinputs and custom environments that carry `.git`, `.venv`, `__pycache__`, ordiff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex 68f0fb20..30e25c48 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -429,7 +429,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `liceCombines three validation groups:- **Code risk (Bandit and Semgrep)** — SQL or command injection, hardcoded passwords, insecure cryptography, unsafe deserialization, `shell=True`, `eval()`/`exec()`, CWE patterns, and language-specific anti-patterns.- - **Secrets (Gitleaks)** — API keys, tokens, passwords, private keys, database credentials, and other high-confidence secret patterns.+ - **Secrets (Gitleaks)** — API keys, tokens, passwords, private keys, database credentials, and other high-confidence secret patterns. Authored eval files, including `evals/evals.json`, graders such as `evals/grader.py`, and `evals/files` inputs, are scanned too. Generated Tier 3 output in `evals/results` is skipped. Files under a folder named `tests`, `examples`, `fixtures`, or `mocks`, or the singular form, are skipped at any depth, including the Harbor task graders in `evals/harbor/<case>/tests/`, so a secret there is not reported. To keep an intentional test token, add a `gitleaks:allow` comment on its line or list the finding in a `.gitleaksignore` file at the skill root.- **Hygiene** — dead relative Markdown links, banned or unpinned dependency declarations, and static discovery of conventional Python test filenames.Default Tier 1 does not import or execute target-controlled Python code. The `test_discovery` result is filename evidence only: it counts regular, in-tree, non-symlink `test_*.py` and `*_test.py` candidates without parsing or importing them. It reports `execution_performed=false` and `coverage_measured=false`; test success and code coverage must be established separately in a trusted project environment or an explicit sandbox.diff --git a/src/skillevaluator/plugin_member_paths.py b/src/skillevaluator/plugin_member_paths.pyindex a30bc074..c5fcbfb4 100644--- a/src/skillevaluator/plugin_member_paths.py+++ b/src/skillevaluator/plugin_member_paths.py@@ -202,7 +202,8 @@ def _unscanned_skill_finding(reader: PluginRootReader, manifest_rel: PurePosixPaThe skill sits deep in an ``evals/``, ``results/``, or ``versions/`` folderinside a skill of the declared folder (a skill's own evaluation output or- snapshots, which the whole-tree security, secret, and Unicode scans prune).+ snapshots, which the plugin source snapshot drops before the whole-tree+ security, secret, and Unicode scans run).Codex searches the folder recursively and loads it. Every client viewreports it with the same text, so the merged inventory keeps one finding."""diff --git a/src/skillevaluator/publication_identity.py b/src/skillevaluator/publication_identity.pyindex cd090bc4..054a08c9 100644--- a/src/skillevaluator/publication_identity.py+++ b/src/skillevaluator/publication_identity.py@@ -227,12 +227,14 @@ def publication_paths_skipped_by_scan() -> list[str]:"""Return digest-covered paths that a name-based producer scan skips.- Tier 1 and Tier 2 skip generated-artifact names (``results``, ``versions``,- ``evals``, ``BENCHMARK.md``, ...) at any depth, while the v2 digest and the- Tier 3 projection exclude most of them only at the target root. A deeper- entry with such a name is therefore certified and agent-visible but never- scanned. The root ``evals/`` directory holds Tier 3 inputs and is outside- the producer scans by design, so it is not reported.+ The Tier 1 file-walk checks and Tier 2 skip generated-artifact names+ (``results``, ``versions``, ``evals``, ``BENCHMARK.md``, ...) at any depth,+ while the v2 digest and the Tier 3 projection exclude most of them only at+ the target root. A deeper entry with such a name is therefore certified and+ agent-visible but never read by those checks. The root ``evals/``+ directory holds Tier 3 inputs that the file-walk scans skip by design, so+ it is not reported. The Gitleaks secret scan and SkillSpector still read+ its authored files."""root = _absolute_lexical(source.expanduser())try:diff --git a/src/skillevaluator/validators/secrets.py b/src/skillevaluator/validators/secrets.pyindex bb6bb645..6ecac65c 100644--- a/src/skillevaluator/validators/secrets.py+++ b/src/skillevaluator/validators/secrets.py@@ -23,6 +23,14 @@ from skillevaluator.utils.tool_runner import ()from skillevaluator.validators.base import Finding, ValidationResult, ValidatorBase+# Directory names Gitleaks skips at any depth. Unlike the file-walk scans, it+# keeps ``evals/`` in scope because evals.json, graders and task inputs there+# are authored and covered by the publication digest. ``.evals/`` stays in+# scope too, as it does for SkillSpector, although the digest leaves out a+# root ``.evals/``. Generated output below either, such as+# ``evals/results/``, still matches the ``results`` entry.+_GITLEAKS_EXCLUDED_DIRS = SCAN_EXCLUDED_DIRS - {"evals", ".evals"}+class SecretsValidator(ValidatorBase):"""Scan for hardcoded secrets using Gitleaks.@@ -182,15 +190,20 @@ tags = ["nvidia", "api-key"]def _create_gitleaks_config(self) -> Path:"""Create Gitleaks config with NVIDIA rules and allowlists.- Tier 1 artifact dirs (evals/, results/, versions/, ...) hold Tier 3- output snapshots that routinely carry harvested test credentials;+ Generated output dirs (results/, versions/ and their dot forms) hold+ Tier 3 output snapshots that routinely carry harvested test+ credentials, and dependency or cache dirs are not skill content;gitleaks has to skip them via config since it takes no exclude flag.+ Authored ``evals/`` files stay in scope; ``evals/results/`` is skipped+ by the ``results`` entry.Test/example/fixture/mock skips are directory path components, notsubstrings. ``(.*)?test(.*)?`` would also skip ``latest`` and``attestation``."""- artifact_paths = "\n".join(f" '''(^|/){re.escape(name)}(/|$)'''," for name in sorted(SCAN_EXCLUDED_DIRS))+ artifact_paths = "\n".join(+ f" '''(^|/){re.escape(name)}(/|$)'''," for name in sorted(_GITLEAKS_EXCLUDED_DIRS)+ )config = f"""[extend]useDefault = truediff --git a/tests/validators/test_artifact_dir_exclusion.py b/tests/validators/test_artifact_dir_exclusion.pyindex 9045720b..a4cbd488 100644--- a/tests/validators/test_artifact_dir_exclusion.py+++ b/tests/validators/test_artifact_dir_exclusion.py@@ -8,7 +8,8 @@ A skill that has been through Tier 3 accumulates hundreds of MB under(``iter_scannable_files`` pruning), never hand them to scanners that lackexclude flags (skillspector scans a filtered copy), and never reportfindings from them (gitleaks config allowlist, skillspector issue filter).-SkillSpector retains authored evals/ inputs while pruning their results/.+Gitleaks and SkillSpector retain authored evals/ inputs while pruning their+results/.Regression source: a real skill dir with 798MB / 53k artifact files took~25 minutes to validate and reported 270 artifact-only secret findings."""@@ -24,7 +25,7 @@ from unittest.mock import patchimport pytestfrom skillevaluator.constants import SCAN_EXCLUDED_DIRS-from skillevaluator.utils.tool_runner import ToolResult, Tools+from skillevaluator.utils.tool_runner import GITLEAKS_FINDINGS_EXIT_CODE, ToolResult, Toolsfrom skillevaluator.validators.base import iter_scannable_filesfrom skillevaluator.validators.secrets import SecretsValidatorfrom skillevaluator.validators.security import SecurityValidator@@ -348,18 +349,135 @@ class TestSkillspectorFilteredCopy:# =============================================================================+# Gitleaks keeps eval definition dirs in scope: evals/ holds authored+# evals.json, graders and task inputs, and .evals/ is scanned the same way, as+# SkillSpector scans it. Only generated output below them is skipped.+_AUTHORED_EVAL_DIRS = frozenset({"evals", ".evals"})+++def _gitleaks_allowlist_paths() -> list[str]:+ config_path = SecretsValidator()._create_gitleaks_config()+ try:+ return tomllib.loads(config_path.read_text(encoding="utf-8"))["allowlist"]["paths"]+ finally:+ config_path.unlink(missing_ok=True)+++def _gitleaks_honoring_config(args: list[str], cwd: Path | None = None, **_kwargs) -> ToolResult:+ """Stand in for ``gitleaks detect --no-git``: apply the generated config to *cwd*.++ Only the config's path allowlist and its ``nvidia-api-key`` rule are+ modeled, which is enough to show which files the real scan would read.+ """+ assert cwd is not None and args[args.index("--source") + 1] == "."+ config = tomllib.loads(Path(args[args.index("--config") + 1]).read_text(encoding="utf-8"))+ skipped_paths = [re.compile(pattern) for pattern in config["allowlist"]["paths"]]+ rule = next(rule for rule in config["rules"] if rule["id"] == "nvidia-api-key")+ secret = re.compile(rule["regex"])+ findings = []+ for path in sorted(Path(cwd).rglob("*")):+ relative = path.relative_to(cwd).as_posix()+ if not path.is_file() or any(pattern.search(relative) for pattern in skipped_paths):+ continue+ for line_number, line in enumerate(path.read_text(encoding="utf-8").splitlines(), start=1):+ if secret.search(line):+ findings.append(+ {+ "RuleID": rule["id"],+ "Description": rule["description"],+ "File": relative,+ "StartLine": line_number,+ "Tags": rule["tags"],+ }+ )+ if not findings:+ return ToolResult(success=True, stdout="[]", stderr="", exit_code=0)+ return ToolResult(success=True, stdout=json.dumps(findings), stderr="", exit_code=GITLEAKS_FINDINGS_EXIT_CODE)+++def _write_files(root: Path, files: dict[str, str]) -> None:+ for relative, text in files.items():+ path = root.joinpath(*relative.split("/"))+ path.parent.mkdir(parents=True, exist_ok=True)+ path.write_text(text, encoding="utf-8")++class TestGitleaksArtifactExclusion:- def test_config_allowlists_artifact_dir_paths(self):- config_path = SecretsValidator()._create_gitleaks_config()- try:- config = tomllib.loads(config_path.read_text())- finally:- config_path.unlink(missing_ok=True)+ def test_config_allowlists_generated_dirs_but_not_authored_evals(self):+ paths = _gitleaks_allowlist_paths()- paths = config["allowlist"]["paths"]- for name in SCAN_EXCLUDED_DIRS:+ for name in SCAN_EXCLUDED_DIRS - _AUTHORED_EVAL_DIRS:pattern = f"(^|/){re.escape(name)}(/|$)"assert pattern in paths, f"gitleaks allowlist missing artifact dir {name!r}"+ for name in _AUTHORED_EVAL_DIRS:+ pattern = f"(^|/){re.escape(name)}(/|$)"+ assert pattern not in paths, f"gitleaks allowlist skips authored eval dir {name!r}"++ @pytest.mark.parametrize(+ ("relative", "skipped"),+ [+ ("evals/evals.json", False),+ ("evals/grader.py", False),+ ("evals/graders/check.py", False),+ ("evals/files/input.txt", False),+ ("evals/environment/mcp_servers.toml", False),+ (".evals/evals.json", False),+ ("skills/inner/evals/grader.py", False),+ ("evals/harbor/case-001/instruction.md", False),+ ("evals/results/run1/out.json", True),+ ("evals/.results/run1/out.json", True),+ (".evals/results/run1/out.json", True),+ ("evals/versions/v1/grader.py", True),+ ("results/run1/out.json", True),+ ("evals/tests/test_grader.py", True),+ ("evals/harbor/case-001/tests/grader.py", True),+ ],+ )+ def test_authored_eval_files_are_scanned_and_generated_output_is_skipped(self, relative, skipped):+ compiled = [re.compile(pattern) for pattern in _gitleaks_allowlist_paths()]++ assert any(pattern.search(relative) for pattern in compiled) is skipped++ @patch.object(Tools.gitleaks, "_path", "/usr/bin/gitleaks")+ @patch.object(Tools.gitleaks, "_version", "8.30.0")+ @patch.object(Tools.gitleaks, "run", side_effect=_gitleaks_honoring_config)+ def test_secret_in_authored_evals_is_reported_but_not_in_eval_results(self, _mock_run, tmp_path):+ token = "nvapi-" + "A1" * 25+ skill = tmp_path / "eval-skill"+ files = {+ "SKILL.md": "---\nname: eval-skill\n---\n",+ "evals/evals.json": json.dumps({"evals": [{"id": 1, "prompt": f"Call the API with {token}"}]}),+ "evals/grader.py": f'API_KEY = "{token}"\n',+ "evals/results/run1/out.json": json.dumps({"stdout": token}),+ }+ _write_files(skill, files)++ result = SecretsValidator().validate(skill)++ assert sorted(finding.file_path for finding in result.findings) == ["evals/evals.json", "evals/grader.py"]+ assert all(finding.category == "SECRET" for finding in result.findings)+ assert result.status == "failed"++ @patch.object(Tools.gitleaks, "_path", "/usr/bin/gitleaks")+ @patch.object(Tools.gitleaks, "_version", "8.30.0")+ @patch.object(Tools.gitleaks, "run", side_effect=_gitleaks_honoring_config)+ def test_plugin_skill_eval_files_are_scanned_per_skill(self, _mock_run, tmp_path):+ token = "nvapi-" + "B2" * 25+ plugin = tmp_path / "demo-plugin"+ _write_files(+ plugin,+ {+ ".claude-plugin/plugin.json": json.dumps({"name": "demo"}),+ "skills/x/SKILL.md": "---\nname: x\n---\n",+ "skills/x/evals/grader.py": f'API_KEY = "{token}"\n',+ "skills/x/evals/results/run1/out.json": json.dumps({"stdout": token}),+ },+ )++ result = SecretsValidator().validate(plugin)++ assert [finding.file_path for finding in result.findings] == ["[x] evals/grader.py"]+ assert result.status == "failed"class TestGitleaksTestPathAllowlist: