fix(server): validate Content-Type by parsed media type instead of substring match (#2441)
This commit is contained in:
parent
7015d2129b
commit
561c6d8345
1 changed files with 452 additions and 20 deletions
|
|
@ -47,6 +47,18 @@ export default defineConfig(
|
|||
'unicorn/prevent-abbreviations': 'off',
|
||||
'unicorn/no-null': 'off',
|
||||
'unicorn/prefer-add-event-listener': 'off',
|
||||
'no-restricted-syntax': [
|
||||
'error',
|
||||
{
|
||||
selector:
|
||||
":matches(CallExpression[callee.property.name='includes'], CallExpression[callee.property.name='indexOf'], " +
|
||||
"CallExpression[callee.property.name='startsWith'])[arguments.0.value='application/json']",
|
||||
message:
|
||||
"Substring-matching 'application/json' misclassifies Content-Type values whose media type is different " +
|
||||
"(e.g. 'text/plain; a=application/json') and mishandles parameters and case. " +
|
||||
'Parse the media type instead: isJsonContentType() from core-internal.'
|
||||
}
|
||||
],
|
||||
'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
|
||||
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
'n/prefer-node-protocol': 'error',
|
||||
|
|
|
|||
Loading…
Reference in a new issue