T09 · Insecure Skill Coding Practices
- Location
scripts/analyze_msq.py:211- Finding
Reversed AFR Safety Classification Can Produce Hazardous Tune Assessments
- Content
View full analysis
16.0: suggestions.append(f"ℹ️ AFR target reaches {max_afr:.1f}:1 - verify this is intentional (may be for decel)") ``` ### Technical Analysis For conventional gasoline air-fuel ratio values, a lower AFR number represents a richer mixture, while a higher number represents a leaner mixture. The analyzer reverses this relationship by describing AFR values below 10 or 11 as “lean.” The complementary check for AFR values above 16 is only recorded as an informational suggestion. Consequently, genuinely lean targets may not receive a warning of severity appropriate to the risk. A separate WOT heuristic may detect some unsafe targets, but it assumes that the bottom-right corner of the table represents high-load operation and does not reliably associate AFR values with their RPM and load axes. This is safety-critical validation logic: the analyzer is explicitly presented as suitable for reviewing a tune before engine startup or high-load testing. Incorrect classification may cause a user to misunderstand the direction of the fueling error. ### Attack Path 1. A user supplies an `.msq` file containing extremely rich or lean AFR target cells. 2. `parse_msq()` reads the AFR table and passes it to `analyze_afr_targets()`. 3. The function classifies very low AFR values as lean and treats globally high AFR values primarily as informational. 4. The generated report gives the user an incorrect or understated diagnosis. 5. The user relies on that report and changes the fuel map in the wrong direction, or proceed ...[truncated 1150 chars]- Remediation
View remediation
