T09 · Insecure Skill Coding Practices
- Location
scripts/validate_audit.py:48- Finding
Untrusted Sources Can Be Self-Certified as Authoritative Evidence
- Content
View full analysis
bool: return isinstance(value, str) and value.startswith(("https://", "http://")) def validate_source(source: Any, label: str, errors: list[str]) -> None: if not isinstance(source, dict): errors.append(f"{label}: {bi('来源必须是对象', 'source must be an object')}") return if not is_http_url(source.get("url")): errors.append(f"{label}: {bi('source.url必须使用http(s)', 'source.url must be http(s)')}") if source.get("grade") not in ALLOWED_GRADES: errors.append(f"{label}: {bi('source.grade必须为A、B、C或D', 'source.grade must be A, B, C, or D')}") ``` The affected dual-license validation logic is: ```python if license_status == "yes-currently-verified": sources = agency.get("current_license_sources", []) official_sources = [source for source in sources if isinstance(source, dict) and source.get("grade") == "A"] if len(official_sources) < 2: errors.append(f"{label}: {bi('现行双证主张至少需要两个A级来源', 'a current dual-licence claim requires at least two Grade A sources')}") for source_index, source in enumerate(sources): validate_source(source, f"{label}.current_license_sources[{source_index}]", errors) ``` ### Technical Analysis The validator treats evidence grades as trusted input. A source is accepted when its URL begins with `http://` or `https://`, and its caller-supplied grade is one of `A`, `B`, `C`, or `D`. It does not establish that a source labeled Grade A belongs to a government authority, official registry, court, regulator, or another authoritative domain. For the particularly sensitive `yes-currently-verified` dual-license status, the validator only counts how many supplied source objects contain `"grade": "A"`. It does ...[truncated 2519 chars]- Remediation
View remediation
