fix(data): replace malformed git-hash version rules with real versions - #606
fix(data): replace malformed git-hash version rules with real versions#606donglige wants to merge 3 commits into
Conversation
|
Thanks @donglige — this is an important data-quality fix: 116 dead rules (git-hash versions silently falling back to
Once #1 is normalized, this is good to merge. |
|
Thanks @boy-hack for the careful review! All three points addressed in the latest commit ( 1. Date versions normalized to dotted form ✅
All now match the openclaw dotted-date convention so 2. fastgpt 3. yamlcheck compile break ✅ (fixed in this PR, commit
Full verification after the changes:
Happy to adjust anything else. |
116 advisory rules use git commit hashes (or "git <hash>") as version
expressions, e.g.:
rule: version < "f31768e20e5c6b4f6da0ef657877298b359936cf"
versionCheck() strips all letters, turning these into either whitespace-
prefixed strings (" 26813") or oversized integers that overflow int64
("317682056460657877298359936"). Before the parser fix in Tencent#602 this
caused a hard panic on scan; after Tencent#602 they silently never match
(fallback to 0.0.0), so the rules are effectively dead and the vuln
never reported.
This change replaces every such rule with the real fixing version
extracted from the advisory details / summary / NVD CPE data:
- openwebui: 0.5.7 ... 0.9.6 (from "fixed in" in details)
- openclaw: 2026.5.12 ... 2026.6.5 (date versions from summary)
- flyto2: 2.26.6
- hermes: 0.51.788
- kubeflow: 2023-12-13 (NVD CPE endExcl)
- fastchat: 2024-09-23 / 2024-10-05 (NVD CPE date versions)
- Chuanhugpt: 2024-09-19 / 2024-09-25 / 2024-12-04 (NVD CPE)
- gradio en: version <= "0.6.12" (align with zh, drop npm @scope)
- fastgpt: workflow supply-chain issue, no version mapping possible;
set rule: "" (knowledge-only, same as agent-config-disclosure)
Note: cmd/yamlcheck fails to compile on current main
(vulstruct.Info has no field Name; yamlcheck main.go:121 references
vul.Info.Name) - pre-existing, unrelated to this change. Validation was
done with a Python YAML parser + go-version emulation instead.
Verified: 0 malformed rules remain; all 116 modified files parse as
valid YAML; go test ./pkg/vulstruct ./common/fingerprints/parser pass.
Two issues broke the Validate YAML files CI job on current main: 1. cmd/yamlcheck/main.go:121 referenced vul.Info.Name, but vulstruct.Info names its field FingerPrintName (yaml:"name"). The file failed to compile, failing go test ./cmd/yamlcheck and blocking every PR. 2. isValidSeverity only accepted English labels (low/medium/high/critical), but the rule libraries also use Chinese labels (低/中/中等/高/中危/高危/ 严重/危急), "UNKNOWN", and empty string (e.g. supply-chain advisories without CVSS). 59 rules failed validation. Fix: use vul.Info.FingerPrintName, extend isValidSeverity to accept the Chinese/unknown/empty labels, and add TestIsValidSeverity. Verified: go test ./cmd/yamlcheck pass; yamlcheck over data/vuln + data/vuln_en: 4028 files, all passed.
Review feedback from maintainer: 1. Hyphenated dates (2024-09-19) are treated by hashicorp/go-version as pre-release separators, so "2024-09-19" parses as 2024.0.0-09.19 which orders below 2024.0.0 and can invert the < comparison against a detected dotted-date version. Normalize to dotted form: - fastchat: 2024.10.05 / 2024.09.23 - Chuanhugpt: 2024.12.04 / 2024.09.25 / 2024.09.19 - kubeflow: 2023.12.13 matching the openclaw convention. 2. Add one-line comments to fastgpt rule: "" entries explaining they are knowledge-only (GitHub Actions supply-chain issue, no version mapping) so a future maintainer doesn't revert them to a git hash.
16501f5 to
e1108e0
Compare
|
Thanks @donglige for the thorough follow-up — all four points are now closed:
The 116 previously-dead rules are now real fixing versions and the canonical validation path is unblocked for every future PR. This is good to merge from a review standpoint — I will leave the actual merge to a maintainer. Nice work. |
Summary
Replaces 116 malformed version rules across the rule library. These rules use git commit hashes (or
"git <hash>"strings) as version expressions, e.g.:Why this matters
versionCheck()(synax.go) strips all letters from the version string, which turns commit hashes into either:"git 2c68a13"→" 26813") → panic before fix(parser): prevent panic on malformed advisory version rules #602317682056460657877298359936) → panic before fix(parser): prevent panic on malformed advisory version rules #602After the parser hardening in #602, these no longer panic but silently fall back to 0.0.0, so the rules never match — the vulnerability is never reported. They were effectively dead rules.
Fix
Each rule now uses the real fixing version, extracted from advisory details / summary / NVD CPE data:
rule: ""— workflow supply-chain issue, no version mapping possible (knowledge-only, same pattern asAI-Agent-Config/agent-config-disclosure.yaml)<= "0.6.12"— drop npm@scope, align with zhAlso updates the stale
security_advisetext where it still pointed at the old commit hash (openclaw, openwebui).Verification
go test ./pkg/vulstruct ./common/fingerprints/parserpasscmd/yamlcheckfails to compile on current main —vulstruct.Infohas noNamefield butyamlcheck/main.go:121referencesvul.Info.Name. This is pre-existing on main (not caused by this PR); I validated with a Python YAML parser + version emulation instead.Files changed
116 files, +116 / -116 — every change is a single-line
rule:replacement.