CycloneDX / CycloneDX/specification

[2.0]: dont use character classes in patterns

Open
#988 0 comments 0 reactions 1 assignee Claimed by @jkowalleck View on GitHub
CDX 2.0 chore defect
Dominant language
XSLT
Stars
547
Forks
93
Avg merge
7h 11m
Merged PRs (30d)
37

Description

per https://json-schema.org/understanding-json-schema/reference/regular_expressions
> Use only standard escapes like `\n`, `\r`, `\t` and keep in mind that you also need to do JSON escaping.

we already do this here
- https://github.com/CycloneDX/specification/blob/2a860677bc58cc9accd7c8810eee1b4f29ce3343/schema/2.0/model/cyclonedx-common-2.0.schema.json#L23
- https://github.com/CycloneDX/specification/blob/2a860677bc58cc9accd7c8810eee1b4f29ce3343/schema/2.0/model/cyclonedx-common-2.0.schema.json#L31
- https://github.com/CycloneDX/specification/blob/2a860677bc58cc9accd7c8810eee1b4f29ce3343/schema/2.0/model/cyclonedx-common-2.0.schema.json#L94
- https://github.com/CycloneDX/specification/blob/2a860677bc58cc9accd7c8810eee1b4f29ce3343/schema/2.0/model/cyclonedx-common-2.0.schema.json#L770

---

so character classes are not universal - some regex engines just dont support them.
we should take care of this , and use the custom character classes in these cases.
like `[0-9]` for `\d`

things to fix:
- https://github.com/CycloneDX/specification/pull/678#discussion_r3677227543
- https://github.com/CycloneDX/specification/blob/2a860677bc58cc9accd7c8810eee1b4f29ce3343/schema/2.0/model/cyclonedx-common-2.0.schema.json#L495
- to be contiinued

## tooling

have a QA tool that asserts that only those common/standard regex patterns are used

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.