Skip to content
Snippets Groups Projects
Commit a13ed64f authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

don't log more information than is needed in browserid-metrics.json - strip...

don't log more information than is needed in browserid-metrics.json - strip everything from referrer except origin - issue #1283
parent 47de4442
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,8 @@ const
winston = require("winston"),
configuration = require("./configuration"),
path = require('path'),
fs = require('fs');
fs = require('fs'),
urlparse = require('urlparse');
// go through the configuration and determine log location
// for now we only log to one place
......@@ -78,9 +79,17 @@ exports.userEntry = function(req) {
var ipAddress = req.connection.remoteAddress;
if (req.headers['x-real-ip']) ipAddress = req.headers['x-real-ip'];
var referer = null;
try {
// don't log more than we need
referer = urlparse(req.headers['referer']).originOnly().toString();
} catch(e) {
// ignore malformed referrers. just log null
}
exports.report('signin', {
browser: req.headers['user-agent'],
rp: req.headers['referer'],
rp: referer,
// IP address (this probably needs to be replaced with the X-forwarded-for value
ip: ipAddress
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment