mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
39 lines (38 loc) • 1.05 kB
YAML
rules:
- id: detect-angular-trust-as-css-method
message: >-
The use of $sce.trustAsCss can be dangerous if unsanitized user input flows through this API.
metadata:
cwe:
- "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"
owasp:
- A07:2017 - Cross-Site Scripting (XSS)
- A03:2021 - Injection
references:
- https://docs.angularjs.org/api/ng/service/$sce#trustAsCss
- https://owasp.org/www-chapter-london/assets/slides/OWASPLondon20170727_AngularJS.pdf
category: security
technology:
- angular
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: MEDIUM
confidence: LOW
languages:
- javascript
- typescript
severity: WARNING
patterns:
- pattern-either:
- pattern: |
$SOURCE = $scope.$INPUT;
$sce.trustAsCss($SOURCE);
- pattern: |
$sce.trustAsCss($scope.$INPUT);
- pattern-inside: |
app.controller(..., function($scope,$sce){
...
});