T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:119
- Finding
- Ambiguous comma parsing can silently corrupt clinical measurements<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 119-130 **Vulnerability Type**: Ambiguous numeric parsing and fail-open data handling **Risk Level**: Medium ### Vulnerable Code ```python # Handle European decimals (comma as decimal separator) # In this dataset, comma is used as decimal separator, not thousands if ',' in s: s = s.replace(',', '.') # Parse as float try: return float(s) except ValueError: return np.nan ``` ### Technical Analysis The parser unconditionally interprets every comma as a decimal separator, even though the Skill also claims to handle values containing thousands separators. This creates two failure modes: - A value such as `1,234` is parsed as `1.234`, changing its magnitude by a factor of 1,000. - A value such as `1,234.5` becomes `1.234.5`, fails parsing, and is silently converted to `NaN`. Returning `NaN` without raising an error, preserving the original value, or recording a validation event makes the corruption difficult to detect. The result can subsequently be treated as missing data or omitted from downstream analysis. ### Attack Path 1. A clinical data source supplies a value containing a comma, such as `1,234` or `1,234.5`. 2. `parse_value` replaces every comma with a period. 3. The value is either interpreted at the wrong magnitude or becomes syntactically invalid. 4. Invalid values are silently replaced with `NaN`. 5. The corrupted or missing value propagates into unit conversion, record filtering, research datasets, or analytical models without an explicit failure. An attacker able to influence imported laboratory values could deliberately use ambiguous separators to cause selected values to be altered or discarded. ### Impact Assessment This issue does not grant operating-system privileges, code execution, or access to additional resources. Its impact is limited to the integrity and availability of data processed according to the Skill. Potential consequences include: - Si ...[truncated 206 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Require explicit source-locale or schema metadata instead of inferring separator meaning from the string alone. - Use a locale-aware numeric parser with separately configured decimal and grouping separators. - Reject values containing both comma and period unless their format matches a known source convention. - Do not silently convert parsing failures to `NaN`; emit a validation error containing the row, column, original value, and source. - Preserve the original unmodified value in an audit column. - Add tests for at least `1,234`, `1,234.5`, `12,34`, `1.234,5`, scientific notation, whitespace, and malformed input. ]]>
