Skip to content
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

Require (Warn) port start and end when protocol is specified. #1674

Conversation

Compton-US
Copy link
Contributor

@Compton-US Compton-US commented Feb 28, 2023

Committer Notes

See #1521 for detail.

Add WARNING constraints for the port-range assembly when there are issues with the port start and end.
(Assuming this prevents breaking change, but if that's not true, let me know what level it should be.)

This covers:

  • Port range start and end not specified.
  • Port range start specified without an end.
  • Port range end specified without a start.
  • Port range end is less than the start.

All Submissions:

By submitting a pull request, you are agreeing to provide this contribution under the CC0 1.0 Universal public domain dedication.

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you included examples of how to use your new feature(s)?
  • Have you updated all OSCAL website and readme documentation affected by the changes you made? Changes to the OSCAL website can be made in the docs/content directory of your branch.

@aj-stein-nist aj-stein-nist requested a review from a team February 28, 2023 19:09
Copy link
Contributor

@wendellpiez wendellpiez left a comment

Choose a reason for hiding this comment

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

So ... the remarks state the expectation is that the value be an integer greater than zero. The tests, however, only check for the existence of the attribute not its lexical form. As given, the warning will not be emitted for start='there'.

For this to align, we could test whether each value is an integer, as well as checking its value (to prohibit negatives), as well as @end >= @start.

As given the patch is an improvement over silence but does not express the rule fully, either.

@aj-stein-nist
Copy link
Contributor

So ... the remarks state the expectation is that the value be an integer greater than zero. The tests, however, only check for the existence of the attribute not its lexical form. As given, the warning will not be emitted for start='there'.

For this to align, we could test whether each value is an integer, as well as checking its value (to prohibit negatives), as well as @end >= @start.

As given the patch is an improvement over silence but does not express the rule fully, either.

Wait, I want to make sure I understand based on the existing schema (in the same file but not modified in this PR): we do not check this "at a lower layer" in XSD with type enforcement and a nonNegativeInteger?

<define-flag name="end" as-type="nonNegativeInteger">
<formal-name>End</formal-name>
<description>Indicates the ending port number in a port range</description>
<remarks>
<p>Should be a number within a permitted range</p>
</remarks>
</define-flag>

@wendellpiez
Copy link
Contributor

No we do not. However, these could be expressed directly as constraints. Indeed that is the point. To check them in XSD requires XSD+Schematron, not implemented everywhere. To check them in unextended JSON Schema is not possible today TMK. Hence we decided to rely on the constraints layer, which presumably will have implementations on both XML and object-notation sides.

This is an awesome example of the use case for constraints. We have two flags each of which follows 'semantic' rules only partially explained in lexical terms. We also see a requirement that they be conditioned on one another (end must be after start).

No one has asked yet that multiple port ranges not be permitted to overlap. That will be a 'doozy' is I think the technical term.

@aj-stein-nist
Copy link
Contributor

No we do not. However, these could be expressed directly as constraints. Indeed that is the point. To check them in XSD requires XSD+Schematron, not implemented everywhere. To check them in unextended JSON Schema is not possible today TMK. Hence we decided to rely on the constraints layer, which presumably will have implementations on both XML and object-notation sides.

This is an awesome example of the use case for constraints. We have two flags each of which follows 'semantic' rules only partially explained in lexical terms. We also see a requirement that they be conditioned on one another (end must be after start).

No one has asked yet that multiple port ranges not be permitted to overlap. That will be a 'doozy' is I think the technical term.

I checked the XML Schema validation and the non-negative integer checking and enforcement appears to do what we need to cover this at a separate layer, distinct from the constraints. I am happy to accept the PR after testing that. start="there" will fail as will other values like "0" or negative number gotchas we discussed like "--10000.00".

image

As for the port-range and overlap concerns, those are valid, but I am not sure that is something we understand the subject domain (from personal experience, that could be acceptable or non-acceptable depending on the protocols in question and/or the system, let alone the assessor). This is a good start, and we can always go further with considering or definitively answering these questions when community members bring them up.

@aj-stein-nist aj-stein-nist merged commit 20e5221 into usnistgov:develop Mar 1, 2023
@wendellpiez
Copy link
Contributor

@aj-stein-nist @Compton-NIST nice job!

@aj-stein-nist before publication, enhancements such as this should probably be road-tested, to confirm the dev's testing (in this case Chris's). The unit tests I showed you yesterday could actually be adapted for that, or it would be the same idea.

aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Jun 29, 2023
…gov#1674)

* Require (Warn) port start and end when protocol is specified. usnistgov#1521

* Fix less than/equal entity in test. usnistgov#1521
aj-stein-nist pushed a commit to aj-stein-nist/OSCAL-forked that referenced this pull request Jul 10, 2023
…gov#1674)

* Require (Warn) port start and end when protocol is specified. usnistgov#1521

* Fix less than/equal entity in test. usnistgov#1521
@aj-stein-nist aj-stein-nist added this to the v1.1.0 milestone Jul 27, 2023
aj-stein-nist pushed a commit to galtm/OSCAL that referenced this pull request Sep 28, 2023
…gov#1674)

* Require (Warn) port start and end when protocol is specified. usnistgov#1521

* Fix less than/equal entity in test. usnistgov#1521
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Protocol assemblies can be defined in SSPs empty without port-ranges
3 participants