Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Initial replacement for Java UUID function. #642

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
96 changes: 49 additions & 47 deletions src/validations/rules/sample-ssp.xsl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
exclude-result-prefixes="xs math uuid expath oscal"
exclude-result-prefixes="xs math r expath oscal"
expand-text="true"
version="3.0"
xmlns:expath="http://expath.org/ns/binary"
xmlns:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:oscal="http://csrc.nist.gov/ns/oscal/1.0"
xmlns:r="http://csrc.nist.gov/ns/random"
xmlns:saxon="http://saxon.sf.net/"
xmlns:uuid="java.util.UUID"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://csrc.nist.gov/ns/oscal/1.0">
Expand All @@ -28,6 +28,8 @@
name="insert-diagrams"
required="false"
select="false()" />

<xsl:import href="https://raw.githubusercontent.com/usnistgov/OSCAL/develop/src/utils/util/resolver-pipeline/random-util.xsl"/>

<xsl:mode
on-no-match="fail" />
Expand All @@ -52,12 +54,12 @@
<xsl:variable
as="xs:string"
name="user-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="component-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string*"
Expand All @@ -74,47 +76,47 @@
<xsl:variable
as="xs:string"
name="this-system-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="leveraged-authorization-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="leveraged-authorization-party-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="authorization-boundary-diagram-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="authorization-boundary-diagram-resource-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="network-architecture-diagram-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="network-architecture-diagram-resource-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="data-flow-diagram-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="xs:string"
name="data-flow-diagram-resource-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<xsl:variable
as="node()*"
Expand All @@ -123,10 +125,10 @@
select="//control[matches(@id, '-1$')]">
<uuid
id="{@id}"
pol-c="{uuid:randomUUID()}"
pol-r="{uuid:randomUUID()}"
pro-c="{uuid:randomUUID()}"
pro-r="{uuid:randomUUID()}" />
pol-c="{r:make-uuid(generate-id())}"
pol-r="{r:make-uuid(generate-id())}"
pro-c="{r:make-uuid(generate-id())}"
pro-r="{r:make-uuid(generate-id())}" />
</xsl:for-each>
</xsl:variable>

Expand Down Expand Up @@ -162,7 +164,7 @@


<system-security-plan
uuid="{uuid:randomUUID()}"
uuid="{r:make-uuid(generate-id())}"
xmlns="http://csrc.nist.gov/ns/oscal/1.0">

<xsl:call-template
Expand Down Expand Up @@ -195,7 +197,7 @@
<xsl:variable
as="xs:string"
name="FedRAMP-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />

<metadata
xmlns="http://csrc.nist.gov/ns/oscal/1.0">
Expand Down Expand Up @@ -298,7 +300,7 @@
<xsl:variable
as="xs:string"
name="location-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<location
uuid="{$location-uuid}">
<address>
Expand Down Expand Up @@ -332,7 +334,7 @@
<xsl:variable
as="xs:string"
name="csp-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="organization"
uuid="{$csp-uuid}">
Expand All @@ -353,7 +355,7 @@
<xsl:variable
as="xs:string"
name="ISO-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$ISO-uuid}">
Expand All @@ -369,7 +371,7 @@
<xsl:variable
as="xs:string"
name="AO-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$AO-uuid}">
Expand All @@ -385,7 +387,7 @@
<xsl:variable
as="xs:string"
name="ISMPoC-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$ISMPoC-uuid}">
Expand All @@ -401,7 +403,7 @@
<xsl:variable
as="xs:string"
name="ISTPoC-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$ISTPoC-uuid}">
Expand All @@ -417,7 +419,7 @@
<xsl:variable
as="xs:string"
name="ISOPoC-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$ISOPoC-uuid}">
Expand All @@ -433,7 +435,7 @@
<xsl:variable
as="xs:string"
name="ISSO-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$ISSO-uuid}">
Expand All @@ -449,7 +451,7 @@
<xsl:variable
as="xs:string"
name="AOPoC-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$AOPoC-uuid}">
Expand All @@ -465,7 +467,7 @@
<xsl:variable
as="xs:string"
name="irrr-uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<party
type="person"
uuid="{$irrr-uuid}">
Expand Down Expand Up @@ -638,7 +640,7 @@

