Skip to content

sector-tyre: negative CO2e value and unvalidated tyreClass pass through, unlike sibling plugins #34

Description

@LKSNDRTMLKV

Static read-through audit of plugins/sector-tyre. Two verified findings, both gaps that sibling plugins already close correctly.

1. Negative CO2e value contradicts the plugin's own schema

Location: src/lib.rs:62-67
Issue: co2ePerTyreKg is never validated (no rule in validate_input); num() only filters for finite, not sign. The plugin's own schema (crates/dpp-domain/schemas/tyre/v1.0.0.json:56-59) declares "minimum": 0. Sibling plugins sector-battery and sector-steel both validate their analogous field with require_non_negative.
Failure scenario: co2ePerTyreKg: -50.0 passes validation and is surfaced as a negative METRIC_CO2E_SCORE — internally contradicting the plugin's own schema.

2. tyreClass isn't checked against its declared enum

Location: src/lib.rs:54
Issue: tyreClass uses require_str (non-empty only), not require_enum, despite the module doc and schema both declaring it must be one of ["C1","C2","C3"]. Adjacent fields fuelEfficiencyClass/wetGripClass correctly use require_enum one line away.
Failure scenario: tyreClass: "garbage" passes validation, and generate_passport clones it verbatim into the outgoing passport — a category value that doesn't correspond to any EU tyre class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomplianceRegulatory/compliance correctness issue

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions