-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add meta object documentation for all rules (#79)
* Update .gitignore * Closes #61 * Closes #48 * Update README.md Co-authored-by: Nicholas C. Zakas <[email protected]> * Update README.md Co-authored-by: Nicholas C. Zakas <[email protected]> * Update README.md Co-authored-by: Nicholas C. Zakas <[email protected]> * docs: changed meta urls to rule docs and shortened descriptions to one, markdownfree sentence. * docs: corrected snyk description * docs: updated to link on main Co-authored-by: Nicholas C. Zakas <[email protected]>
- Loading branch information
1 parent
b9a9b7f
commit fb1d9ef
Showing
16 changed files
with
383 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
|
||
'use strict'; | ||
|
||
module.exports = function(context) { | ||
|
||
return { | ||
'AssignmentExpression': function(node) { | ||
if (node.operator === '=') { | ||
if (node.left.property) { | ||
if (node.left.property.name === 'escapeMarkup') { | ||
if (node.right.value === false) { | ||
context.report(node, 'Markup escaping disabled.'); | ||
module.exports = { | ||
meta: { | ||
type: 'error', | ||
docs: { | ||
description: 'Detects "object.escapeMarkup = false", which can be used with some template engines to disable escaping of HTML entities.', | ||
category: 'Possible Security Vulnerability', | ||
recommended: true, | ||
url: 'https://github.com/nodesecurity/eslint-plugin-security#detect-disable-mustache-escape' | ||
} | ||
}, | ||
create: function(context) { | ||
return { | ||
'AssignmentExpression': function(node) { | ||
if (node.operator === '=') { | ||
if (node.left.property) { | ||
if (node.left.property.name === 'escapeMarkup') { | ||
if (node.right.value === false) { | ||
context.report(node, 'Markup escaping disabled.'); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
'use strict'; | ||
|
||
|
||
module.exports = function (context) { | ||
// Detects instances of new Buffer(argument) | ||
// where argument is any non literal value. | ||
return { | ||
'NewExpression': function (node) { | ||
if (node.callee.name === 'Buffer' && | ||
module.exports = { | ||
meta: { | ||
type: 'error', | ||
docs: { | ||
description: 'Detect instances of new Buffer(argument) where argument is any non-literal value.', | ||
category: 'Possible Security Vulnerability', | ||
recommended: true, | ||
url: 'https://github.com/nodesecurity/eslint-plugin-security/blob/main/README.md' | ||
} | ||
}, | ||
create: function(context) { | ||
return { | ||
'NewExpression': function(node) { | ||
if (node.callee.name === 'Buffer' && | ||
node.arguments[0] && | ||
node.arguments[0].type !== 'Literal') { | ||
|
||
return context.report(node, 'Found new Buffer'); | ||
return context.report(node, 'Found new Buffer'); | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
}; | ||
|
||
}; | ||
} | ||
}; |
Oops, something went wrong.