Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DC-208 categorisation tool is logging full cookie details #129

merged 1 commit into from Apr 18, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

@@ -1,5 +1,6 @@
const express = require('express')
const addRequestId = require('express-request-id')()
const catToolSerialisers = require('./catToolSerialisers')
const helmet = require('helmet')
const csurf = require('csurf')
const compression = require('compression')
@@ -17,7 +18,7 @@ const sassMiddleware = require('node-sass-middleware')
const authorisationMiddleware = require('./middleware/authorisationMiddleware')
const moment = require('moment')
const path = require('path')
const log = require('bunyan-request-logger')({ name: 'Cat tool http' })
const log = require('bunyan-request-logger')({ name: 'Cat tool http', serializers: catToolSerialisers })
const logger = require('../log.js')
const nunjucksSetup = require('./utils/nunjucksSetup')

@@ -0,0 +1,21 @@
const bunyan = require('bunyan')

const redactSession = msg => msg.replace(/session=[A-Za-z0-9=]+/, 'session=REDACTED')

module.exports = {
err: bunyan.stdSerializers.err,
req(req) {
const req1 = bunyan.stdSerializers.req(req)
if (req1.headers && req1.headers.cookie) {
req1.headers.cookie = redactSession(req1.headers.cookie)
return req1
res(res) {
const res1 = bunyan.stdSerializers.res(res)
if (res1.header) {
res1.header = redactSession(res1.header)
return res1
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.