Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ All notable changes to SkillEvaluator are documented in this file.

### Fixed

- The Tier 1 PII scan no longer stalls on a long identifier before an IPv4-shaped value. A line with a
30-letter name followed by `= "8.8.0.8"` took about a minute to scan, and every further letter doubled that.
- Keep Steps per Eval Case chart labels readable for long case IDs while preserving full IDs in hover tooltips.
- Negative controls with complete, confirmed skill non-use report wrong answers as task outcomes instead of recommending skill edits; truncated or recovered attempt evidence cannot establish complete non-use.
- Repeated negative-case task outcomes share one advice item, retain task-failure wording and avoid describing passing attempts as lost, keeping distinct skill fixes visible.
Expand Down
10 changes: 7 additions & 3 deletions src/skillevaluator/validators/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -6110,13 +6110,17 @@ def _is_personal_home_path(self, match: re.Match, protected_usernames: set[str])
)
# Match version/tag as identifier tokens, including separator and camel-case styles.
# Plain substrings such as ``conversion`` and ``staging`` are not version labels.
# The camel-case words around the label are written as one run each
# (``[A-Z][A-Za-z0-9]*``), not as a repeated word group: a repeated group can
# split a run of letters in exponentially many ways, and a long identifier
# before an IPv4-shaped value then stalls the scan.
_VERSION_LABEL_PATTERN = re.compile(
r"(?:"
r"(?i:(?<![a-z0-9])(?:[a-z0-9]+[_-])*(?:versions?|tags?)(?:[_-][a-z0-9]+)*(?![a-z0-9]))"
r"|(?<![A-Za-z0-9])(?:[A-Za-z][a-z0-9]*)*(?:Version|Versions|Tag|Tags)"
r"(?:[A-Z][A-Za-z0-9]*)*(?![A-Za-z0-9])"
r"|(?<![A-Za-z0-9])(?:[A-Za-z][A-Za-z0-9]*)?(?:Version|Versions|Tag|Tags)"
Comment thread
chrisknvidia marked this conversation as resolved.
Resolved
r"(?:[A-Z][A-Za-z0-9]*)?(?![A-Za-z0-9])"
r"|(?<![A-Za-z0-9])(?:version|versions|tag|tags)"
r"(?:[A-Z][A-Za-z0-9]*)+(?![A-Za-z0-9])"
r"[A-Z][A-Za-z0-9]*(?![A-Za-z0-9])"
r")"
)
_PACKAGE_VERSION_CALL_PATTERN = re.compile(
Expand Down
34 changes: 34 additions & 0 deletions tests/validators/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -8613,6 +8613,40 @@ def test_separate_explicit_version_labels_stay_non_pii(self, tmp_path: Path) ->

assert not any(finding.check_name == "ip_addresses" for finding in result.findings)

def test_long_identifiers_before_ip_values_do_not_stall_the_scan(self, tmp_path: Path) -> None:
"""Regression (CWE-1333): the version-label pattern could split a run of letters in exponentially many
ways, so a 30-letter identifier before an IPv4-shaped value stalled the PII scan for about a minute and
every further letter doubled that. Runs in a subprocess so that a slow scan fails the timeout instead of
hanging the suite; the limit is generous because the scan takes about a second."""
Comment on lines +8616 to +8620

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Incomplete local contribution gates

The PR records that make test and make build were not run. The contribution gate requires both locally; focused validator tests leave that requirement incomplete.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

skill_dir = tmp_path / "long-identifier-skill"
skill_dir.mkdir()
not_labels = ["a" * 76, "A" * 76, "aB" * 38, "a1" * 38]
labels = ["a" * 69 + "Version", "version" + "A" * 69, "Tag" + "Ab1" * 24, "a" * 60 + "_version"]
(skill_dir / "SKILL.md").write_text(
"".join(f'{name} = "8.8.0.{index}"\n' for index, name in enumerate(not_labels, 1))
+ "".join(f'{name} = "4.4.0.{index}"\n' for index, name in enumerate(labels, 1)),
encoding="utf-8",
)
# Keep the child on this checkout even if its interpreter has another editable install.
code = (
"import json, sys\n"
f"sys.path.insert(0, {str(Path(__file__).resolve().parents[2] / 'src')!r})\n"
"from pathlib import Path\n"
"from skillevaluator.validators.security import SecurityValidator\n"
"result = SecurityValidator().validate_pii_only(Path(sys.argv[1]))\n"
"found = {f.metadata.get('matched_value') for f in result.findings if f.check_name == 'ip_addresses'}\n"
"print(json.dumps(sorted(found)))\n"
)

completed = subprocess.run(
[sys.executable, "-c", code, str(skill_dir)], capture_output=True, text=True, timeout=60
)

assert completed.returncode == 0, completed.stderr
# The long plain identifiers are not version labels, so their values are still reported;
# the long labels still mark theirs as release versions.
assert json.loads(completed.stdout) == ["8.8.0.1", "8.8.0.2", "8.8.0.3", "8.8.0.4"]

@pytest.mark.parametrize(
"line",
[
Expand Down
Loading