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

handle base64 filename and media type constraints #681

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions features/fedramp_extensions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Examples:
| interconnection-security-PASS.yaml |
| privilege-level-FAIL.yaml |
| privilege-level-PASS.yaml |
| resource-base64-available-filename-FAIL.yaml |
| resource-base64-available-filename-PASS.yaml |
| resource-base64-available-media-type-FAIL.yaml |
| resource-base64-available-media-type-PASS.yaml |
| resource-has-base64-or-rlink-FAIL.yaml |
| resource-has-base64-or-rlink-PASS.yaml |
| resource-has-title-FAIL.yaml |
Expand Down Expand Up @@ -89,6 +93,8 @@ Examples:
| interconnection-security |
| privilege-level |
| prop-response-point-has-cardinality-one |
| resource-base64-available-filename |
| resource-base64-available-media-type |
| resource-has-base64-or-rlink |
| resource-has-title |
| scan-type |
Expand Down
1 change: 1 addition & 0 deletions src/validations/constraints/content/ssp-all-INVALID.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
</description>
<prop name="type" value="unsupported-type" ns="https://fedramp.gov/ns/oscal"/>
<!-- There is no <rlink/> to purposefully to trigger an error for negative testing. -->
<base64>eyJhd2Vzb21lIjoic2F1Y2UifQ==</base64>
</resource>
</back-matter>
</system-security-plan>
16 changes: 16 additions & 0 deletions src/validations/constraints/content/ssp-all-VALID.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,21 @@
<prop name="type" value="policy" ns="https://fedramp.gov/ns/oscal"/>
<rlink href="https://example.com/policies/access-control.pdf"/>
</resource>
<resource uuid="eeeeeeee-0000-4000-9000-00000000000e">
<title>Access Control Policy</title>
<description>
<p>Detailed access control policy document</p>
</description>
<prop name="type" value="policy" ns="https://fedramp.gov/ns/oscal"/>
<rlink href="https://example.com/policies/access-control.pdf"/>
</resource>
<resource uuid="ffffffff-0000-4000-9000-00000000000f">
<title>System Diagram</title>
<description>
<p>High-level diagram of the system architecture</p>
</description>
<prop name="type" value="diagram" ns="https://fedramp.gov/ns/oscal"/>
<base64 filename="sauce.json" media-type="application/json">eyJhd2Vzb21lIjoic2F1Y2UifQ==</base64>
</resource>
</back-matter>
</system-security-plan>
19 changes: 19 additions & 0 deletions src/validations/constraints/fedramp-external-constraints.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,23 @@
</expect>
</constraints>
</context>


<context>
<metapath target="//back-matter/resource"/>
<constraints>
<expect id="resource-base64-available-filename"
target="base64"
test="@filename"
level="WARNING">
<message>This base64 lacks a filename attribute.</message>
</expect>
<expect id="resource-base64-available-media-type"
target="base64"
test="@media-type"
level="WARNING">
<message>This base64 lacks a media-type attribute.</message>
</expect>
</constraints>
</context>
</metaschema-meta-constraints>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Negative Test for resource-base64-available-filename
description: >-
This test case validates the behavior of constraint
resource-base64-available-filename
content: ../content/ssp-all-INVALID.xml
expectations:
- constraint-id: resource-base64-available-filename
result: fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Positive Test for resource-base64-available-filename
description: >-
This test case validates the behavior of constraint
resource-base64-available-filename
content: ../content/ssp-all-VALID.xml
expectations:
- constraint-id: resource-base64-available-filename
result: pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Negative Test for resource-base64-available-media-type
description: >-
This test case validates the behavior of constraint
resource-base64-available-media-type
content: ../content/ssp-all-INVALID.xml
expectations:
- constraint-id: resource-base64-available-media-type
result: fail
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
test-case:
name: Positive Test for resource-base64-available-media-type
description: >-
This test case validates the behavior of constraint
resource-base64-available-media-type
content: ../content/ssp-all-VALID.xml
expectations:
- constraint-id: resource-base64-available-media-type
result: pass
Loading