@workingpayload/agent-skills 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/APIForge/skill.md +150 -17
  2. package/AccessPlus/skill.md +122 -18
  3. package/AlgoMaster/skill.md +110 -17
  4. package/Architekt AI/skill.md +125 -17
  5. package/AuthCraft/skill.md +129 -17
  6. package/AutoScriptor/skill.md +122 -17
  7. package/BoilerCore/skill.md +121 -17
  8. package/BugHunter Pro/skill.md +118 -17
  9. package/ChangeScribe/skill.md +98 -17
  10. package/CodeSage/skill.md +148 -17
  11. package/CommitCraft/skill.md +97 -16
  12. package/CoverageMax/skill.md +145 -16
  13. package/CronGenius/skill.md +141 -16
  14. package/DataPolish/skill.md +126 -16
  15. package/DataWeaver/skill.md +135 -16
  16. package/DockMaster/skill.md +142 -16
  17. package/DocuGenie/skill.md +122 -16
  18. package/EdgeGuard/skill.md +144 -16
  19. package/EnvWizard/skill.md +140 -16
  20. package/ErrorMedic/skill.md +136 -16
  21. package/FeatureSmith/skill.md +123 -16
  22. package/FlexiLayout/skill.md +128 -16
  23. package/FlowTester/skill.md +138 -16
  24. package/FunctionForge/skill.md +120 -16
  25. package/InputShield/skill.md +128 -16
  26. package/IssueForge/skill.md +132 -16
  27. package/KubeCrafter/skill.md +133 -16
  28. package/LogicLens/skill.md +116 -16
  29. package/MockSmith/skill.md +130 -16
  30. package/ModelSensei/skill.md +122 -16
  31. package/PRMentor/skill.md +103 -32
  32. package/PerfDetective/skill.md +90 -32
  33. package/PipelinePro/skill.md +146 -32
  34. package/PolyglotShift/skill.md +94 -32
  35. package/PromptForge/skill.md +118 -32
  36. package/QueryPulse/skill.md +123 -32
  37. package/README.md +416 -329
  38. package/ReadMeCraft/skill.md +127 -32
  39. package/RefactorX/skill.md +84 -32
  40. package/RenderBoost/skill.md +148 -32
  41. package/SEOMancer/skill.md +140 -16
  42. package/ScrapeMaster/skill.md +157 -32
  43. package/SecretSniffer/skill.md +107 -16
  44. package/SecureScan/skill.md +114 -16
  45. package/ServiceSplitter/skill.md +137 -16
  46. package/SpeedSmith/skill.md +139 -16
  47. package/StackWise/skill.md +139 -16
  48. package/TaskOrchestrator/skill.md +119 -16
  49. package/TestCrafter/skill.md +142 -16
  50. package/TraceMind/skill.md +127 -16
  51. package/UISmith/skill.md +115 -16
  52. package/bin/cli.js +377 -0
  53. package/extension-extender/SKILL.md +122 -0
  54. package/fastapi-furious/SKILL.md +148 -0
  55. package/package.json +41 -28
  56. package/python-master/SKILL.md +108 -0
  57. package/react-ranger/SKILL.md +93 -0
  58. package/scripts/build_index.py +282 -0
  59. package/scripts/doctor.py +541 -0
  60. package/scripts/install.py +397 -0
  61. package/scripts/route.py +348 -0
  62. package/scripts/score.py +355 -0
  63. package/scripts/test_skill.py +473 -0
  64. package/scripts/validate.py +254 -0
  65. package/skills-routing.json +1131 -0
  66. package/skills.json +3261 -0
  67. package/Extension-Extender/SKILL.md +0 -41
  68. package/Extension-Extender/references/ui-guidelines.md +0 -26
  69. package/Fastapi-Furious/README.md +0 -16
  70. package/Fastapi-Furious/SKILL.md +0 -37
  71. package/Python-Master/README.md +0 -11
  72. package/Python-Master/SKILL.md +0 -37
  73. package/React-Ranger/README.md +0 -17
  74. package/React-Ranger/SKILL.md +0 -37
  75. package/cli.js +0 -181
  76. package/parse_skills.py +0 -44
  77. /package/{Extension-Extender → extension-extender}/assets/manifest.json +0 -0
  78. /package/{Extension-Extender → extension-extender}/assets/popup.css +0 -0
  79. /package/{Extension-Extender → extension-extender}/assets/popup.html +0 -0
  80. /package/{Extension-Extender → extension-extender}/assets/popup.js +0 -0
@@ -1,32 +1,157 @@
1
- ---
2
- name: scrapemaster
3
- description: Perfects tasks related to building resilient web scrapers, parsing DOM trees, and extracting structured data from unstructured web pages. Use when a user asks to handle automation or requires assistance with scraper..
4
- ---
5
-
6
- # ScrapeMaster
7
-
8
- ## Overview
9
-
10
- The ScrapeMaster skill specializes in building resilient web scrapers, parsing DOM trees, and extracting structured data from unstructured web pages. It is designed to be the perfect, flawless assistant for automation, providing robust, industry-standard solutions.
11
-
12
- ## Workflow
13
-
14
- When asked to work on automation or related tasks, follow these steps:
15
-
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for building resilient web scrapers, parsing DOM trees, and extracting structured data from unstructured web pages.
19
- - Ensure all context and preconditions are understood.
20
-
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of ScrapeMaster perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
25
-
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for automation.
28
- - Ensure the result perfectly resolves the user's request without omissions.
29
-
30
- ## Resources
31
-
32
- - **`references/best-practices.md`**: Core principles for automation.
1
+ ---
2
+ name: scrapemaster
3
+ description: Build resilient web scrapers using a static-vs-JS-rendered decision tree, Playwright/Cheerio/BeautifulSoup, robots.txt compliance, retry/backoff, pagination handling, and structured output schemas. Use when a user needs to extract data from websites, build a scraper, or parse HTML/DOM content.
4
+ ---
5
+
6
+ # ScrapeMaster
7
+
8
+ ## Overview
9
+
10
+ ScrapeMaster builds production-grade scrapers with the right tool for the rendering environment, ethical compliance checks, resilience patterns, and clean output schemas.
11
+
12
+ ## Workflow
13
+
14
+ ### 1. Static vs. JS-Rendered Decision Tree
15
+
16
+ Before writing any code, determine how the target page renders its content:
17
+
18
+ ```
19
+ Does the data appear in `curl https://example.com` raw HTML?
20
+ YES → Static page → use Cheerio (JS) or BeautifulSoup (Python)
21
+ NO → JS-rendered → use Playwright (preferred) or Puppeteer
22
+
23
+ Is the data returned by a JSON API call?
24
+ YES → Call the API directly (inspect Network tab in DevTools → XHR/Fetch)
25
+ → Reverse-engineer the API endpoint instead of scraping the DOM
26
+ NO → Scrape the rendered DOM
27
+ ```
28
+
29
+ Checking for an API endpoint first saves 90% of the work and produces more stable output.
30
+
31
+ ### 2. Compliance Check (Do This Before Writing Code)
32
+
33
+ 1. **Check `robots.txt`**: `https://example.com/robots.txt`. Honor `Disallow` rules for your scraper's User-Agent. If the target explicitly disallows scraping, inform the user and stop.
34
+ 2. **Check Terms of Service**: look for sections on automated access, data scraping, or commercial use.
35
+ 3. **Rate limiting**: never hit a site faster than ~1 request/second without explicit permission. Use `Crawl-delay` from robots.txt if specified.
36
+ 4. **Set a descriptive User-Agent**: `MyCompanyScraper/1.0 (+https://mycompany.com/bot)`.
37
+
38
+ ### 3. Choose the Right Tool
39
+
40
+ **Static HTML (no JS required):**
41
+
42
+ *Python — BeautifulSoup + httpx:*
43
+ ```python
44
+ import httpx
45
+ from bs4 import BeautifulSoup
46
+
47
+ async def fetch_page(url: str) -> BeautifulSoup:
48
+ async with httpx.AsyncClient(headers={"User-Agent": "MyScraper/1.0"}) as client:
49
+ r = await client.get(url, follow_redirects=True)
50
+ r.raise_for_status()
51
+ return BeautifulSoup(r.text, "lxml")
52
+
53
+ soup = await fetch_page("https://example.com/products")
54
+ items = soup.select("div.product-card") # CSS selectors preferred over find_all
55
+ ```
56
+
57
+ *Node.js — Cheerio + got:*
58
+ ```js
59
+ import * as cheerio from 'cheerio';
60
+ import got from 'got';
61
+
62
+ const { body } = await got('https://example.com/products');
63
+ const $ = cheerio.load(body);
64
+ const items = $('div.product-card').map((_, el) => ({
65
+ title: $(el).find('h2').text().trim(),
66
+ price: $(el).find('.price').text().trim(),
67
+ })).get();
68
+ ```
69
+
70
+ **JS-rendered pages (React/Vue/Angular SPA):**
71
+
72
+ *Python — Playwright:*
73
+ ```python
74
+ from playwright.async_api import async_playwright
75
+
76
+ async def scrape_spa(url: str):
77
+ async with async_playwright() as p:
78
+ browser = await p.chromium.launch(headless=True)
79
+ page = await browser.new_page()
80
+ await page.goto(url, wait_until="networkidle")
81
+ # Wait for the specific element that contains your data
82
+ await page.wait_for_selector("div.product-card", timeout=10_000)
83
+ items = await page.eval_on_selector_all(
84
+ "div.product-card",
85
+ "els => els.map(el => ({ title: el.querySelector('h2').textContent.trim() }))"
86
+ )
87
+ await browser.close()
88
+ return items
89
+ ```
90
+
91
+ ### 4. Retry & Backoff Pattern
92
+
93
+ Wrap all network calls in retry logic with exponential backoff:
94
+
95
+ ```python
96
+ from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
97
+
98
+ @retry(stop=stop_after_attempt(3), wait=wait_exponential(min=2, max=30),
99
+ retry=retry_if_exception_type((httpx.HTTPStatusError, httpx.TransportError)))
100
+ async def fetch_with_retry(client, url):
101
+ r = await client.get(url)
102
+ if r.status_code == 429:
103
+ await asyncio.sleep(int(r.headers.get("Retry-After", 60)))
104
+ r.raise_for_status()
105
+ r.raise_for_status()
106
+ return r
107
+ ```
108
+
109
+ In Node.js: `got(url, { retry: { limit: 3, methods: ['GET'] } })`.
110
+
111
+ ### 5. Pagination & Infinite Scroll
112
+
113
+ **Offset pagination:** Increment `?page=N` until `parse_items()` returns empty.
114
+
115
+ **Cursor/next-link:** Follow `a[rel="next"]` href until absent.
116
+
117
+ **Infinite scroll (Playwright):** Simulate scrolling and wait for new network requests:
118
+ ```python
119
+ async def scrape_infinite_scroll(page):
120
+ results = []
121
+ prev_count = 0
122
+ while True:
123
+ items = await page.eval_on_selector_all(".item", "els => els.map(e => e.textContent)")
124
+ results = items
125
+ if len(items) == prev_count:
126
+ break
127
+ prev_count = len(items)
128
+ await page.evaluate("window.scrollTo(0, document.body.scrollHeight)")
129
+ # Wait for new content to load
130
+ await page.wait_for_timeout(1500)
131
+ return results
132
+ ```
133
+ For API-backed infinite scroll, intercept XHR/fetch via `page.on("response", ...)` and collect JSON payloads directly — no DOM parsing needed.
134
+
135
+ ### 6. Define the Output Schema
136
+
137
+ Always define a Pydantic model before parsing. Store prices as integer cents (not float). Export as JSON Lines (`.jsonl`) for large datasets, CSV for tabular consumers, SQLite for queryable output.
138
+
139
+ ### 7. Deliver the Output
140
+
141
+ Provide:
142
+ 1. Decision tree result (static/JS-rendered/API) with evidence.
143
+ 2. Complete scraper script with retry logic and polite delay.
144
+ 3. Output schema (Pydantic model or TypeScript type).
145
+ 4. Sample output (5 records in the schema format).
146
+ 5. robots.txt compliance status.
147
+ 6. Notes on fragility: which CSS selectors are likely to break if the site redesigns.
148
+
149
+ ## Edge Cases
150
+
151
+ **1. Anti-bot detection (Cloudflare, DataDome, PerimeterX).** Do not bypass security controls without explicit permission — this may violate the CFAA. Inform the user; suggest an official API or data partnership. If the user has explicit permission, `playwright-extra` + `puppeteer-extra-plugin-stealth` reduces fingerprinting signals.
152
+
153
+ **2. CAPTCHA walls.** CAPTCHAs are a hard blocker. Surface this clearly to the user. If they have explicit legal permission and a legitimate use case, third-party solving services such as 2captcha or Anti-Captcha can integrate via API. Never attempt to bypass CAPTCHAs on sites where scraping is prohibited.
154
+
155
+ **3. Brittle selectors.** Prefer stability order: `data-testid` > `aria-label`/`role` > meaningful class names > positional selectors. Add record-count validation to catch silent DOM changes.
156
+
157
+ **4. Login-gated content.** Use Playwright `page.fill` + `page.click` for auth, then `context.storage_state(path="state.json")` to reuse sessions across runs. Never hardcode credentials — use environment variables.
@@ -1,32 +1,123 @@
1
1
  ---
2
2
  name: secretsniffer
3
- description: Perfects tasks related to auditing codebases for hardcoded credentials, API keys, and sensitive data exposures before commits. Use when a user asks to handle security or requires assistance with find secrets..
3
+ description: Audits codebases and git history for hardcoded credentials, API keys, and sensitive data exposures. Use when asked to scan for secrets, check for leaked credentials, or set up pre-commit secret detection.
4
4
  ---
5
5
 
6
6
  # SecretSniffer
7
7
 
8
8
  ## Overview
9
9
 
10
- The SecretSniffer skill specializes in auditing codebases for hardcoded credentials, API keys, and sensitive data exposures before commits. It is designed to be the perfect, flawless assistant for security, providing robust, industry-standard solutions.
10
+ Scans source code and git history for hardcoded secrets using industry-standard tools (TruffleHog, Gitleaks, detect-secrets). Classifies findings by severity, maps to secret type, and produces SARIF-compatible output suitable for GitHub Advanced Security or CI gatekeeping.
11
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on security or related tasks, follow these steps:
14
+ ### 1. Scope & Tool Selection
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for auditing codebases for hardcoded credentials, API keys, and sensitive data exposures before commits.
19
- - Ensure all context and preconditions are understood.
16
+ - Determine scan target: working tree only, staged files (pre-commit), or full git history.
17
+ - Select tool based on scope:
18
+ - **TruffleHog v3** (`trufflehog git file://. --json`): deep entropy + regex, best for git history.
19
+ - **Gitleaks** (`gitleaks detect --source . --report-format sarif --report-path findings.sarif`): fast, SARIF output, good for CI.
20
+ - **detect-secrets** (`detect-secrets scan > .secrets.baseline`): baseline-based, low false-positive rate for pre-commit hooks.
21
+ - For pre-commit integration, install via `pre-commit` framework using `gitleaks` or `detect-secrets` hooks.
20
22
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of SecretSniffer perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
23
+ ### 2. Pattern Coverage
25
24
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for security.
28
- - Ensure the result perfectly resolves the user's request without omissions.
25
+ Ensure the scan config covers these high-priority secret types:
29
26
 
