-
Notifications
You must be signed in to change notification settings - Fork 36
Add NameSpace Enum #749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add NameSpace Enum #749
Conversation
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
…orce it Valid = str in enum OR str.startswith("x_")
Modify Namespace information and examples as wel..
Matching x_custom/extension as examples for schema docs.
sei-vsarvepalli
approved these changes
Mar 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated some of the examples and description field.
This was referenced Mar 20, 2025
ahouseholder
added a commit
that referenced
this pull request
Mar 26, 2025
…rsion of schema is available. (#760) * Convert cwes list to markdown with fewer rows and columns (#737) * Update verbiage because we have a list of CWE-IDs per issue 529. * Clean CWE-IDs list to only exploit_possible=yes, eliminate need for side scrolling, add hyperlinks, and create a markdown version of the csv per issues 530 and 713. * markdown lint * Fix broken link to cwe examples and remove cwe csvs file to enforce a single source of truth. * Make the linkchecker happy * Really fix links this time * Replace `Track*`/`Track *` with `Monitor` in CISA-based decision model (#738) * change type hints on OutcomeGroup class * black reformat * replace `Track *` with `Monitor` * carve a new version of CISA OutcomeGroup to reflect `Track *` -> `Monitor` * replace `Track*` with `Monitor` in json * replace CISA.json with Monitor outcome value * more substitutions * Revert "Replace `Track*`/`Track *` with `Monitor` in CISA-based decision mode…" (#741) This reverts commit a54f999. * Bump markdown-exec from 1.10.0 to 1.10.1 (#746) Bumps [markdown-exec](https://github.com/pawamoy/markdown-exec) from 1.10.0 to 1.10.1. - [Release notes](https://github.com/pawamoy/markdown-exec/releases) - [Changelog](https://github.com/pawamoy/markdown-exec/blob/main/CHANGELOG.md) - [Commits](pawamoy/markdown-exec@1.10.0...1.10.1) --- updated-dependencies: - dependency-name: markdown-exec dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump the mkdocs group with 6 updates (#747) Bumps the mkdocs group with 6 updates: | Package | From | To | | --- | --- | --- | | [mkdocs-bibtex](https://github.com/shyamd/mkdocs-bibtex) | `4.2.2` | `4.2.3` | | [mkdocs-include-markdown-plugin](https://github.com/mondeja/mkdocs-include-markdown-plugin) | `7.1.4` | `7.1.5` | | [mkdocs-material](https://github.com/squidfunk/mkdocs-material) | `9.6.7` | `9.6.9` | | [mkdocstrings](https://github.com/mkdocstrings/mkdocstrings) | `0.28.2` | `0.29.0` | | [mkdocstrings-python](https://github.com/mkdocstrings/python) | `1.16.2` | `1.16.5` | | [mkdocs-print-site-plugin](https://github.com/timvink/mkdocs-print-site-plugin) | `2.6.0` | `2.7.1` | Updates `mkdocs-bibtex` from 4.2.2 to 4.2.3 - [Release notes](https://github.com/shyamd/mkdocs-bibtex/releases) - [Commits](shyamd/mkdocs-bibtex@v4.2.2...v4.2.3) Updates `mkdocs-include-markdown-plugin` from 7.1.4 to 7.1.5 - [Release notes](https://github.com/mondeja/mkdocs-include-markdown-plugin/releases) - [Commits](mondeja/mkdocs-include-markdown-plugin@v7.1.4...v7.1.5) Updates `mkdocs-material` from 9.6.7 to 9.6.9 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](squidfunk/mkdocs-material@9.6.7...9.6.9) Updates `mkdocstrings` from 0.28.2 to 0.29.0 - [Release notes](https://github.com/mkdocstrings/mkdocstrings/releases) - [Changelog](https://github.com/mkdocstrings/mkdocstrings/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/mkdocstrings@0.28.2...0.29.0) Updates `mkdocstrings-python` from 1.16.2 to 1.16.5 - [Release notes](https://github.com/mkdocstrings/python/releases) - [Changelog](https://github.com/mkdocstrings/python/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/python@1.16.2...1.16.5) Updates `mkdocs-print-site-plugin` from 2.6.0 to 2.7.1 - [Release notes](https://github.com/timvink/mkdocs-print-site-plugin/releases) - [Commits](timvink/mkdocs-print-site-plugin@v2.6.0...v2.7.1) --- updated-dependencies: - dependency-name: mkdocs-bibtex dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mkdocs - dependency-name: mkdocs-include-markdown-plugin dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mkdocs - dependency-name: mkdocs-material dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mkdocs - dependency-name: mkdocstrings dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mkdocs - dependency-name: mkdocstrings-python dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mkdocs - dependency-name: mkdocs-print-site-plugin dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mkdocs ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * add `mdlint_fix` target to Makefile (#744) * pin changed-files action to specific sha1 (#750) * Add NameSpace Enum (#749) * add a namespace Enum along with a pydantic dataclass validator to enforce it Valid = str in enum OR str.startswith("x_") * add validator to _Namespaced mixin class * refactor base classes to use NameSpace enum values * add optional "x_" prefix as valid namespace pattern * update unit tests * add docstrings * bump python test version to 3.12 * update the regex pattern for namespaces, add validation to pydantic field * refactor namespace validation methods * add unit tests * simplify regex to avoid inefficiencies * add length requirements to namespace patterns and fields * refactor regex again * add docstrings * add docs, update docstrings * Update Decision_Point-1-0-1.schema.json Modify Namespace information and examples as wel.. * Update Decision_Point-1-0-1.schema.json Matching x_custom/extension as examples for schema docs. * we shouldn't mention nciss yet as it's still a draft PR * missed an nciss --------- Co-authored-by: Vijay Sarvepalli <[email protected]> * Refactor SsvcDecisionPoint base class mixins (#743) * create a `_Valued` mixin * add `_Valued` mixin to base decision point class. Also reorder mixins to adjust default json output key order * update json examples to reflect new base class mixin ordering * add len() to _Valued mixin * add tests * Bump tj-actions/changed-files from 46.0.1 to 46.0.3 (#757) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 46.0.1 to 46.0.3. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](tj-actions/changed-files@2f7c5bf...823fceb) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump markdown-exec from 1.10.1 to 1.10.2 (#756) Bumps [markdown-exec](https://github.com/pawamoy/markdown-exec) from 1.10.1 to 1.10.2. - [Release notes](https://github.com/pawamoy/markdown-exec/releases) - [Changelog](https://github.com/pawamoy/markdown-exec/blob/main/CHANGELOG.md) - [Commits](pawamoy/markdown-exec@1.10.1...1.10.2) --- updated-dependencies: - dependency-name: markdown-exec dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump mkdocstrings-python from 1.16.5 to 1.16.8 in the mkdocs group (#755) Bumps the mkdocs group with 1 update: [mkdocstrings-python](https://github.com/mkdocstrings/python). Updates `mkdocstrings-python` from 1.16.5 to 1.16.8 - [Release notes](https://github.com/mkdocstrings/python/releases) - [Changelog](https://github.com/mkdocstrings/python/blob/main/CHANGELOG.md) - [Commits](mkdocstrings/python@1.16.5...1.16.8) --- updated-dependencies: - dependency-name: mkdocstrings-python dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mkdocs ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Allen D. Householder <[email protected]> Co-authored-by: sei-renae <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 PR adds a
NameSpace
string enumeration that will define the "official" valid namespaces for SSVC objects. Currently that is just "ssvc" and "cvss", but, for example, #707 would be another candidate to add one.It also addresses this comment in #703, which asks:
by including validation support for both: specific namespace strings in the enum, and any string starting with
x_
.This is not a complete fix for #703, however, as there is also a request in this other comment to include a url of the JSON list. At the moment, that's bigger than I can bite off, but I wanted to at least get started on the enumeration aspects in this PR.
We should decide when we go to merge this whether we want to keep #703 open or close it with this PR and leave the url request comment behind as a separate issue to extend it. If we keep #703 open, we should spawn sub-issues from it so that we can record the fact that this PR partially addressed it.
Copilot Summary
This pull request includes several changes focused on updating the namespace validation and handling in the SSVC project. The most important changes include updating the Python version in the GitHub workflow, modifying the namespace pattern in the schema, adding new documentation, updating the codebase to use the new namespace validation, and adding comprehensive tests for namespaces.
Updates to Python version:
.github/workflows/python-app.yml
: Updated the Python version from 3.10 to 3.12.Namespace pattern and validation:
data/schema/v1/Decision_Point-1-0-1.schema.json
: Modified the namespace pattern to allow more flexible and longer namespace strings.src/ssvc/namespaces.py
: Added a new module defining official namespaces and providing a method to validate namespace values.src/ssvc/_mixins.py
: Updated the_Namespaced
class to enforce the new namespace pattern and added avalidate_namespace
method.Documentation updates:
docs/reference/code/index.md
: Added a new entry for namespaces.docs/reference/code/namespaces.md
: Created a new documentation file for SSVC namespaces.mkdocs.yml
: Updated the navigation to include the new namespaces documentation.Codebase updates:
src/ssvc/decision_points/base.py
: Updated theSsvcDecisionPoint
class to use the newNameSpace
enum.src/ssvc/decision_points/cvss/base.py
: Updated theCvssDecisionPoint
class to use the newNameSpace
enum.Tests for namespaces:
src/test/test_mixins.py
: Added new tests to validate namespace creation and errors. [1] [2]src/test/test_namespaces.py
: Created a new test file to ensure the namespace pattern and validation work correctly.