add constraints for minimum length for option fields fixes 619#641
Open
add constraints for minimum length for option fields fixes 619#641
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds min=0 constraints to IntegerProperty fields in the WindowsPEOptionalHeaderType observable class, ensuring compliance with STIX 2.0 and 2.1 specifications that require certain properties to be non-negative.
Changes:
- Added
min=0constraint to size_of_heap_reserve and size_of_heap_commit in v21 - Added
min=0constraint to multiple size-related fields in v20 (size_of_code, size_of_initialized_data, size_of_uninitialized_data, size_of_image, size_of_headers, size_of_stack_reserve, size_of_stack_commit, size_of_heap_reserve, size_of_heap_commit)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| stix2/v21/observables.py | Adds min=0 constraint to size_of_heap_reserve and size_of_heap_commit, completing the set of non-negative constraints for WindowsPEOptionalHeaderType |
| stix2/v20/observables.py | Adds min=0 constraint to nine size-related fields, bringing v20 into alignment with v21 and STIX 2.0 specification requirements |
💡 Add Copilot custom instructions for smarter, more guided reviews. 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.
As described in issue #619 the tables for the Windows™ PE Optional Header Type observable define minimum length requirements for both STIX 2.0 and STIX 2.1.
This pull request fixes #619 and adds the min=0 constraint for each of the fields documented as "The value of this property MUST NOT be negative."