Project rename
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017, 2018 Evan Hahn
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
Expect-CT
|
||||
=========
|
||||
[](https://travis-ci.org/helmetjs/expect-ct)
|
||||
[](http://standardjs.com/)
|
||||
|
||||
[_Looking for a changelog?_](https://github.com/helmetjs/helmet/blob/master/HISTORY.md)
|
||||
|
||||
The `Expect-CT` HTTP header tells browsers to expect Certificate Transparency. For more, see [this blog post](https://scotthelme.co.uk/a-new-security-header-expect-ct/) and the [article on MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expect-CT).
|
||||
|
||||
Usage:
|
||||
|
||||
```javascript
|
||||
var expectCt = require('expect-ct')
|
||||
|
||||
// Sets Expect-CT: max-age=123
|
||||
app.use(expectCt({ maxAge: 123 }))
|
||||
|
||||
// Sets Expect-CT: enforce, max-age=123
|
||||
app.use(expectCt({
|
||||
enforce: true,
|
||||
maxAge: 123
|
||||
}))
|
||||
|
||||
// Sets Expect-CT: enforce, max-age=30, report-uri="http://example.com/report"
|
||||
app.use(expectCt({
|
||||
enforce: true,
|
||||
maxAge: 30,
|
||||
reportUri: 'http://example.com/report'
|
||||
}))
|
||||
```
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
module.exports = function expectCt (options) {
|
||||
var headerValue = getHeaderValue(options)
|
||||
|
||||
return function expectCt (req, res, next) {
|
||||
res.setHeader('Expect-CT', headerValue)
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
function getHeaderValue (options) {
|
||||
options = options || {}
|
||||
|
||||
var directives = []
|
||||
|
||||
if (options.enforce) {
|
||||
directives.push('enforce')
|
||||
}
|
||||
|
||||
directives.push('max-age=' + parseMaxAge(options.maxAge))
|
||||
|
||||
if (options.reportUri) {
|
||||
directives.push('report-uri="' + options.reportUri + '"')
|
||||
}
|
||||
|
||||
return directives.join(', ')
|
||||
}
|
||||
|
||||
function parseMaxAge (option) {
|
||||
if (option == null) { return 0 }
|
||||
|
||||
if ((typeof option !== 'number') || (option < 0)) {
|
||||
throw new Error(option + ' is not a valid value for maxAge. Please choose a positive integer.')
|
||||
}
|
||||
|
||||
return option
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "expect-ct@0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "expect-ct",
|
||||
"name": "expect-ct",
|
||||
"rawSpec": "0.1.1",
|
||||
"spec": "0.1.1",
|
||||
"type": "version"
|
||||
},
|
||||
"/Users/gerrit/Documents/dev/nodejs/rentfor.camp/html/RentForCamp/node_modules/helmet"
|
||||
]
|
||||
],
|
||||
"_from": "expect-ct@0.1.1",
|
||||
"_id": "expect-ct@0.1.1",
|
||||
"_inCache": true,
|
||||
"_location": "/expect-ct",
|
||||
"_nodeVersion": "10.1.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "s3://npm-registry-packages",
|
||||
"tmp": "tmp/expect-ct_0.1.1_1526505312220_0.5208453988364581"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "evanhahn",
|
||||
"email": "me@evanhahn.com"
|
||||
},
|
||||
"_npmVersion": "5.10.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "expect-ct@0.1.1",
|
||||
"scope": null,
|
||||
"escapedName": "expect-ct",
|
||||
"name": "expect-ct",
|
||||
"rawSpec": "0.1.1",
|
||||
"spec": "0.1.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/helmet"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/expect-ct/-/expect-ct-0.1.1.tgz",
|
||||
"_shasum": "de84476a2dbcb85000d5903737e9bc8a5ba7b897",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "expect-ct@0.1.1",
|
||||
"_where": "/Users/gerrit/Documents/dev/nodejs/rentfor.camp/html/RentForCamp/node_modules/helmet",
|
||||
"author": {
|
||||
"name": "Evan Hahn",
|
||||
"email": "me@evanhahn.com",
|
||||
"url": "https://evanhahn.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/helmetjs/expect-ct/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Middleware to set the Expect-CT header",
|
||||
"devDependencies": {
|
||||
"mocha": "^4.1.0",
|
||||
"standard": "^11.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"integrity": "sha512-ngXzTfoRGG7fYens3/RMb6yYoVLvLMfmsSllP/mZPxNHgFq41TmPSLF/nLY7fwoclI2vElvAmILFWGUYqdjfCg==",
|
||||
"shasum": "de84476a2dbcb85000d5903737e9bc8a5ba7b897",
|
||||
"tarball": "https://registry.npmjs.org/expect-ct/-/expect-ct-0.1.1.tgz",
|
||||
"fileCount": 4,
|
||||
"unpackedSize": 3552,
|
||||
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa/J9hCRA9TVsSAnZWagAAy7wP/2OdbZ30YNj9/nuUfSkF\nyf+Ypgk2f8Hdn05iP0bedzG9n8HLPuTSTaBBwtkV/X/xWMgo6DSKUFZrrXBY\neHEhoe0+vwYPK1ASb5zzUqf3gJRSBe/7Fbr9fS6qMTa7vQv20ytyJRiESqcD\nlHPrC3PK0RssJrY/+bMJal9Bpg6kuaFyXJaT+GriNLomwZ/cJuuapPVvnBcb\nje2x0mkeIlR3yEgFyaIwm1y8hcu+GpfT3PazlB6LIrxWskzRXmUNYjp+Pn5T\nDIA+fiHUfpXLBxup6My+ju1Ap1fJRPrKUSJ5hfbGXMRfRmUm30AKqrxv9qJD\nXWMIZSgMCx6XIMXvqC09PEgyiiJN/HzfAOPxNeOQkpVjXRDAbr2Mb0gcsLWp\nk8qzh8gN71aO6eSruIo2bTOZ0xBro/ghFp9oIpLulMMeVV5vEWPYyD2ISwGl\nVW0yzkzO57kcrR5LuXWFlxxmrM2/JAwrBlGMsbJKL150JDSQ/qCguQJTxqXa\n6RBFjo33TG7AmTEn3QY3Y+o7BATHP7nWOFFvd85lHig51KZ7Zk4C0zrTQA30\nCChyL0hPurs0Qm27usE8MNZcqjzfWQBOrcvJ5FkFI6ha1u+/ejXfXWBnMCbS\n791ViqhaQca7N0/70homsD3r4e+h8VaIAAge9OXnZV7hByYx89Vrddg6MrNj\nHeyL\r\n=yidl\r\n-----END PGP SIGNATURE-----\r\n"
|
||||
},
|
||||
"gitHead": "20a9ca872ada687449635569cb94433a66ecfee8",
|
||||
"homepage": "https://github.com/helmetjs/expect-ct#readme",
|
||||
"keywords": [
|
||||
"helmet",
|
||||
"security",
|
||||
"express",
|
||||
"connect",
|
||||
"expect-ct"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "evanhahn",
|
||||
"email": "me@evanhahn.com"
|
||||
}
|
||||
],
|
||||
"name": "expect-ct",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/helmetjs/expect-ct.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "standard",
|
||||
"test": "mocha"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"beforeEach",
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"version": "0.1.1"
|
||||
}
|
||||
Reference in New Issue
Block a user