diff --git a/test/api/form-data-files/U_VPN_SRG-OTHER_V1R1_twoRules-matchingFingerprints.xml b/test/api/form-data-files/U_VPN_SRG-OTHER_V1R1_twoRules-matchingFingerprints.xml new file mode 100644 index 000000000..2ceeacbf7 --- /dev/null +++ b/test/api/form-data-files/U_VPN_SRG-OTHER_V1R1_twoRules-matchingFingerprints.xml @@ -0,0 +1,51 @@ +acceptedVirtual Private Network (VPN) Security Requirements Guide - replacedThis description replaces the old descriptionDISASTIG.DOD.MILRelease: 2 Benchmark Date: 19 Jul 20012 + +SRG-NET-000019-VPN-000040<GroupDescription></GroupDescription>SRG-NET-000019-VPN-000040This rule title has been replaced.<VulnDiscussion>Unrestricted traffic may contain malicious traffic which poses a threat to an enclave or to other connected networks. Additionally, unrestricted traffic may transit a network, which uses bandwidth and other resources. + +VPN traffic received from another enclave with different security policy or level of trust must not bypass be inspected by the firewall before being forwarded to the private network.</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>DPMS Target SRG-NET-VPNDISADPMS TargetSRG-NET-VPN3463CCI-001414Configure the VPN Gateway to ensure inbound and outbound traffic is configured with a security policy in compliance with information flow control policies (e.g., IPsec policy configuration). Also, configure the VPN gateway to forward encapsulated or encrypted traffic received from other enclaves with different security policies to the perimeter firewall and IDPS before traffic is passed to the private network.This check content has been replaced! + +SRG-NET-000019-VPN-000040<GroupDescription></GroupDescription>SRG-NET-000019-VPN-000040This rule title has been replaced.<VulnDiscussion>Unrestricted traffic may contain malicious traffic which poses a threat to an enclave or to other connected networks. Additionally, unrestricted traffic may transit a network, which uses bandwidth and other resources. + +VPN traffic received from another enclave with different security policy or level of trust must not bypass be inspected by the firewall before being forwarded to the private network.</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>DPMS Target SRG-NET-VPNDISADPMS TargetSRG-NET-VPN3463CCI-001414Configure the VPN Gateway to ensure inbound and outbound traffic is configured with a security policy in compliance with information flow control policies (e.g., IPsec policy configuration). Also, configure the VPN gateway to forward encapsulated or encrypted traffic received from other enclaves with different security policies to the perimeter firewall and IDPS before traffic is passed to the private network.This check content has been replaced! + +SRG-NET-000041-VPN-000110<GroupDescription></GroupDescription>SRG-NET-000041-VPN-000110The Remote Access VPN Gateway and/or client must display the Standard Mandatory DoD Notice and Consent Banner before granting remote access to the network.<VulnDiscussion>Display of a standardized and approved use notification before granting access to the network ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. + +In most VPN implementations, the banner is configured in the management backplane (NDM SRG) and serves as the presentation for the VPN client connection as well as for administrator logon to the device management tool/backplane. + +System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. This requirement applies to VPN gateways that have the concept of a user account and have the logon function residing on the VPN gateway. + +The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for VPN gateways that can accommodate banners of 1300 characters: + +"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. + +By using this IS (which includes any device attached to this IS), you consent to the following conditions: + +-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. + +-At any time, the USG may inspect and seize data stored on this IS. + +-Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. + +-This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. + +-Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details." + +Use the following verbiage for operating systems that have severe limitations on the number of characters that can be displayed in the banner: + +"I've read & consent to terms in IS user agreem't."</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>DPMS Target SRG-NET-VPNDISADPMS TargetSRG-NET-VPN3463CCI-000048Configure the Remote Access VPN to display the Standard Mandatory DoD Notice and Consent Banner in accordance with DoD policy before granting access to the device. Use the following verbiage for applications that can accommodate banners of 1300 characters: + +"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. + +By using this IS (which includes any device attached to this IS), you consent to the following conditions: +-The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. +-At any time, the USG may inspect and seize data stored on this IS. +-Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. +-This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. +-Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details." + +Use the following verbiage for operating systems that have severe limitations on the number of characters that can be displayed in the banner: +"I've read & consent to terms in IS user agreem't."Verify the VPN Gateway has an inbound and outbound traffic security policy which is in compliance with information flow control policies (e.g., IPsec policy configuration). + +Review network device configurations and topology diagrams. Verify encapsulated or encrypted traffic received from other enclaves with different security policies terminate at the perimeter for filtering and content inspection by a firewall and IDPS before gaining access to the private network. + +If the VPN Gateway does not ensure inbound and outbound traffic is configured with a security policy in compliance with information flow control policies, this is a finding. \ No newline at end of file diff --git a/test/api/postman_collection.json b/test/api/postman_collection.json index d715a0d3c..c00dd6867 100644 --- a/test/api/postman_collection.json +++ b/test/api/postman_collection.json @@ -60762,6 +60762,991 @@ } } ] + }, + { + "name": "Duplicate RuleIds/Rule Fingerprint", + "item": [ + { + "name": "Import and overwrite application data (as elevated Admin) Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"elevated\") { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 200 for elevated stigmanadmin user\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 403\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let response = pm.response.text();\r", + "console.log(response)\r", + "\r", + "pm.test(\"Body contains string\",() => {\r", + " pm.expect(response).to.include(\"Commit successful\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "accessToken", + "value": "{{token.stigmanadmin}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "importFile", + "type": "file", + "src": "./{{formDataFiles}}/{{appDataFile}}" + } + ] + }, + "url": { + "raw": "{{baseUrl}}/op/appdata?elevate=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "op", + "appdata" + ], + "query": [ + { + "key": "elevate", + "value": "true", + "description": "Elevate the user context for this request if user is permitted (canAdmin)" + } + ] + } + }, + "response": [] + }, + { + "name": "Import a new STIG - VPN (as admin) Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"stigmanadmin\") { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 200 only for stigmanadmin user\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 403\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "\r", + "let response = pm.response.text();\r", + "console.log(response)\r", + "\r", + "// pm.test(\"Body contains string\",() => {\r", + "// pm.expect(response).to.include(\"currentGroupRule\");\r", + "// });" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "accessToken", + "value": "{{token.stigmanadmin}}", + "type": "string" + }, + { + "key": "addTokenTo", + "value": "header", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "replace", + "value": "true", + "description": " (This can only be one of true,false)", + "type": "text" + }, + { + "key": "importFile", + "type": "file", + "src": "./{{formDataFiles}}/{{vpnStig-Rules-with-matching-fingerprints}}" + } + ] + }, + "url": { + "raw": "{{baseUrl}}/stigs?clobber=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "stigs" + ], + "query": [ + { + "key": "clobber", + "value": "true" + } + ] + } + }, + "response": [] + }, + { + "name": "PUT a STIG assignment to an Asset Copy 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"lvl1\" || user == \"lvl2\" || user == \"collectioncreator\" || user == \"globular\") { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 403 for all users except stigmanAdmin(elevated), lvl3 and lvl4\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let jsonData = pm.response.json();\r", + "\r", + "\r", + "pm.test(\"Response JSON is an array\", function () {\r", + " pm.expect(jsonData).to.be.an('array');\r", + " // pm.expect(jsonData).to.have.lengthOf.at.least(1);\r", + " // pm.expect(jsonData).to.have.lengthOf(1);\r", + "\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{baseUrl}}/assets/:assetId/stigs/:benchmarkId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "assets", + ":assetId", + "stigs", + ":benchmarkId" + ], + "query": [ + { + "key": "elevate", + "value": "{{elevated}}", + "description": "Elevate the user context for this request if user is permitted (canAdmin)", + "disabled": true + } + ], + "variable": [ + { + "key": "assetId", + "value": "{{testAsset}}", + "description": "(Required) A path parameter that indentifies an Asset" + }, + { + "key": "benchmarkId", + "value": "VPN_SRG_Rule-fingerprint-match-test", + "description": "(Required) A path parameter that indentifies a STIG" + } + ] + } + }, + "response": [] + }, + { + "name": "Import one or more Reviews with matching Rule Fingerprints", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if ( user == \"collectioncreator\" ) { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 403 for all users except stigmanAdmin(elevated), lvl3 and lvl4\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "let jsonData = pm.response.json();\r", + "const expectedResponse = {\r", + " rejected: [],\r", + " affected: {\r", + " updated: 0,\r", + " inserted: 2\r", + " }\r", + "}\r", + "\r", + "pm.test(\"Response matches request\", function () {\r", + " pm.expect(jsonData).to.eql(expectedResponse);\r", + "})\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[\n {\n \"ruleId\": \"SV-106179r1_xxxx\",\n \"result\": \"pass\",\n \"detail\": \"asfeee\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n },\n {\n \"ruleId\": \"SV-106179r1_zzzzzz\",\n \"result\": \"pass\",\n \"detail\": \"asfeee\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n },\n {\n \"ruleId\": \"SV-106181r1_xxxx\",\n \"result\": \"notapplicable\",\n \"detail\": \"asdfsef\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n }\n]" + }, + "url": { + "raw": "{{baseUrl}}/collections/:collectionId/reviews/:assetId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "collections", + ":collectionId", + "reviews", + ":assetId" + ], + "variable": [ + { + "key": "collectionId", + "value": "{{testCollection}}" + }, + { + "key": "assetId", + "value": "{{testAsset}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Return detailed metrics for the specified Collection - with params Copy", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"collectioncreator\" || user == \"bizarroLvl1\" ) {\r", + " pm.test(\"Status should be is 403 for user collectioncreator, bizarroLvl1\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let jsonData = pm.response.json();\r", + "\r", + "\r", + "pm.test(\"Response JSON is an array\", function () {\r", + " pm.expect(jsonData).to.be.an('array');\r", + "});\r", + "\r", + "\r", + "let testAsset = pm.environment.get(\"testAsset\");\r", + "let testBenchmark = \"VPN_SRG_Rule-fingerprint-match-test\"\r", + "let testLabel = pm.environment.get(\"testLabel\");\r", + "let testLabelName = pm.environment.get(\"testLabelName\");\r", + "\r", + "let testChecklistLength = 3;\r", + "\r", + "\r", + "\r", + "// pm.test(\"Check that proper assets are returned\", function () {\r", + " for (let item of jsonData){\r", + " console.log( \"testing: \" + item.name) \r", + "\r", + " let assetMatchString = pm.environment.get(\"assetMatchString\");\r", + " var regex = new RegExp(assetMatchString);\r", + " pm.test(\"Check that proper assets are returned: \" + assetMatchString, function () {\r", + " pm.expect(item.name).to.match(regex);\r", + " });\r", + "\r", + " if (pm.request.url.getQueryString().match(/benchmarkId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - benchmark\", function () {\r", + " pm.expect(item.benchmarkId).to.eql(testBenchmark);\r", + " })\r", + " }\r", + " if (pm.request.url.getQueryString().match(/assetId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - assetId\", function () {\r", + " pm.expect(item.assetId).to.eql(testAsset);\r", + " })\r", + " } \r", + "\r", + " if (pm.request.url.getQueryString().match(/labelId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - labelId\", function () {\r", + " let responseLabels = [];\r", + " for (let label of item.labels) {\r", + " responseLabels.push(label.labelId)\r", + " }\r", + " pm.expect(responseLabels).to.include(testLabel);\r", + " })\r", + " } \r", + "\r", + " if (pm.request.url.getQueryString().match(/labelName=/)) {\r", + " pm.test(\"verify parameter restricted response properly - labelName\", function () {\r", + " let responseLabels = [];\r", + " for (let label of item.labels) {\r", + " responseLabels.push(label.name)\r", + " }\r", + " pm.expect(responseLabels).to.include(testLabelName);\r", + " })\r", + " } \r", + "\r", + " if (item.assetId == testAsset && item.benchmarkId == testBenchmark) {\r", + " // if (item.assetId == testAsset ) {\r", + " console.log( \"found Collection_X_lvl1_asset\") \r", + "\r", + " pm.test(\"Check some stats - findings, low\", function () {\r", + " pm.expect(item.metrics.findings.low).to.equal(0);\r", + " });\r", + "\r", + " pm.test(\"Check some stats - results - NA\", function () {\r", + " pm.expect(item.metrics.results.notapplicable.total).to.equal(1);\r", + " }); \r", + " pm.test(\"Check some stats - results - pass\", function () {\r", + " pm.expect(item.metrics.results.pass.total).to.equal(2);\r", + " }); \r", + "\r", + " pm.test(\"Check some stats - results - fail\", function () {\r", + " pm.expect(item.metrics.results.fail.total).to.equal(0);\r", + " }); \r", + "\r", + " pm.test(\"Check some stats - status - submitted\", function () {\r", + " pm.expect(item.metrics.statuses.submitted.total).to.equal(0);\r", + " }); \r", + " pm.test(\"Check some stats - assessments\", function () {\r", + " pm.expect(item.metrics.assessments).to.equal(testChecklistLength);\r", + " }); \r", + " pm.test(\"Check some stats - assessed\", function () {\r", + " pm.expect(item.metrics.assessed).to.equal(3);\r", + " }); \r", + "\r", + " }\r", + " }\r", + " \r", + "\r", + "\r", + "\r", + " \r", + "\r", + " \r", + "// }\r", + "\r", + "return;\r", + "\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/collections/:collectionId/metrics/detail?benchmarkId=VPN_SRG_Rule-fingerprint-match-test&assetId={{testAsset}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "collections", + ":collectionId", + "metrics", + "detail" + ], + "query": [ + { + "key": "benchmarkId", + "value": "VPN_SRG_Rule-fingerprint-match-test" + }, + { + "key": "assetId", + "value": "{{testAsset}}" + }, + { + "key": "labelId", + "value": "{{testLabel}}", + "disabled": true + }, + { + "key": "labelName", + "value": "{{testLabelName-lvl1}}", + "disabled": true + } + ], + "variable": [ + { + "key": "collectionId", + "value": "{{testCollection}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Import and overwrite application data (as elevated Admin) Copy 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"elevated\") { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 200 for elevated stigmanadmin user\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 403\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let response = pm.response.text();\r", + "console.log(response)\r", + "\r", + "pm.test(\"Body contains string\",() => {\r", + " pm.expect(response).to.include(\"Commit successful\");\r", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "oauth2", + "oauth2": [ + { + "key": "accessToken", + "value": "{{token.stigmanadmin}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "multipart/form-data" + } + ], + "body": { + "mode": "formdata", + "formdata": [ + { + "key": "importFile", + "type": "file", + "src": "./{{formDataFiles}}/{{appDataFile}}" + } + ] + }, + "url": { + "raw": "{{baseUrl}}/op/appdata?elevate=true", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "op", + "appdata" + ], + "query": [ + { + "key": "elevate", + "value": "true", + "description": "Elevate the user context for this request if user is permitted (canAdmin)" + } + ] + } + }, + "response": [] + }, + { + "name": "PUT a STIG assignment to an Asset Copy 3", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"lvl1\" || user == \"lvl2\" || user == \"collectioncreator\" || user == \"globular\") { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 403 for all users except stigmanAdmin(elevated), lvl3 and lvl4\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let jsonData = pm.response.json();\r", + "\r", + "\r", + "pm.test(\"Response JSON is an array\", function () {\r", + " pm.expect(jsonData).to.be.an('array');\r", + " // pm.expect(jsonData).to.have.lengthOf.at.least(1);\r", + " // pm.expect(jsonData).to.have.lengthOf(1);\r", + "\r", + "});\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "PUT", + "header": [], + "url": { + "raw": "{{baseUrl}}/assets/:assetId/stigs/:benchmarkId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "assets", + ":assetId", + "stigs", + ":benchmarkId" + ], + "query": [ + { + "key": "elevate", + "value": "{{elevated}}", + "description": "Elevate the user context for this request if user is permitted (canAdmin)", + "disabled": true + } + ], + "variable": [ + { + "key": "assetId", + "value": "{{testAsset}}", + "description": "(Required) A path parameter that indentifies an Asset" + }, + { + "key": "benchmarkId", + "value": "VPN_SRG_Rule-fingerprint-match-test", + "description": "(Required) A path parameter that indentifies a STIG" + } + ] + } + }, + "response": [] + }, + { + "name": "Import one or more Reviews with matching RuleIds", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if ( user == \"collectioncreator\" ) { //placeholder for \"users\" that should fail\r", + " pm.test(\"Status should be is 403 for all users except stigmanAdmin(elevated), lvl3 and lvl4\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "let jsonData = pm.response.json();\r", + "const expectedResponse = {\r", + " rejected: [],\r", + " affected: {\r", + " updated: 0,\r", + " inserted: 2\r", + " }\r", + "}\r", + "\r", + "pm.test(\"Response matches request\", function () {\r", + " pm.expect(jsonData).to.eql(expectedResponse);\r", + "})\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "[\n {\n \"ruleId\": \"SV-106179r1_xxxx\",\n \"result\": \"pass\",\n \"detail\": \"asfeee\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n },\n {\n \"ruleId\": \"SV-106179r1_xxxx\",\n \"result\": \"pass\",\n \"detail\": \"asfeee\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n },\n {\n \"ruleId\": \"SV-106181r1_xxxx\",\n \"result\": \"notapplicable\",\n \"detail\": \"asdfsef\",\n \"comment\": null,\n \"resultEngine\": null,\n \"status\": \"saved\"\n }\n]" + }, + "url": { + "raw": "{{baseUrl}}/collections/:collectionId/reviews/:assetId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "collections", + ":collectionId", + "reviews", + ":assetId" + ], + "variable": [ + { + "key": "collectionId", + "value": "{{testCollection}}" + }, + { + "key": "assetId", + "value": "{{testAsset}}" + } + ] + } + }, + "response": [] + }, + { + "name": "Return detailed metrics for the specified Collection - with params Copy 2", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "let user = pm.environment.get(\"user\");\r", + "console.log(\"user: \" + user);\r", + "\r", + "if (pm.request.url.getQueryString().match(/elevate=true/)) {\r", + " user = \"elevated\";\r", + " console.log(\"setting user to 'elevated'\");\r", + "}\r", + "\r", + "if (user == \"collectioncreator\" || user == \"bizarroLvl1\" ) {\r", + " pm.test(\"Status should be is 403 for user collectioncreator, bizarroLvl1\", function () {\r", + " pm.response.to.have.status(403);\r", + " });\r", + " return;\r", + "}\r", + "else {\r", + " pm.test(\"Status code is 200\", function () {\r", + " pm.response.to.have.status(200);\r", + " });\r", + "}\r", + "if (pm.response.code !== 200) {\r", + " return;\r", + "}\r", + "\r", + "\r", + "let jsonData = pm.response.json();\r", + "\r", + "\r", + "pm.test(\"Response JSON is an array\", function () {\r", + " pm.expect(jsonData).to.be.an('array');\r", + "});\r", + "\r", + "\r", + "let testAsset = pm.environment.get(\"testAsset\");\r", + "let testBenchmark = \"VPN_SRG_Rule-fingerprint-match-test\"\r", + "let testLabel = pm.environment.get(\"testLabel\");\r", + "let testLabelName = pm.environment.get(\"testLabelName\");\r", + "\r", + "let testChecklistLength = 3;\r", + "\r", + "\r", + "\r", + "// pm.test(\"Check that proper assets are returned\", function () {\r", + " for (let item of jsonData){\r", + " console.log( \"testing: \" + item.name) \r", + "\r", + " let assetMatchString = pm.environment.get(\"assetMatchString\");\r", + " var regex = new RegExp(assetMatchString);\r", + " pm.test(\"Check that proper assets are returned: \" + assetMatchString, function () {\r", + " pm.expect(item.name).to.match(regex);\r", + " });\r", + "\r", + " if (pm.request.url.getQueryString().match(/benchmarkId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - benchmark\", function () {\r", + " pm.expect(item.benchmarkId).to.eql(testBenchmark);\r", + " })\r", + " }\r", + " if (pm.request.url.getQueryString().match(/assetId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - assetId\", function () {\r", + " pm.expect(item.assetId).to.eql(testAsset);\r", + " })\r", + " } \r", + "\r", + " if (pm.request.url.getQueryString().match(/labelId=/)) {\r", + " pm.test(\"verify parameter restricted response properly - labelId\", function () {\r", + " let responseLabels = [];\r", + " for (let label of item.labels) {\r", + " responseLabels.push(label.labelId)\r", + " }\r", + " pm.expect(responseLabels).to.include(testLabel);\r", + " })\r", + " } \r", + "\r", + " if (pm.request.url.getQueryString().match(/labelName=/)) {\r", + " pm.test(\"verify parameter restricted response properly - labelName\", function () {\r", + " let responseLabels = [];\r", + " for (let label of item.labels) {\r", + " responseLabels.push(label.name)\r", + " }\r", + " pm.expect(responseLabels).to.include(testLabelName);\r", + " })\r", + " } \r", + "\r", + " if (item.assetId == testAsset && item.benchmarkId == testBenchmark) {\r", + " // if (item.assetId == testAsset ) {\r", + " console.log( \"found Collection_X_lvl1_asset\") \r", + "\r", + " pm.test(\"Check some stats - findings, low\", function () {\r", + " pm.expect(item.metrics.findings.low).to.equal(0);\r", + " });\r", + "\r", + " pm.test(\"Check some stats - results - NA\", function () {\r", + " pm.expect(item.metrics.results.notapplicable.total).to.equal(1);\r", + " }); \r", + " pm.test(\"Check some stats - results - pass\", function () {\r", + " pm.expect(item.metrics.results.pass.total).to.equal(2);\r", + " }); \r", + "\r", + " pm.test(\"Check some stats - results - fail\", function () {\r", + " pm.expect(item.metrics.results.fail.total).to.equal(0);\r", + " }); \r", + "\r", + " pm.test(\"Check some stats - status - submitted\", function () {\r", + " pm.expect(item.metrics.statuses.submitted.total).to.equal(0);\r", + " }); \r", + " pm.test(\"Check some stats - assessments\", function () {\r", + " pm.expect(item.metrics.assessments).to.equal(testChecklistLength);\r", + " }); \r", + " pm.test(\"Check some stats - assessed\", function () {\r", + " pm.expect(item.metrics.assessed).to.equal(3);\r", + " }); \r", + "\r", + " }\r", + " }\r", + " \r", + "\r", + "\r", + "\r", + " \r", + "\r", + " \r", + "// }\r", + "\r", + "return;\r", + "\r", + "\r", + "" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/collections/:collectionId/metrics/detail?benchmarkId=VPN_SRG_Rule-fingerprint-match-test&assetId={{testAsset}}", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "collections", + ":collectionId", + "metrics", + "detail" + ], + "query": [ + { + "key": "benchmarkId", + "value": "VPN_SRG_Rule-fingerprint-match-test" + }, + { + "key": "assetId", + "value": "{{testAsset}}" + }, + { + "key": "labelId", + "value": "{{testLabel}}", + "disabled": true + }, + { + "key": "labelName", + "value": "{{testLabelName-lvl1}}", + "disabled": true + } + ], + "variable": [ + { + "key": "collectionId", + "value": "{{testCollection}}" + } + ] + } + }, + "response": [] + } + ] } ], "description": "These tests should be self contained, provide their own authorization, and repopulate test data if required.", diff --git a/test/api/postman_environment.json b/test/api/postman_environment.json index f929a2b1b..3b0567bc5 100644 --- a/test/api/postman_environment.json +++ b/test/api/postman_environment.json @@ -391,9 +391,39 @@ "value": "", "type": "any", "enabled": true + }, + { + "key": "clonedCollectionId", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "exportedAsset", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "exportedAssetStatuses", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "exportedAssetResults", + "value": "", + "type": "any", + "enabled": true + }, + { + "key": "vpnStig-Rules-with-matching-fingerprints", + "value": "U_VPN_SRG-OTHER_V1R1_twoRules-matchingFingerprints.xml", + "type": "default", + "enabled": true } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2023-07-31T15:17:00.503Z", - "_postman_exported_using": "Postman/10.16.3" + "_postman_exported_at": "2023-10-30T21:42:16.657Z", + "_postman_exported_using": "Postman/10.19.10" } \ No newline at end of file