

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
12345# JavaScript Vulnerable and Outdated Components (OWASP A06:2021)67<rule>8name: javascript_vulnerable_outdated_components9description: Detect and prevent the use of vulnerable and outdated components in JavaScript applications as defined in OWASP Top 10:2021-A061011actions:12 - type: enforce13 conditions:14 # Pattern 1: Outdated Package Versions in package.json15 - pattern: "\"(dependencies|devDependencies)\"\\s*:\\s*\\{[^}]*?\"([^\"]+)\"\\s*:\\s*\"\\^?([0-9]+\\.[0-9]+\\.[0-9]+)\""16 location: "package\\.json$"17 message: "Check for outdated dependencies in package.json. Regularly update dependencies to avoid known vulnerabilities."1819 # Pattern 2: Direct CDN Links Without Integrity Hashes20 - pattern: "<script\\s+src=['\"]https?://(?:cdn|unpkg|jsdelivr)[^'\"]*['\"][^>]*(?!integrity=)"21 location: "\\.(html|js|jsx|ts|tsx)$"22 message: "CDN resources without integrity hashes. Add integrity and crossorigin attributes to script tags loading external resources."2324 # Pattern 3: Hardcoded Library Versions in HTML25 - pattern: "<script\\s+src=['\"][^'\"]*(?:jquery|bootstrap|react|vue|angular|lodash|moment)[@-][0-9]+\\.[0-9]+\\.[0-9]+[^'\"]*['\"]"26 location: "\\.html$"27 message: "Hardcoded library versions in HTML. Consider using a package manager to manage dependencies."2829 # Pattern 4: Deprecated Node.js APIs30 - pattern: "(?:new Buffer\\(|require\\(['\"]crypto['\"]\\)\\.createCipher\\(|require\\(['\"]crypto['\"]\\)\\.randomBytes\\([^,)]+\\)|require\\(['\"]fs['\"]\\)\\.exists\\()"31 message: "Using deprecated Node.js APIs. Replace with modern alternatives to avoid security and maintenance issues."3233 # Pattern 5: Deprecated Browser APIs34 - pattern: "document\\.write\\(|document\\.execCommand\\(|escape\\(|unescape\\(|showModalDialog\\(|localStorage\\.clear\\(\\)|sessionStorage\\.clear\\(\\)"35 location: "(?:src|components|pages)"36 message: "Using deprecated browser APIs. Replace with modern alternatives to avoid compatibility and security issues."3738 # Pattern 6: Insecure Dependency Loading39 - pattern: "require\\([^)]*?\\+\\s*[^)]+\\)|import\\([^)]*?\\+\\s*[^)]+\\)"40 message: "Dynamic dependency loading with variable concatenation. This can lead to dependency confusion attacks."4142 # Pattern 7: Vulnerable Regular Expression Patterns (ReDoS)43 - pattern: "new RegExp\\([^)]*?(?:\\(.*\\)\\*|\\*\\+|\\+\\*|\\{\\d+,\\})"44 message: "Potentially vulnerable regular expression pattern that could lead to ReDoS attacks. Review and optimize the regex pattern."4546 # Pattern 8: Insecure Package Installation47 - pattern: "npm\\s+install\\s+(?:--no-save|--no-audit|--no-fund|--force)"48 location: "(?:scripts|Dockerfile|docker-compose\\.yml|\\.github/workflows)"49 message: "Insecure package installation flags. Avoid using --no-audit, --no-save, or --force flags when installing packages."5051 # Pattern 9: Missing Lock Files52 - pattern: "package\\.json"53 location: "package\\.json$"54 negative_pattern: "package-lock\\.json|yarn\\.lock|pnpm-lock\\.yaml"55 message: "Missing lock file. Use package-lock.json, yarn.lock, or pnpm-lock.yaml to ensure dependency consistency."5657 # Pattern 10: Insecure Webpack Configuration58 - pattern: "webpack\\.config\\.js"59 location: "webpack\\.config\\.js$"60 negative_pattern: "(?:noEmitOnErrors|optimization\\.minimize)"61 message: "Potentially insecure webpack configuration. Consider enabling noEmitOnErrors and optimization.minimize."6263 # Pattern 11: Outdated TypeScript Configuration64 - pattern: "\"compilerOptions\"\\s*:\\s*\\{[^}]*?\"target\"\\s*:\\s*\"ES5\""65 location: "tsconfig\\.json$"66 message: "Outdated TypeScript target. Consider using a more modern target like ES2020 for better security features."6768 # Pattern 12: Insecure Package Sources69 - pattern: "registry\\s*=\\s*(?!https://registry\\.npmjs\\.org)"70 location: "\\.npmrc$"71 message: "Using a non-standard npm registry. Ensure you trust the source of your packages."7273 # Pattern 13: Missing npm audit in CI/CD74 - pattern: "(?:ci|test|build)\\s*:\\s*\"[^\"]*?\""75 location: "package\\.json$"76 negative_pattern: "npm\\s+audit"77 message: "Missing npm audit in CI/CD scripts. Add 'npm audit' to your CI/CD pipeline to detect vulnerabilities."7879 # Pattern 14: Insecure Import Maps80 - pattern: "<script\\s+type=['\"]importmap['\"][^>]*>[^<]*?\"imports\"\\s*:\\s*\\{[^}]*?\"[^\"]+\"\\s*:\\s*\"https?://[^\"]+\""81 negative_pattern: "integrity="82 message: "Insecure import maps without integrity checks. Add integrity hashes to import map entries."8384 # Pattern 15: Outdated Polyfills85 - pattern: "(?:core-js|@babel/polyfill|es6-promise|whatwg-fetch)"86 message: "Using potentially outdated polyfills. Consider using modern alternatives or feature detection."8788 - type: suggest89 message: |90 **JavaScript Vulnerable and Outdated Components Best Practices:**9192 1. **Dependency Management:**93 - Regularly update dependencies to their latest secure versions94 - Use tools like npm audit, Snyk, or Dependabot to detect vulnerabilities95 - Example:96```javascript97 // Add these scripts to package.json98 {99 "scripts": {100 "audit": "npm audit",101 "audit:fix": "npm audit fix",102 "outdated": "npm outdated",103 "update": "npm update",104 "prestart": "npm audit --production"105 }106 }107```108109 2. **Lock Files:**110 - Always use lock files (package-lock.json, yarn.lock, or pnpm-lock.yaml)111 - Commit lock files to version control112 - Example:113```bash114 # Generate a lock file if it doesn't exist115 npm install116117 # Or for Yarn118 yarn119120 # Or for pnpm121 pnpm install122```123124 3. **Subresource Integrity:**125 - Use integrity hashes when loading resources from CDNs126 - Example:127```html128 <script129 src="https://cdn.jsdelivr.net/npm/react@18.2.0/umd/react.production.min.js"130 integrity="sha384-tMH8h3BGESGckSAVGZ82T9n90ztNepwCjSPJ0A7g2vdY8M0oKtDaDGg0G53cysJA"131 crossorigin="anonymous">132 </script>133```134135 4. **Automated Security Scanning:**136 - Integrate security scanning into your CI/CD pipeline137 - Example GitHub Actions workflow:138```yaml139 name: Security Scan140141 on:142 push:143 branches: [ main ]144 pull_request:145 branches: [ main ]146 schedule:147 - cron: '0 0 * * 0' # Run weekly148149 jobs:150 security:151 runs-on: ubuntu-latest152 steps:153 - uses: actions/checkout@v3154 - name: Setup Node.js155 uses: actions/setup-node@v3156 with:157 node-version: '18'158 cache: 'npm'159 - name: Install dependencies160 run: npm ci161 - name: Run security audit162 run: npm audit --audit-level=high163 - name: Run Snyk to check for vulnerabilities164 uses: snyk/actions/node@master165 env:166 SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}167```168169 5. **Dependency Pinning:**170 - Pin dependencies to specific versions to prevent unexpected updates171 - Example:172```json173 {174 "dependencies": {175 "express": "4.18.2",176 "react": "18.2.0",177 "lodash": "4.17.21"178 }179 }180```181182 6. **Deprecated API Replacement:**183 - Replace deprecated Node.js APIs with modern alternatives184 - Example:185```javascript186 // INSECURE: Using deprecated Buffer constructor187 const buffer = new Buffer(data);188189 // SECURE: Using Buffer.from()190 const buffer = Buffer.from(data);191192 // INSECURE: Using deprecated crypto methods193 const crypto = require('crypto');194 const cipher = crypto.createCipher('aes-256-cbc', key);195196 // SECURE: Using modern crypto methods197 const crypto = require('crypto');198 const iv = crypto.randomBytes(16);199 const cipher = crypto.createCipheriv('aes-256-cbc', key, iv);200```201202 7. **Browser API Modernization:**203 - Replace deprecated browser APIs with modern alternatives204 - Example:205```javascript206 // INSECURE: Using document.write207 document.write('<h1>Hello World</h1>');208209 // SECURE: Using DOM manipulation210 document.getElementById('content').innerHTML = '<h1>Hello World</h1>';211212 // INSECURE: Using escape/unescape213 const encoded = escape(data);214215 // SECURE: Using encodeURIComponent216 const encoded = encodeURIComponent(data);217```218219 8. **Safe Dynamic Imports:**220 - Avoid dynamic imports with variable concatenation221 - Example:222```javascript223 // INSECURE: Dynamic import with concatenation224 const moduleName = userInput;225 import('./' + moduleName + '.js');226227 // SECURE: Validate input against a whitelist228 const validModules = ['module1', 'module2', 'module3'];229 if (validModules.includes(moduleName)) {230 import(`./${moduleName}.js`);231 }232```233234 9. **Regular Expression Safety:**235 - Avoid vulnerable regex patterns that could lead to ReDoS attacks236 - Example:237```javascript238 // INSECURE: Vulnerable regex pattern239 const regex = /^(a+)+$/;240241 // SECURE: Optimized regex pattern242 const regex = /^a+$/;243```244245 10. **Vendor Management:**246 - Evaluate the security posture of third-party libraries before use247 - Prefer libraries with active maintenance and security focus248 - Example evaluation criteria:249 - When was the last commit?250 - How quickly are security issues addressed?251 - Does the project have a security policy?252 - Is there a responsible disclosure process?253 - How many open issues and pull requests exist?254 - What is the download count and GitHub stars?255256 11. **Runtime Dependency Checking:**257 - Implement runtime checks for critical dependencies258 - Example:259```javascript260 // Check package version at runtime for critical dependencies261 try {262 const packageJson = require('some-critical-package/package.json');263 const semver = require('semver');264265 if (semver.lt(packageJson.version, '2.0.0')) {266 console.warn('Warning: Using a potentially vulnerable version of some-critical-package');267 }268 } catch (err) {269 console.error('Error checking package version:', err);270 }271```272273 12. **Minimal Dependencies:**274 - Minimize the number of dependencies to reduce attack surface275 - Regularly audit and remove unused dependencies276 - Example:277```bash278 # Find unused dependencies279 npx depcheck280281 # Analyze your bundle size282 npx webpack-bundle-analyzer283```284285 - type: validate286 conditions:287 # Check 1: Using npm audit288 - pattern: "\"scripts\"\\s*:\\s*\\{[^}]*?\"audit\"\\s*:\\s*\"npm audit"289 message: "Using npm audit to check for vulnerabilities."290291 # Check 2: Using lock files292 - pattern: "package-lock\\.json|yarn\\.lock|pnpm-lock\\.yaml"293 message: "Using lock files to ensure dependency consistency."294295 # Check 3: Using integrity hashes296 - pattern: "integrity=['\"]sha\\d+-[A-Za-z0-9+/=]+['\"]"297 message: "Using subresource integrity hashes for external resources."298299 # Check 4: Using modern Buffer API300 - pattern: "Buffer\\.(?:from|alloc|allocUnsafe)"301 message: "Using modern Buffer API instead of deprecated constructor."302303 # Check 5: Using dependency scanning in CI304 - pattern: "npm\\s+audit|snyk\\s+test|yarn\\s+audit"305 location: "(?:\\.github/workflows|\\.gitlab-ci\\.yml|Jenkinsfile|azure-pipelines\\.yml)"306 message: "Integrating dependency scanning in CI/CD pipeline."307308metadata:309 priority: high310 version: 1.0311 tags:312 - security313 - javascript314 - nodejs315 - browser316 - dependencies317 - owasp318 - language:javascript319 - framework:express320 - framework:react321 - framework:vue322 - framework:angular323 - category:security324 - subcategory:dependencies325 - standard:owasp-top10326 - risk:a06-vulnerable-outdated-components327 references:328 - "https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/"329 - "https://cheatsheetseries.owasp.org/cheatsheets/Nodejs_Security_Cheat_Sheet.html"330 - "https://cheatsheetseries.owasp.org/cheatsheets/NPM_Security_Cheat_Sheet.html"331 - "https://docs.npmjs.com/cli/v8/commands/npm-audit"332 - "https://snyk.io/learn/npm-security/"333 - "https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity"334 - "https://github.com/OWASP/NodeGoat"335 - "https://owasp.org/www-project-dependency-check/"336</rule>337
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ivangrynenko/cursorrules.cursor/rules/cursor-rules.mdc · 86 | Cursor rules | teststylearchgit+2 | 77/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/behat-steps.mdc · 86 | Cursor rules | lint-formatstyleperformanceagent-behaviour | 42/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/php-drupal-development-standards.mdc · 86 | Cursor rules | no sections | 34/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/python-insecure-design.mdc · 86 | Cursor rules | no sections | 40/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/python-cryptographic-failures.mdc · 86 | Cursor rules | security | 40/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/python-injection.mdc · 86 | Cursor rules | styledo-not | 51/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/node-dependencies.mdc · 86 | Cursor rules | no sections | 16/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/behat-ai-guide.mdc · 86 | Cursor rules | testtesting-strategydo-not | 45/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/new-pull-request.mdc · 86 | Cursor rules | archtesting-strategygitsecurity+3 | 58/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/accessibility-standards.mdc · 86 | Cursor rules | ui | 44/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/api-standards.mdc · 86 | Cursor rules | api | 44/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/build-optimization.mdc · 86 | Cursor rules | build | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/code-generation-standards.mdc · 86 | Cursor rules | lint-formatstyletypesdocs | 52/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/confluence-editing-standards.mdc · 86 | Cursor rules | stylearchsecuritydeployment | 60/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/debugging-standards.mdc · 86 | Cursor rules | no sections | 30/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/docker-compose-standards.mdc · 86 | Cursor rules | style | 62/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-authentication-failures.mdc · 86 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-broken-access-control.mdc · 86 | Cursor rules | stylesecurity | 52/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-cryptographic-failures.mdc · 86 | Cursor rules | security | 48/100 | 14 days ago | |
| ivangrynenko/cursorrules.cursor/rules/drupal-database-standards.mdc · 86 | Cursor rules | database | 30/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/gh-task-plan.mdc · 1.4k | Cursor rules | teststylearchtypes+2 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-user-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 14 days ago | |
| skillrecordings/egghead-next.cursor/rules/project-update-rules.mdc · 1.4k | Cursor rules | buildtestlint-formatstyle+7 | 96/100 | 14 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/proto.mdc · 126 | Cursor rules | buildlint-formatstylearch+3 | 96/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/ivangrynenko-cursorrules-cursor-rules-javascript-vulnerable-outdated-components)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.
Directory