Skip to content

Harden enum-value-formatting meta:enum handling#821

Open
Mehrn0ush wants to merge 1 commit intoCycloneDX:2.0-devfrom
Mehrn0ush:fix/linter-meta-enum-policy
Open

Harden enum-value-formatting meta:enum handling#821
Mehrn0ush wants to merge 1 commit intoCycloneDX:2.0-devfrom
Mehrn0ush:fix/linter-meta-enum-policy

Conversation

@Mehrn0ush
Copy link
Contributor

Harden enum-value-formatting check

Fixes #820

Summary

Harden meta:enum handling to be deterministic and safe: use own-property checks, require meta:enum to be a plain object (emit explicit error when invalid), fix coverage to check key presence (not truthiness), improve meta:enum paths, and de-duplicate enum value issues. No API/config changes.

Changes

  • Detect meta:enum via Object.prototype.hasOwnProperty.call(parent, 'meta:enum') (no prototype-chain lookup).
  • Validate meta:enum is a plain object; emit one ERROR when invalid type.
  • Coverage: use own-key presence (hasOwnProperty) on meta:enum (no truthiness false-positives, no inherited keys).
  • Report “missing description” at the meta:enum path; fix extra-keys path derivation.
  • Iterate over unique enum string values to avoid duplicate issues.

Use own-property checks and require meta:enum to be a plain object.
Fix coverage check to test key presence, improve meta:enum paths,
and de-duplicate enum value issues. Fixes CycloneDX#820.

Signed-off-by: Mehrn0ush <mehrnoush.vaseghi@gmail.com>
@Mehrn0ush Mehrn0ush requested a review from a team as a code owner February 14, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant