Skip to content

Date regex not updated to fixed (v1.04) version in json schema, or in main branch #1703

@fsuits

Description

@fsuits

Describe the bug

OSCAL v1.0.4 included a fix to the regex for dates but the json schema for catalog and possibly others does not parse all dates properly. The regex in the json schema does not appear to have ever changed from v1.0.0

The fix is described in the changelog for v1.0.4 which refers to the bug report #1260

The regex appears twice around line 900 in the catalog schema for published and last-modified
https://github.com/usnistgov/OSCAL/blob/v1.0.4/json/schema/oscal_catalog_schema.json

If you compare the regex near line 900 for published or last-modified it does not appear to have changed in v1.0.4 or main branch.

Who is the bug affecting

Developers who rely on the json schema and users of code based on that schema

What is affected by this bug

OSCAL Content

How do we replicate this issue

See the regex pattern near line 900 of https://github.com/usnistgov/OSCAL/blob/v1.0.4/json/schema/oscal_catalog_schema.json

^((2000|2400|2800|(19|2[0-9](0[48]|[2468][048]|[13579][26])))-02-29)|(((19|2[0-9])[0-9]{2})-02-(0[1-9]|1[0-9]|2[0-8]))|(((19|2[0-9])[0-9]{2})-(0[13578]|10|12)-(0[1-9]|[12][0-9]|3[01]))|(((19|2[0-9])[0-9]{2})-(0[469]|11)-(0[1-9]|[12][0-9]|30))T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\.[0-9]+)?(Z|[+-][0-9]{2}:[0-9]{2})$

See that the regex will only parse the date part of 2022-05-03T02:00:00Z

But it will parse the entire date/time for 2022-06-03T02:00:00Z

using a parser such as https://www.debuggex.com/

Expected behavior (i.e. solution)

The regex should be updated from v1.0.0 in the json schema so it parses all valid date/time strings properly.

Other comments

No response

Metadata

Metadata

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions