Skip to content

Commit

Permalink
chore(config): guard against prototype pollution
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Feb 28, 2024
1 parent 93cb6eb commit ef7aeba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class Config {

function applyDefaults(cfg = {}, defaults = {}) {
for (const d in defaults) {
if (d === "__proto__" || d === "constructor") continue;
if ([undefined, null].includes(cfg[d])) {
cfg[d] = defaults[d]
} else if (typeof cfg[d] === 'object' && typeof defaults[d] === 'object') {
Expand Down
4 changes: 1 addition & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ async function setup() {
},
])

const sessionCfg = await Config.get('session')

server.auth.strategy('session', 'cookie', {
cookie: sessionCfg.cookie,
cookie: httpCfg.cookie,

validate: async (request, session) => {
const s = await Session.get({ id: session.nt_user_session_id })
Expand Down

0 comments on commit ef7aeba

Please sign in to comment.