30
- ## Resources
27
+ | Secret Type | Regex / Entropy Signal |
28
+ |-------------|------------------------|
29
+ | AWS Access Key | `AKIA[0-9A-Z]{16}` |
30
+ | AWS Secret Key | 40-char base62, high entropy adjacent to "aws_secret" |
31
+ | JWT | `eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+` |
32
+ | PEM private key | `-----BEGIN (RSA\|EC\|OPENSSH) PRIVATE KEY-----` |
33
+ | GCP Service Account | `"type": "service_account"` in JSON |
34
+ | GitHub PAT | `gh[pousr]_[A-Za-z0-9]{36,}` |
35
+ | Generic high-entropy string | Shannon entropy > 4.5 over 20+ char alphanumeric strings |
36
+ | DB connection string | `(postgres\|mysql\|mongodb)://[^@]+:[^@]+@` |
31
37
 
32
- - **`references/best-practices.md`**: Core principles for security.
38
+ For custom patterns, add to `.gitleaks.toml` under `[[rules]]` or extend the `detect-secrets` plugin list.
39
+
40
+ ### 3. Severity Classification
41
+
42
+ Assign severity using this rubric:
43
+
44
+ - **CRITICAL**: Private keys (PEM/PKCS8), cloud provider master credentials (AWS root, GCP service accounts with `roles/owner`), database passwords in production configs.
45
+ - **HIGH**: Active API keys for third-party services (Stripe, Twilio, SendGrid), OAuth client secrets, JWT signing secrets.
46
+ - **MEDIUM**: Tokens that may be expired or test-only, internal service credentials.
47
+ - **LOW**: Patterns matching secret formats but confirmed test/placeholder values (e.g., `test_`, `dummy_`, `example_`).
48
+
49
+ ### 4. Git History Deep Scan
50
+
51
+ When scanning history:
52
+ ```bash
53
+ trufflehog git file://. --since-commit HEAD~100 --json | jq '.SourceMetadata.Data.Git'
54
+ ```
55
+ - Check `--branch` flag to scope to a specific branch.
56
+ - Flag commits that introduced secrets even if later removed — they remain in history and require `git filter-repo` or BFG Repo Cleaner for remediation.
57
+ - Report the commit SHA, author, and timestamp for each finding.
58
+
59
+ ### 5. Output Format
60
+
61
+ Produce findings in two formats:
62
+
63
+ **SARIF** (for GitHub/Azure DevOps integration):
64
+ ```json
65
+ {
66
+ "runs": [{
67
+ "results": [{
68
+ "ruleId": "aws-access-key",
69
+ "level": "error",
70
+ "message": { "text": "AWS Access Key detected" },
71
+ "locations": [{ "physicalLocation": { "artifactLocation": { "uri": "config/settings.py" }, "region": { "startLine": 42 }}}]
72
+ }]
73
+ }]
74
+ }
75
+ ```
76
+
77
+ **Human-readable summary table**:
78
+ ```
79
+ SEVERITY | FILE | LINE | SECRET TYPE | COMMIT
80
+ CRITICAL | config/settings.py | 42 | AWS Access Key | a1b2c3d
81
+ HIGH | .env.example | 7 | Stripe Secret Key | HEAD
82
+ ```
83
+
84
+ ### 6. Remediation Guidance
85
+
86
+ For each confirmed finding, provide:
87
+ 1. **Immediate**: Revoke the exposed credential at the provider (AWS IAM, GitHub settings, Stripe dashboard).
88
+ 2. **Short-term**: Replace with environment variable (`os.environ['SECRET_KEY']`) or secrets manager reference (AWS Secrets Manager ARN, HashiCorp Vault path, Azure Key Vault secret URI).
89
+ 3. **History cleanup**: If in git history, use `git filter-repo --path <file> --invert-paths` or BFG `--delete-files`.
90
+ 4. **Prevention**: Add `.gitleaks.toml` + pre-commit hook, set `SECRETS_BASELINE` in CI to block new commits.
91
+
92
+ ## Additional Scan Targets
93
+
94
+ **Git submodule scanning:** By default, TruffleHog and Gitleaks do not recurse into submodules. Add `--include-submodules` (TruffleHog) or configure `[allowlist] paths` inversely. Run `git submodule update --init --recursive` before scanning so submodule history is available locally.
95
+
96
+ **Jupyter notebook cell output:** Notebook `.ipynb` files store cell outputs (including printed secrets) as JSON. Use `nbstripout` (`pip install nbstripout`) to strip output before committing: `nbstripout --install` adds a pre-commit hook. Scan existing notebooks with `trufflehog filesystem --directory . --json` which reads IPYNB as text and catches secrets in output cells.
97
+
98
+ **Blast radius analysis for shared secrets:** When a secret is shared across multiple services (e.g., a shared DB password, a monorepo-wide signing key), rotation affects all consumers simultaneously. Before rotating: enumerate all services using the secret (`grep` across repos/configs), plan a coordinated rollout, and verify each service's ability to hot-reload secrets (e.g., via AWS Secrets Manager rotation Lambda) before revoking the old credential.
99
+
100
+ ## Edge Cases
101
+
102
+ **False positives in test fixtures**: Suppress with `# gitleaks:allow` inline comment or add path exclusion in `.gitleaks.toml` under `[allowlist] paths`. Always verify suppressed patterns are not real credentials.
103
+
104
+ **Secrets in binary/compiled files**: TruffleHog's `--only-verified` flag reduces noise but may miss unverified live secrets. Run `strings` extraction separately on `.jar`, `.pyc`, `.wasm` artifacts.
105
+
106
+ **Monorepos with multiple .env files**: Scope scans per service directory. Use `gitleaks detect --source ./services/auth` per bounded context to keep signal-to-noise ratio high.
107
+
108
+ ## CI Integration Example
109
+
110
+ ```yaml
111
+ # .github/workflows/secret-scan.yml
112
+ - name: Run Gitleaks
113
+ uses: gitleaks/gitleaks-action@v2
114
+ env:
115
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116
+ with:
117
+ args: --report-format sarif --report-path results.sarif
118
+
119
+ - name: Upload SARIF
120
+ uses: github/codeql-action/upload-sarif@v3
121
+ with:
122
+ sarif_file: results.sarif
123
+ ```
@@ -1,32 +1,130 @@
1
1
  ---
