Skip to content

fix: enisa-csirt-inventory meta_template uppercase country codes - #229

Open
DocArmoryTech wants to merge 1 commit into
cerebrate-project:developfrom
DocArmoryTech:fix/enisa-iso3166-code-case
Open

fix: enisa-csirt-inventory meta_template uppercase country codes#229
DocArmoryTech wants to merge 1 commit into
cerebrate-project:developfrom
DocArmoryTech:fix/enisa-iso3166-code-case

Conversation

@DocArmoryTech

Copy link
Copy Markdown
Contributor

The ISO 3166-1 Code field rejects the uppercase form that the standard actually specifies.

{ "field": "ISO 3166-1 Code", "type": "text", "regex": "[a-z]{2,3}" }

Applied as /^[a-z]{2,3}$/m.

pattern IE ie IRL
[a-z]{2,3} n y n
[A-Za-z]{2,3} y y y

ISO 3166-1 alpha-2 and alpha-3 codes are defined in uppercase, so the convention most operators type is the one that fails.

Changes

  • widen to [A-Za-z]{2,3}
  • bump version 3 → 4

[A-Za-z] rather than [A-Z] so that any lowercase values already stored stay valid.

The `ISO 3166-1 Code` regex was lowercase-only:

    "regex": "[a-z]{2,3}"

MetaFieldsTable::isValidRegex applies it as `/^[a-z]{2,3}$/m`, so the
uppercase form the standard actually specifies was rejected:

    [a-z]{2,3}     IE => false    ie => true
    [A-Za-z]{2,3}  IE => true     ie => true

ISO 3166-1 alpha-2 and alpha-3 codes are defined in uppercase, so the
convention most operators type was the one that failed.

Widened to `[A-Za-z]{2,3}` rather than `[A-Z]{2,3}` so any lowercase values
already stored remain valid.

Version bumped 3 -> 4.
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