Skip to content

Commit

Permalink
Merge pull request #41 from loadimpact/fix/less-strict-cookie-validation
Browse files Browse the repository at this point in the history
[fix] make cookie validation less strict.
  • Loading branch information
legander authored Jun 5, 2020
2 parents 2c6b0c4 + 461d733 commit e6ea4ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
7 changes: 1 addition & 6 deletions src/validate/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function cookie(node, i, j, assay) {
name(node.name, i, assay)
}

// eslint-disable-next-line no-unused-vars
function validate(node, i, j, assay) {
if (empty(node.name)) {
throw new InvalidArchiveError({ name: 'MissingCookieName' }, `Missing cookie name (${i}:${j})`)
Expand All @@ -27,12 +28,6 @@ function validate(node, i, j, assay) {
`Invalid cookie name (${i}:${j}): must be string`
)
}
if (assay.requestCookieNames.has(i) && assay.requestCookieNames.get(i).has(node.name)) {
throw new InvalidArchiveError(
{ name: 'DuplicateCookieName' },
`Duplicate cookie name (${i}:${j}): ${node.name}`
)
}
if (node.value && typeof node.value !== 'string') {
throw new InvalidArchiveError(
{ name: 'InvalidCookieValue' },
Expand Down
11 changes: 0 additions & 11 deletions test/unit/validate/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ test('invalid name', (t) => {
)
})

test('duplicate name', (t) => {
const assay = makeAssay()
cookie({ name: 'session' }, 8, 0, assay)
t.throws(
() => {
cookie({ name: 'session' }, 8, 1, assay)
},
{ name: 'DuplicateCookieName' }
)
})

test('invalid value', (t) => {
t.throws(
() => {
Expand Down

0 comments on commit e6ea4ca

Please sign in to comment.