Project rename
This commit is contained in:
+2
@@ -0,0 +1,2 @@
|
||||
test
|
||||
.travis.yml
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 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.
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
Referrer Policy
|
||||
===============
|
||||
[](https://travis-ci.org/helmetjs/referrer-policy)
|
||||
[](http://standardjs.com/)
|
||||
|
||||
[_Looking for a changelog?_](https://github.com/helmetjs/helmet/blob/master/HISTORY.md)
|
||||
|
||||
The [Referer HTTP header](https://en.wikipedia.org/wiki/HTTP_referer) is typically set by web browsers to tell the server where it's coming from. For example, if you click a link on *example.com/index.html* that takes you to *wikipedia.org*, Wikipedia's servers will see `Referer: example.com`. This can have privacy implications—websites can see where you are coming from. The new [`Referrer-Policy` HTTP header](https://www.w3.org/TR/referrer-policy/#referrer-policy-header) lets authors control how browsers set the Referer header.
|
||||
|
||||
[Read the spec](https://www.w3.org/TR/referrer-policy/#referrer-policies) to see the options you can provide.
|
||||
|
||||
Usage:
|
||||
|
||||
```javascript
|
||||
var referrerPolicy = require('referrer-policy')
|
||||
|
||||
app.use(referrerPolicy({ policy: 'same-origin' }))
|
||||
// Referrer-Policy: same-origin
|
||||
|
||||
app.use(referrerPolicy({ policy: 'unsafe-url' }))
|
||||
// Referrer-Policy: unsafe-url
|
||||
|
||||
app.use(referrerPolicy())
|
||||
// Referrer-Policy: no-referrer
|
||||
```
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
var DEFAULT_POLICY = 'no-referrer'
|
||||
var ALLOWED_POLICIES = [
|
||||
'no-referrer',
|
||||
'no-referrer-when-downgrade',
|
||||
'same-origin',
|
||||
'origin',
|
||||
'strict-origin',
|
||||
'origin-when-cross-origin',
|
||||
'strict-origin-when-cross-origin',
|
||||
'unsafe-url',
|
||||
''
|
||||
]
|
||||
var ALLOWED_POLICIES_ERROR_LIST = ALLOWED_POLICIES.map(function (policy) {
|
||||
if (policy.length) {
|
||||
return '"' + policy + '"'
|
||||
} else {
|
||||
return 'and the empty string'
|
||||
}
|
||||
}).join(', ')
|
||||
|
||||
module.exports = function referrerPolicy (options) {
|
||||
options = options || {}
|
||||
|
||||
var policy
|
||||
if ('policy' in options) {
|
||||
policy = options.policy
|
||||
} else {
|
||||
policy = DEFAULT_POLICY
|
||||
}
|
||||
|
||||
if (ALLOWED_POLICIES.indexOf(policy) === -1) {
|
||||
throw new Error('"' + policy + '" is not a valid policy. Allowed policies: ' + ALLOWED_POLICIES_ERROR_LIST + '.')
|
||||
}
|
||||
|
||||
return function referrerPolicy (req, res, next) {
|
||||
res.setHeader('Referrer-Policy', policy)
|
||||
next()
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "referrer-policy@1.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "referrer-policy",
|
||||
"name": "referrer-policy",
|
||||
"rawSpec": "1.1.0",
|
||||
"spec": "1.1.0",
|
||||
"type": "version"
|
||||
},
|
||||
"/Users/gerrit/Documents/dev/nodejs/rentfor.camp/html/RentForCamp/node_modules/helmet"
|
||||
]
|
||||
],
|
||||
"_from": "referrer-policy@1.1.0",
|
||||
"_id": "referrer-policy@1.1.0",
|
||||
"_inCache": true,
|
||||
"_location": "/referrer-policy",
|
||||
"_nodeVersion": "6.9.2",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/referrer-policy-1.1.0.tgz_1483221705245_0.1504121378529817"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "evanhahn",
|
||||
"email": "me@evanhahn.com"
|
||||
},
|
||||
"_npmVersion": "3.10.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "referrer-policy@1.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "referrer-policy",
|
||||
"name": "referrer-policy",
|
||||
"rawSpec": "1.1.0",
|
||||
"spec": "1.1.0",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/helmet"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/referrer-policy/-/referrer-policy-1.1.0.tgz",
|
||||
"_shasum": "35774eb735bf50fb6c078e83334b472350207d79",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "referrer-policy@1.1.0",
|
||||
"_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/referrer-policy/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Middleware to set the Referrer-Policy HTTP header",
|
||||
"devDependencies": {
|
||||
"connect": "^3.5.0",
|
||||
"mocha": "^3.2.0",
|
||||
"standard": "^8.6.0",
|
||||
"supertest": "^2.0.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "35774eb735bf50fb6c078e83334b472350207d79",
|
||||
"tarball": "https://registry.npmjs.org/referrer-policy/-/referrer-policy-1.1.0.tgz"
|
||||
},
|
||||
"gitHead": "dd8e11e5dc27f47c95ddfc9c6edaa08afdc5a630",
|
||||
"homepage": "https://github.com/helmetjs/referrer-policy#readme",
|
||||
"keywords": [
|
||||
"helmet",
|
||||
"security",
|
||||
"express",
|
||||
"connect",
|
||||
"referer",
|
||||
"referrer",
|
||||
"privacy"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "evanhahn",
|
||||
"email": "me@evanhahn.com"
|
||||
}
|
||||
],
|
||||
"name": "referrer-policy",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/helmetjs/referrer-policy.git"
|
||||
},
|
||||
"scripts": {
|
||||
"pretest": "standard",
|
||||
"test": "mocha"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"describe",
|
||||
"beforeEach",
|
||||
"it"
|
||||
]
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
Reference in New Issue
Block a user