Skip to content

sector-aluminium: unvalidated productionRoute falls through to the most permissive CO2e threshold #28

Description

@LKSNDRTMLKV

Static read-through audit of plugins/sector-aluminium. One verified finding.

1. Fail-open on the plugin's core compliance gate

Location: src/lib.rs:53, 65-70
Issue: validate_input uses require_str("productionRoute") (any non-empty string) instead of require_enum (available in the SDK and used elsewhere in this codebase). calculate_metrics's match falls through to a _ arm (12,000 kg CO2e/tonne) for any unrecognized value — a threshold higher than all three named routes, including the strictest (primary, 10,000). The inline comment // conservative default directly contradicts this: the default is the most permissive, not the most conservative.
Failure scenario: A shipment that is actually primary (Hall-Héroult) aluminium at 11,000 kg CO2e/tonne — genuinely non-compliant under the real primary threshold — is scored Compliant if productionRoute is anything other than the exact literal "primary" (wrong case, typo, or an unlisted route name). productionRoute is untrusted manufacturer-supplied data directly gating a CBAM/ESPR compliance verdict.

No other issues found — GTIN/country/percentage validation, error handling, and passthrough logic are all sound.

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