Skip to content

Commit 4ffce42

Browse files
authored
Merge pull request #13 from tellihealth/feature/support_for_openapi_paths
CHANGE - added a new owasp definition
2 parents 32e32c5 + 6f28af9 commit 4ffce42

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/owasp.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class OWASP {
5959
description:
6060
"The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the [MIME types](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) advertised in the [Content-Type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) headers should be followed and not be changed. The header allows you to avoid [MIME type sniffing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#mime_sniffing) by saying that the MIME types are deliberately configured. - [MDN Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options)",
6161
},
62+
"X-DNS-Prefetch-Control": {
63+
description: "Controls DNS prefetching.",
64+
},
6265
"X-Frame-Options": {
6366
description:
6467
"The X-Frame-Options [HTTP](https://developer.mozilla.org/en-US/docs/Web/HTTP) response header can be used to indicate whether or not a browser should be allowed to render a page in a [<frame>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame), [<iframe>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe), [<embed>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed) or [<object>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object). Sites can use this to avoid [click-jacking](https://developer.mozilla.org/en-US/docs/Web/Security/Types_of_attacks#click-jacking) attacks, by ensuring that their content is not embedded into other sites. - [MDN Link](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options)",
@@ -81,6 +84,7 @@ class OWASP {
8184
referrerPolicy: "Referrer-Policy",
8285
strictTransportSecurity: "Strict-Transport-Security",
8386
xContentTypeOptions: "X-Content-Type-Options",
87+
xDnsPrefetchControl: "X-DNS-Prefetch-Control",
8488
xFrameOptions: "X-Frame-Options",
8589
xPermittedCrossDomainPolicies: "X-Permitted-Cross-Domain-Policies",
8690
};

test/json/newOWASP.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
"name": "X-Content-Type-Options",
4242
"value": "nosniff"
4343
},
44+
{
45+
"name": "X-DNS-Prefetch-Control",
46+
"value": "off"
47+
},
4448
{
4549
"name": "X-Frame-Options",
4650
"value": "deny"
@@ -50,4 +54,4 @@
5054
"value": "none"
5155
}
5256
]
53-
}
57+
}

test/unit/owasp.spec.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe(`owasp`, function () {
2929
expect(
3030
owasp.DEFAULT_OWASP_HEADERS["Permissions-Policy"].schema.default
3131
).to.be.equal(permissionsPolicyDefault[0].value);
32-
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(12);
32+
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(13);
3333
});
3434

3535
it(`populates the defaults with information from a new OWASP release`, async function () {
@@ -52,7 +52,11 @@ describe(`owasp`, function () {
5252
owasp.DEFAULT_OWASP_HEADERS["Cross-Origin-Embedder-Policy"].schema
5353
.default
5454
).to.be.equal(newCrossOriginEmbedderPolicy[0].value);
55-
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(12);
55+
console.log(
56+
`Object.keys(owasp.DEFAULT_OWASP_HEADERS).length`,
57+
Object.keys(owasp.DEFAULT_OWASP_HEADERS).length
58+
);
59+
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(13);
5660
});
5761

5862
it(`adds any properties contained in a new release`, async function () {
@@ -73,7 +77,7 @@ describe(`owasp`, function () {
7377
expect(owasp.DEFAULT_OWASP_HEADERS["x-added"].schema.default).to.be.equal(
7478
"true"
7579
);
76-
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(13);
80+
expect(Object.keys(owasp.DEFAULT_OWASP_HEADERS).length).to.be.equal(14);
7781
});
7882
});
7983

0 commit comments

Comments
 (0)