Skip to content

Conversation

@sei-vsarvepalli
Copy link
Contributor

@sei-vsarvepalli sei-vsarvepalli commented Sep 29, 2025

This is primarily to support CVE schema updates CVEProject/cve-schema#144 that will help us SSVC 2.0.0 to CVE-Schema program and CSAF program.

Copilot Summary

This pull request updates the namespace validation logic and corresponding JSON schema patterns to improve consistency and maintainability across the codebase. The main change is the switch from using a compiled regex object to using a regex string for namespace pattern validation, which is reflected both in Python code and in the schema definitions.

Namespace validation updates:

  • src/ssvc/namespaces.py: Changed namespace validation to use the regex string NS_PATTERN_STR with re.match, instead of the compiled regex object NS_PATTERN, for improved clarity and consistency. [1] [2]
  • src/ssvc/utils/field_specs.py: Updated imports to use NS_PATTERN_STR instead of NS_PATTERN for namespace field specifications.

Schema pattern updates:

  • data/schema/v2/DecisionTable_2_0_0.schema.json, data/schema/v2/DecisionPoint_2_0_0.schema.json, data/schema/v2/DecisionPointGroup_2_0_0.schema.json, data/schema/v2/SelectionList_2_0_0.schema.json, data/schema/v2/SsvcObjectRegistry_2_0_0.schema.json: Updated the pattern property for namespace validation to use a regex string that matches the new Python validation logic. This ensures consistency between code and schema validation. [1] [2] [3] [4] [5] [6] [7]

ahouseholder and others added 7 commits September 18, 2025 13:10
  * apply quickfix to make regualur expression more compatible
    with json schema. In unicode-aware mode single regular characters
    must not be quoted, so remove the quotes for `#`.

resolve #982
This fixes the regexp for the namespace that escapes hashes..
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Updates the namespace pattern validation to remove escaped hash symbols (from \\# to #) in regex patterns across the codebase. This aligns the namespace pattern with CVE schema updates to support SSVC 2.0.0 integration.

  • Refactored NS_PATTERN from compiled regex object to string pattern (NS_PATTERN_STR) for consistent usage
  • Updated all imports to use NS_PATTERN_STR instead of the compiled NS_PATTERN object
  • Modified sed command in pattern generation to handle hash symbol escaping properly

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/ssvc/utils/patterns.py Removes re import, updates sed command, converts NS_PATTERN to NS_PATTERN_STR, fixes hash escaping
src/ssvc/utils/field_specs.py Updates import and usage from NS_PATTERN to NS_PATTERN_STR
src/ssvc/namespaces.py Adds re import, updates to use NS_PATTERN_STR with manual regex compilation
src/test/test_selections.py Updates import and test assertion to use NS_PATTERN_STR
src/test/test_namespaces_pattern.py Updates import and test method to use NS_PATTERN_STR
src/test/test_namespaces.py Adds re import, updates tests to use NS_PATTERN_STR with manual regex operations
data/schema/v2/*.schema.json Updates JSON schema patterns to use unescaped hash symbols in regex patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ahouseholder ahouseholder marked this pull request as ready for review September 29, 2025 15:34
@ahouseholder ahouseholder changed the title Publish the namespace regex updated Publish SSVC v2025.9.1 Sep 29, 2025
@ahouseholder ahouseholder merged commit d121628 into publish Sep 29, 2025
8 of 9 checks passed
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.

4 participants