2
2
  name: securescan
3
- description: Perfects tasks related to performing static application security testing (SAST), identifying vulnerabilities, and recommending secure coding practices. Use when a user asks to handle security or requires assistance with security audit..
3
+ description: Performs static application security testing (SAST) to identify OWASP Top 10 vulnerabilities, CWE weaknesses, and insecure coding patterns. Use when asked to security audit code, find vulnerabilities, run SAST analysis, or recommend secure coding fixes.
4
4
  ---
5
5
 
6
6
  # SecureScan
7
7
 
8
8
  ## Overview
9
9
 
10
- The SecureScan skill specializes in performing static application security testing (SAST), identifying vulnerabilities, and recommending secure coding practices. It is designed to be the perfect, flawless assistant for security, providing robust, industry-standard solutions.
10
+ Runs SAST analysis using Semgrep, Bandit (Python), or CodeQL to identify vulnerabilities mapped to OWASP Top 10 2021 and CWE categories. Produces severity-rated findings with taint-tracking paths and concrete remediation guidance — not generic advice.
11
11
 
12
12
  ## Workflow
13
13
 
14
- When asked to work on security or related tasks, follow these steps:
14
+ ### 1. Tool Selection by Language
15
15
 
16
- ### 1. Analysis & Pre-flight
17
- - Analyze the user's request thoroughly.
18
- - Identify the core requirements for performing static application security testing (SAST), identifying vulnerabilities, and recommending secure coding practices.
19
- - Ensure all context and preconditions are understood.
16
+ | Language | Primary Tool | Secondary |
17
+ |----------|-------------|-----------|
18
+ | Python | Bandit (`bandit -r . -f json`) + Semgrep | Safety (deps) |
19
+ | JavaScript/TypeScript | Semgrep (`semgrep --config=p/javascript`) | ESLint security plugin |
20
+ | Java | CodeQL (`codeql database analyze --format=sarif-latest`) | SpotBugs + FindSecBugs |
21
+ | Go | Semgrep (`semgrep --config=p/golang`) | gosec |
22
+ | Ruby | Brakeman (`brakeman -f json`) | Semgrep |
23
+ | PHP | Semgrep + PHPCS Security Audit | |
24
+ | Multi-language | Semgrep with `--config=p/owasp-top-ten` | CodeQL |
20
25
 
