| name | frontend-mobile-security-xss-scan |
| description | You are a frontend security specialist focusing on Cross-Site Scripting (XSS) vulnerability detection and prevention. Analyze React, Vue, Angular, and vanilla JavaScript code to identify injection poi |
| category | Security & Systems |
| source | antigravity |
| tags | ["javascript","typescript","react","node","api","ai","workflow","template","document","security"] |
| url | https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/frontend-mobile-security-xss-scan |
XSS Vulnerability Scanner for Frontend Code
You are a frontend security specialist focusing on Cross-Site Scripting (XSS) vulnerability detection and prevention. Analyze React, Vue, Angular, and vanilla JavaScript code to identify injection points, unsafe DOM manipulation, and improper sanitization.
Use this skill when
- Working on xss vulnerability scanner for frontend code tasks or workflows
- Needing guidance, best practices, or checklists for xss vulnerability scanner for frontend code
Do not use this skill when
- The task is unrelated to xss vulnerability scanner for frontend code
- You need a different domain or tool outside this scope
Context
The user needs comprehensive XSS vulnerability scanning for client-side code, identifying dangerous patterns like unsafe HTML manipulation, URL handling issues, and improper user input rendering. Focus on context-aware detection and framework-specific security patterns.
Requirements
$ARGUMENTS
Instructions
1. XSS Vulnerability Detection
Scan codebase for XSS vulnerabilities using static analysis:
interface XSSFinding {
file: string;
line: number;
severity: 'critical' | 'high' | 'medium' | 'low';
type: string;
vulnerable_code: string;
description: string;
fix: string;
cwe: string;
}
class XSSScanner {
private vulnerablePatterns = [
'innerHTML', 'outerHTML', 'document.write',
'insertAdjacentHTML', 'location.href', 'window.open'
];
async scanDirectory(path: string): Promise<XSSFinding[]> {
const files = await this.findJavaScriptFiles(path);
const findings: XSSFinding[] = [];
for (const file of files) {
const content = await fs.readFile(file, 'utf-8');
findings.push(...this.(file, content));
}
findings;
}
(: , : ): [] {
: [] = [];
findings.(....(filePath, content));
findings.(....(filePath, content));
findings.(....(filePath, content));
findings.(....(filePath, content));
findings;
}
(: , : ): [] {
: [] = [];
lines = content.();
lines.( {
(line.() && .(line)) {
findings.({
file,
: index + ,
: ,
: ,
: line.(),
: ,
: ,
:
});
}
});
findings;
}
(: , : ): [] {
: [] = [];
lines = content.();
lines.( {
(line.() && !.(content)) {
findings.({
file,
: index + ,
: ,
: ,
: line.(),
: ,
: ,
:
});
}
});
findings;
}
(: , : ): [] {
: [] = [];
lines = content.();
lines.( {
(line.() && .(line)) {
findings.({
file,
: index + ,
: ,
: ,
: line.(),
: ,
: ,
:
});
}
});
findings;
}
(: ): {
indicators = [, , , , , ];
indicators.( line.(indicator));
}
(: ): {
content.() || content.();
}
}
2. Framework-Specific Detection
class ReactXSSScanner {
scanReactComponent(code: string): XSSFinding[] {
const findings: XSSFinding[] = [];
const unsafePatterns = [
'dangerouslySetInnerHTML',
'createMarkup',
'rawHtml'
];
unsafePatterns.forEach(pattern => {
if (code.includes(pattern) && !code.includes