Skip to content

Commit 3b7515d

Browse files
committed
fix: protect against prototype pollution
1 parent 6d5bbf3 commit 3b7515d

File tree

6 files changed

+100
-179
lines changed

6 files changed

+100
-179
lines changed

.ncurc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = {
1010
'undici',
1111

1212
// fix later
13-
'eslint'
13+
'eslint',
14+
'eslint-config-prettier'
1415
]
1516
};

lib/bimi/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const httpsSchema = Joi.string().uri({
1313
const FETCH_TIMEOUT = 5 * 1000;
1414

1515
const { fetch: fetchCmd, Agent } = require('undici');
16-
const fetchAgent = new Agent({ connect: { timeout: FETCH_TIMEOUT } });
16+
const fetchAgent = new Agent({
17+
connect: { timeout: FETCH_TIMEOUT }
18+
});
1719

1820
const { vmc } = require('@postalsys/vmc');
1921
const { validateSvg } = require('./validate-svg');

lib/parse-dkim-headers.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,15 @@ const headerParser = buf => {
279279
entry.comment = part.comment;
280280
}
281281

282-
if (['arc-authentication-results', 'authentication-results'].includes(headerKey) && part.key === 'dkim') {
283-
if (!result[part.key]) {
284-
result[part.key] = [];
282+
if (part.key && !['__proto__', 'constructor'].includes(part.key)) {
283+
if (['arc-authentication-results', 'authentication-results'].includes(headerKey) && part.key === 'dkim') {
284+
if (!result[part.key]) {
285+
result[part.key] = [];
286+
}
287+
result[part.key].push(entry);
288+
} else {
289+
result[part.key] = entry;
285290
}
286-
result[part.key].push(entry);
287-
} else {
288-
result[part.key] = entry;
289291
}
290292
});
291293

0 commit comments

Comments
 (0)