21
- ### 2. Execution & Implementation
22
- - Apply the core logic of SecureScan perfectly.
23
- - Prioritize clean architecture, high efficiency, and robust error handling.
24
- - Strive for a flawless, comprehensive solution that directly addresses the user's needs.
26
+ Always run `semgrep --config=p/secrets` alongside SAST for defense-in-depth.
25
27
 
26
- ### 3. Validation & Polish
27
- - Review the generated output against industry best practices for security.
28
- - Ensure the result perfectly resolves the user's request without omissions.
28
+ ### 2. Vulnerability Categories to Check
29
29
 
30
- ## Resources
30
+ Map every finding to OWASP Top 10 2021 and CWE:
31
31
 
32
- - **`references/best-practices.md`**: Core principles for security.
32
+ | OWASP Category | CWE | What to Look For |
33
+ |----------------|-----|------------------|
34
+ | A01 Broken Access Control | CWE-284, CWE-639 | Missing authz checks, IDOR patterns, path traversal |
35
+ | A02 Cryptographic Failures | CWE-327, CWE-330 | Weak algos (MD5/SHA1 for passwords, DES/RC4), hardcoded IV, non-random nonces |
36
+ | A03 Injection | CWE-89, CWE-78, CWE-917 | SQL/NoSQL/LDAP/OS command injection; unsanitized user input in queries |
37
+ | A05 Security Misconfiguration | CWE-16 | Debug mode enabled, permissive CORS (`*`), missing security headers |
38
+ | A07 Auth Failures | CWE-287, CWE-798 | Hardcoded creds, weak session tokens, missing MFA enforcement |
39
+ | A08 SSRF | CWE-918 | User-controlled URLs in HTTP requests without allowlist |
40
+ | A09 Logging Failures | CWE-778, CWE-532 | Sensitive data in logs, missing audit trails for auth events |
41
+
42
+ ### 3. Taint Tracking Analysis
43
+
44
+ For injection vulnerabilities, trace the full taint path:
45
+ 1. **Source**: Where does untrusted input enter? (HTTP params, headers, file uploads, env vars, DB reads from external systems)
46
+ 2. **Propagation**: Does the value flow through transformations that could neutralize it? (sanitize functions, parameterized queries)
47
+ 3. **Sink**: Where does the tainted value land? (SQL execute, `subprocess.run`, `eval`, `innerHTML`, file write)
48
+
49
+ Document taint path in findings:
50
+ ```
51
+ TAINT PATH: request.args['user_id'] → format string → db.execute()
52
+ File: app/routes.py, line 47 → line 53
53
+ CWE-89 (SQL Injection), OWASP A03
54
+ ```
55
+
56
+ ### 4. Severity Rating
57
+
58
+ Use CVSS v3.1 base score guidance:
59
+
60
+ - **CRITICAL (9.0-10.0)**: Unauthenticated RCE, SQLi in auth bypass, hardcoded admin credentials.
61
+ - **HIGH (7.0-8.9)**: Authenticated SQLi/RCE, SSRF with internal network access, broken object-level authorization.
62
+ - **MEDIUM (4.0-6.9)**: Reflected XSS, insecure deserialization without direct code exec, weak crypto for non-password data.
63
+ - **LOW (0.1-3.9)**: Missing security headers, verbose error messages, non-sensitive info disclosure.
64
+ - **INFORMATIONAL**: Style issues, defense-in-depth recommendations.
65
+
66
+ ### 5. Output Format
67
+
68
+ Produce a structured findings report:
69
+
70
+ ```markdown
71
+ ## Finding #1
72
+ - **ID**: SS-2024-001
73
+ - **Severity**: HIGH
74
+ - **CWE**: CWE-89 (SQL Injection)
75
+ - **OWASP**: A03:2021 – Injection
76
+ - **File**: app/models/user.py, line 83
77
+ - **Description**: String interpolation used in raw SQL query with user-supplied input.
78
+ - **Vulnerable Code**:
79
+ ```python
80
+ query = f"SELECT * FROM users WHERE email = '{email}'"
81
+ db.execute(query)
82
+ ```
83
+ - **Taint Path**: `request.form['email']` → `email` parameter → `db.execute()`
84
+ - **Remediation**: Use parameterized queries: `db.execute("SELECT * FROM users WHERE email = ?", (email,))`
85
+ - **References**: CWE-89, OWASP Testing Guide v4 OTG-INPVAL-005
86
+ ```
87
+
88
+ ### 6. Remediation Guidance by Category
89
+
90
+ **SQL Injection**: Always use parameterized queries or ORM (SQLAlchemy, Hibernate, ActiveRecord). Never concatenate user input into query strings.
91
+
92
+ **XSS**: Use framework-native output escaping (React's JSX auto-escaping, Django's `{{ var }}`). For raw HTML insertion, use DOMPurify with strict config.
93
+
94
+ **SSRF**: Validate URLs against an allowlist of domains/IPs. Block `169.254.169.254` (AWS metadata), `::1`, `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`.
95
+
96
+ **Insecure Crypto**: Replace MD5/SHA1 with SHA-256+ for integrity. Use bcrypt/argon2id for passwords (never SHA for passwords). Use AES-256-GCM for symmetric encryption.
97
+
98
+ **Hardcoded Secrets**: Move to environment variables or secrets manager. See SecretSniffer skill for scanner integration.
99
+
100
+ ### 7. Additional Vulnerability Categories
101
+
102
+ **Insecure deserialization (CWE-502):** Deserializing untrusted data with native mechanisms is critical-severity. Java `ObjectInputStream.readObject()` can execute arbitrary code via gadget chains (use ysoserial to test). Python `pickle.loads()` is unsafe on any external input — replace with `json` or `msgpack`. PHP `unserialize()` with user input triggers object injection — use `json_decode()` instead. Flag any deserialization of HTTP body, message queue payloads, or cookie values using these mechanisms.
103
+
104
+ **Supply chain integrity:** Verify that dependency lockfiles (`package-lock.json`, `poetry.lock`, `Cargo.lock`) are committed and pinned to exact versions, not ranges. Check for lockfile hash verification (`npm ci` vs `npm install`). For critical dependencies, verify SLSA provenance attestations (`cosign verify-attestation`). Flag packages that override dependencies of dependencies (`npm overrides`, `pip --constraint`) without hash verification.
105
+
106
+ **Triage workflow for 400+ finding sets:** When SAST produces hundreds of findings, apply this filter order: (1) deduplicate by rule ID + file path, (2) suppress test/generated/vendor directories, (3) group by CWE category and sort by CRITICAL → HIGH, (4) present the top 10 highest-confidence findings first with full taint paths, (5) provide a count summary by severity for the full set. Never present a raw unsorted 400-item list.
107
+
108
+ ## Edge Cases
109
+
110
+ **Third-party library vulnerabilities**: SAST tools miss transitive dependency CVEs. Supplement with `pip-audit`, `npm audit`, `trivy fs .` for dependency scanning. Report OSV database matches separately.
111
+
112
+ **False positives in test code**: Exclude `tests/`, `spec/`, `__tests__/` directories from severity counts but still report them — test code sometimes gets copied to production. Use `# nosec` (Bandit) or `// nosemgrep` inline to suppress confirmed false positives with justification comments.
113
+
114
+ **Framework-specific sinks**: Generic Semgrep rules miss framework-specific injection points (e.g., Django's `RawSQL()`, Spring's `@Query` with native=true, Rails' `find_by_sql`). Augment with framework-specific rulesets: `semgrep --config=p/django` or `semgrep --config=p/spring`.
115
+
116
+ ## CI Integration
117
+
118
+ ```yaml
119
+ - name: Semgrep SAST
120
+ uses: semgrep/semgrep-action@v1
121
+ with:
122
+ config: >-
123
+ p/owasp-top-ten
124
+ p/secrets
125
+ p/default
126
+ env:
127
+ SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
128
+ ```
129
+
130
+ Block PRs on CRITICAL/HIGH findings. Report MEDIUM/LOW as warnings. Upload SARIF to GitHub Security tab.