| name | security-review |
| description | Comprehensive security review skill that analyzes code for security vulnerabilities and best practices including input validation, injection prevention, secret handling, unsafe operations, path traversal, authentication, and OWASP Top 10 compliance. Use when performing security-focused code reviews. |
Security Review
Performs comprehensive security analysis of the Black Duck Security Scan codebase, identifying vulnerabilities and ensuring security best practices are followed. Always read changed files before producing findings. Never flag theoretical risks when the code pattern already mitigates them.
Usage
Run this skill when the user requests:
- "Review code security"
- "Check for security vulnerabilities"
- "Perform security audit"
- "Security scan"
- "SAST review"
- "Check for security issues"
- "OWASP Top 10 review"
How to Use
When conducting a security review:
- Read all changed files (or files specified by user)
- Run each checklist section below against the code
- Report findings as:
file:line — [SEVERITY] — vulnerability — remediation
- Use severity tags:
CRITICAL, HIGH, MEDIUM, LOW
Severity Reference
| Tag | Meaning | Examples |
|---|
CRITICAL | Direct credential exfiltration or code execution possible | Hardcoded secrets, command injection, eval() on user input |
HIGH | Credential leak to logs/files, injection vulnerability, TLS bypass | Secrets in logs, path traversal, SQL injection, rejectUnauthorized: false |
MEDIUM | Conditional exposure, information disclosure | Error messages with sensitive data, missing input validation |
LOW | Defense-in-depth hardening, not exploitable alone | Missing rate limiting, weak cipher suites |
Checklist 1 — Secret and Credential Logging
Context: Credentials flow through inputs.ts exports (POLARIS_ACCESS_TOKEN, BLACKDUCKSCA_API_TOKEN, COVERITY_USER, COVERITY_PASSPHRASE, GITHUB_TOKEN). These are written into JSON input files and passed to Bridge CLI.
Checks:
Remediation pattern:
core.info(`Using token: ${POLARIS_ACCESS_TOKEN}`)
console.log(`Config: ${JSON.stringify(polarisData)}`)
core.setSecret(POLARIS_ACCESS_TOKEN)
core.info(`Connecting to server: ${POLARIS_SERVER_URL}`)
core.info(`Generated input file at: ${inputFilePath}`)
CRITICAL risk: Credentials in logs are visible to anyone with Actions read access and persist in log storage.
Checklist 2 — Credential Exposure in Temporary Files
Context: tools-parameter.ts writes full product config (including access tokens) to temp files: polaris_input.json, bd_input.json, etc. These live in os.tmpdir() during action execution.
Checks:
Remediation pattern:
const inputFile = '/tmp/polaris_input.json'
const inputFile = path.join(process.cwd(), 'polaris_input.json')
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'action_temp_'))
const inputFile = path.join(tempDir, 'polaris_input.json')
try {
} finally {
fs.rmSync(tempDir, { recursive: true, force: true })
}
HIGH risk: If temp files persist or are in accessible locations, other processes/users can read credentials.
Checklist 3 — Command Injection
Context: @actions/exec is used to execute Bridge CLI. The command is built by concatenating --stage and --input flags in tools-parameter.ts.
Checks:
Remediation pattern:
exec(`bridge-cli --stage ${userInput}`)
await exec.exec('bridge-cli', ['--stage', 'polaris', '--input', inputPath])
CRITICAL risk: Shell injection allows arbitrary command execution on the runner.
Checklist 4 — Path Traversal
Context: File paths are constructed in utility.ts, tools-parameter.ts, and user-controlled inputs include BRIDGECLI_INSTALL_DIRECTORY, temp file paths, SARIF file paths.
Checks:
Remediation pattern:
fs.readFile(userPath)
const basePath = path.resolve(process.env.GITHUB_WORKSPACE)
const userPath = path.resolve(inputs.CUSTOM_PATH)
const normalizedPath = path.normalize(userPath)
if (!normalizedPath.startsWith(basePath + path.sep) && normalizedPath !== basePath) {
throw new Error('Path traversal detected')
}
fs.readFileSync(normalizedPath)
HIGH risk: Path traversal can read/write arbitrary files on the runner, including secrets from other jobs.
Checklist 5 — TLS / SSL Security
Context: ssl-utils.ts handles custom CA certificates. Network operations use https module and axios.
Checks:
Remediation pattern:
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
const agent = new https.Agent({ rejectUnauthorized: false })
HIGH risk: TLS bypass enables man-in-the-middle attacks.
Checklist 6 — Token Handling and Authorization
Context: GITHUB_TOKEN is used for GitHub API operations. Other tokens passed to Bridge CLI.
Checks:
Remediation pattern:
const token = core.getInput('github_token')
core.info(`Using token: ${token}`)
const token = core.getInput('github_token')
core.setSecret(token)
core.info('GitHub token configured')
HIGH risk: Exposed tokens allow unauthorized API access and repository operations.
Checklist 7 — Input Injection into JSON Payloads
Context: User inputs (URLs, project names, assessment types) are serialized into *_input.json via JSON.stringify().
Checks:
Remediation pattern:
const json = `{"token": "${userToken}"}`
const data: PolarisData = {
accesstoken: userToken,
serverUrl: userUrl
}
const json = JSON.stringify({ data: { polaris: data } })
MEDIUM risk: JSON injection can alter structure or inject unexpected fields.
Checklist 8 — GitHub Actions Environment Security
Context: GitHub Actions exposes environment variables and allows setting outputs/variables.
Checks:
Remediation pattern:
core.setOutput('polaris_token', accessToken)
core.setOutput('scan_status', exitCode === 0 ? 'success' : 'failure')
HIGH risk: Outputs are visible in workflow logs and to downstream jobs.
Checklist 9 — Dependency and Supply Chain Security
Checks:
Remediation pattern:
npm audit
npm audit fix
npm install
npm run package
CRITICAL risk: Vulnerable dependencies can be exploited if they process untrusted input.
Checklist 10 — Error Message Information Disclosure
Context: Error messages from validators.ts, bridge-cli.ts, tools-parameter.ts appear in GitHub Actions logs visible to repository members.
Checks:
Remediation pattern:
throw new Error(`Invalid token: ${token}`)
throw new Error('polaris_access_token is required but not provided')
MEDIUM risk: Information disclosure aids attackers in reconnaissance.
OWASP Top 10 Compliance Checklist
Run through this for comprehensive coverage:
1. Injection (A03:2021)
2. Cryptographic Failures (A02:2021)
3. Injection (covered above)
4. Insecure Design (A04:2021)
5. Security Misconfiguration (A05:2021)
6. Vulnerable and Outdated Components (A06:2021)
7. Identification and Authentication Failures (A07:2021)
8. Software and Data Integrity Failures (A08:2021)
9. Security Logging and Monitoring Failures (A09:2021)
10. Server-Side Request Forgery (A10:2021)
Known Safe Patterns (Do Not Flag)
These patterns are secure by design — do not flag as vulnerabilities:
- ✅
@actions/exec with array args — not shell injection vulnerable
- ✅
path.join(tempDir, filename) for generated JSON files — safe if tempDir from os.tmpdir()
- ✅
JSON.stringify(typedObject) where object from typed model — not prototype pollution
- ✅
core.setSecret(token) before logging — correct masking pattern
- ✅
fs.mkdtempSync(path.join(os.tmpdir(), prefix)) — secure temp directory
- ✅ Reading
process.env.GITHUB_* variables — these are GitHub-controlled
- ✅
@actions/core, @actions/exec, @actions/github usage — official GitHub packages
Security Scanning Process
Step 1: Automated Scans
npm audit
npm outdated
npm run build
Step 2: Pattern-Based Search
grep -r "password\s*=\s*['\"]" src/
grep -r "api[-_]key\s*=\s*['\"]" src/
grep -r "token\s*=\s*['\"]" src/
grep -r "eval(" src/
grep -r "new Function" src/
grep -r "exec(" src/
grep -r "spawn(" src/
grep -r "fs.readFile" src/
grep -r "fs.writeFile" src/
Step 3: Manual Code Review
For each security area:
- Run automated checks
- Apply checklist
- Document findings
- Prioritize by severity
Security Report Format
# Security Review Report
**Date**: [Date]
**Reviewer**: Security Review Skill
**Scope**: [Files reviewed]
## Executive Summary
### Overall Security Posture: [SECURE / VULNERABLE / CRITICAL]
- **Critical Issues**: [count]
- **High Priority**: [count]
- **Medium Priority**: [count]
- **Low Priority**: [count]
---
## Critical Issues (Fix Immediately)
### 1. [Vulnerability Name]
- **File**: `file.ts:line`
- **Category**: [Secret Handling / Injection / etc.]
- **Severity**: CRITICAL
- **Problem**: [Description]
- **Impact**: [What attacker can do]
- **Remediation**:
```typescript
// Current (vulnerable)
[bad code]
// Fixed
[good code]
High Priority Issues
[Same format as Critical]
Medium Priority Issues
[Same format]
Low Priority Issues
[Same format]
OWASP Top 10 Assessment
| Category | Status | Issues |
|---|
| Injection | ✅/⚠️/❌ | [count] |
| Cryptographic Failures | ✅/⚠️/❌ | [count] |
| [etc] | | |
Recommendations
Immediate (This Week)
- Fix all critical issues
- Rotate any exposed credentials
- [...]
Short-term (This Month)
- Fix high priority issues
- Add security tests
- [...]
Long-term (This Quarter)
- Automated security scanning in CI/CD
- Regular dependency audits
- Security training
Dependencies Audit
npm audit summary:
Critical: [count]
High: [count]
Medium: [count]
Low: [count]
Action Required:
- Update [package] to [version] (fixes CVE-XXXX-YYYY)
Next Steps:
- Address critical findings immediately
- Create issues for high/medium
- Schedule re-review after fixes
---
## Best Practices
### Review Principles
- **Risk-based**: Prioritize by impact and exploitability
- **Comprehensive**: Cover all OWASP Top 10
- **Actionable**: Provide specific remediation with code examples
- **Verifiable**: Include file:line references
### When to Run
- Before every release
- After adding new features
- When dependencies change
- After security incidents
- Weekly as part of security hygiene
### Tools to Use
- `npm audit` for dependency scanning
- `grep` for pattern-based searching
- Manual code review for logic flaws
- GitHub security alerts for vulnerable dependencies