Merged
Conversation
…ERN_STR everywhere to make life easier
* 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..
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 stringNS_PATTERN_STRwithre.match, instead of the compiled regex objectNS_PATTERN, for improved clarity and consistency. [1] [2]src/ssvc/utils/field_specs.py: Updated imports to useNS_PATTERN_STRinstead ofNS_PATTERNfor 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 thepatternproperty 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]