Skip to content

Commit 4c9281f

Browse files
authored
Merge pull request #4 from shaunwarman/use-expect-ct-config
feat: add Expect-CT header
2 parents 4e5b7ae + c887376 commit 4c9281f

File tree

4 files changed

+8784
-1
lines changed

4 files changed

+8784
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
coverage
66
.nyc_output
77
locales
8+
package-lock.json

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const conditional = require('koa-conditional-get');
1717
const cors = require('kcors');
1818
const errorHandler = require('koa-better-error-handler');
1919
const etag = require('koa-etag');
20+
const expectCt = require('koa-expect-ct');
2021
const helmet = require('koa-helmet');
2122
const json = require('koa-json');
2223
const koa404Handler = require('koa-404-handler');
@@ -125,7 +126,10 @@ class API {
125126
if (this.config.cors) app.use(cors(this.config.cors));
126127

127128
// security
128-
app.use(helmet());
129+
if (this.config.helmet) app.use(helmet(this.config.helmet));
130+
131+
// add Expect-CT header for cert transparency
132+
if (this.config.expectCT) app.use(expectCt(this.config.expectCT));
129133

130134
// remove trailing slashes
131135
app.use(removeTrailingSlashes());

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"koa-conditional-get": "^2.0.0",
4040
"koa-connect": "^2.0.1",
4141
"koa-etag": "^3.0.0",
42+
"koa-expect-ct": "^0.0.1",
4243
"koa-helmet": "^5.2.0",
4344
"koa-json": "^2.0.2",
4445
"koa-no-trailing-slash": "^2.1.0",

0 commit comments

Comments
 (0)