<xsl:comment>See DRAFT Guide to OSCAL-based FedRAMP System Security Plans §4.3</xsl:comment>
<information-type
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<xsl:choose>
<xsl:when
test="matches(base-uri(), 'LOW')">
Expand Down Expand Up @@ -888,7 +890,7 @@
<xsl:comment>See DRAFT Guide to OSCAL-based FedRAMP System Security Plans §4.15</xsl:comment>
<component
type="leveraged-system"
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<title>Name of leveraged FedRAMP package</title>
<description>
<p>Description of leveraged FedRAMP package</p>
Expand Down Expand Up @@ -923,7 +925,7 @@

<component
type="DNS-authoritative-service"
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<title>Authoritative DNS service</title>
<description>
<p>Authoritative DNS service for the following zones.</p>
Expand Down Expand Up @@ -1014,7 +1016,7 @@
select="//control">
<implemented-requirement
control-id="{@id}"
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<xsl:comment> Control title: {title} </xsl:comment>
<xsl:variable
as="xs:integer"
Expand Down Expand Up @@ -1395,7 +1397,7 @@

<xsl:comment>User Guide</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<title>User Guide</title>
<prop
name="type"
Expand All @@ -1412,7 +1414,7 @@

<xsl:comment>Privacy Impact Assessment</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="privacy-impact-assessment" />
Expand All @@ -1428,7 +1430,7 @@

<xsl:comment>Rules of Behavior</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="rules-of-behavior" />
Expand All @@ -1444,7 +1446,7 @@

<xsl:comment>Information System Contingency Plan</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="information-system-contingency-plan" />
Expand All @@ -1460,7 +1462,7 @@

<xsl:comment>Configuration Management Plan</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="configuration-management-plan" />
Expand All @@ -1476,7 +1478,7 @@

<xsl:comment>Incident Response Plan</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="incident-response-plan" />
Expand All @@ -1492,7 +1494,7 @@

<xsl:comment>CIS Workbook</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="CIS-workbook" />
Expand All @@ -1508,7 +1510,7 @@

<xsl:comment>Inventory</xsl:comment>
<resource
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<prop
name="type"
value="inventory" />
Expand All @@ -1530,11 +1532,11 @@
match="part[@name = 'statement']">
<statement
statement-id="{@id}"
uuid="{uuid:randomUUID()}"
uuid="{r:make-uuid(generate-id())}"
xmlns="http://csrc.nist.gov/ns/oscal/1.0">
<by-component
component-uuid="{$this-system-uuid}"
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<xsl:apply-templates
select="p" />
</by-component>
Expand All @@ -1549,11 +1551,11 @@
test="p">
<statement
statement-id="{@id}"
uuid="{uuid:randomUUID()}"
uuid="{r:make-uuid(generate-id())}"
xmlns="http://csrc.nist.gov/ns/oscal/1.0">
<by-component
component-uuid="{$this-system-uuid}"
uuid="{uuid:randomUUID()}">
uuid="{r:make-uuid(generate-id())}">
<xsl:apply-templates
select="p" />
</by-component>
Expand Down Expand Up @@ -1615,7 +1617,7 @@
namespace="http://csrc.nist.gov/ns/oscal/1.0">
<xsl:attribute
name="uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<xsl:attribute
name="component-uuid"
select="$pp-uuid[@id = current()/@id]/@pol-c" />
Expand All @@ -1635,7 +1637,7 @@
namespace="http://csrc.nist.gov/ns/oscal/1.0">
<xsl:attribute
name="uuid"
select="uuid:randomUUID()" />
select="r:make-uuid(generate-id())" />
<xsl:attribute
name="component-uuid"
select="$pp-uuid[@id = current()/@id]/@pro-c" />
Expand Down