mirror of
https://github.com/wshobson/agents.git
synced 2026-03-18 09:37:15 +00:00
style: format all files with prettier
This commit is contained in:
@@ -36,20 +36,20 @@ Systematic attack path visualization and analysis.
|
||||
|
||||
### 2. Node Types
|
||||
|
||||
| Type | Symbol | Description |
|
||||
|------|--------|-------------|
|
||||
| **OR** | Oval | Any child achieves goal |
|
||||
| **AND** | Rectangle | All children required |
|
||||
| **Leaf** | Box | Atomic attack step |
|
||||
| Type | Symbol | Description |
|
||||
| -------- | --------- | ----------------------- |
|
||||
| **OR** | Oval | Any child achieves goal |
|
||||
| **AND** | Rectangle | All children required |
|
||||
| **Leaf** | Box | Atomic attack step |
|
||||
|
||||
### 3. Attack Attributes
|
||||
|
||||
| Attribute | Description | Values |
|
||||
|-----------|-------------|--------|
|
||||
| **Cost** | Resources needed | $, $$, $$$ |
|
||||
| **Time** | Duration to execute | Hours, Days, Weeks |
|
||||
| **Skill** | Expertise required | Low, Medium, High |
|
||||
| **Detection** | Likelihood of detection | Low, Medium, High |
|
||||
| Attribute | Description | Values |
|
||||
| ------------- | ----------------------- | ------------------ |
|
||||
| **Cost** | Resources needed | $, $$, $$$ |
|
||||
| **Time** | Duration to execute | Hours, Days, Weeks |
|
||||
| **Skill** | Expertise required | Low, Medium, High |
|
||||
| **Detection** | Likelihood of detection | Low, Medium, High |
|
||||
|
||||
## Templates
|
||||
|
||||
@@ -665,6 +665,7 @@ class AttackPathAnalyzer:
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Start with clear goals** - Define what attacker wants
|
||||
- **Be exhaustive** - Consider all attack vectors
|
||||
- **Attribute attacks** - Cost, skill, and detection
|
||||
@@ -672,6 +673,7 @@ class AttackPathAnalyzer:
|
||||
- **Validate with experts** - Red team review
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't oversimplify** - Real attacks are complex
|
||||
- **Don't ignore dependencies** - AND nodes matter
|
||||
- **Don't forget insider threats** - Not all attackers are external
|
||||
|
||||
@@ -20,6 +20,7 @@ This skill provides comprehensive guidance for setting up and configuring SAST t
|
||||
## Core Capabilities
|
||||
|
||||
### 1. Semgrep Configuration
|
||||
|
||||
- Custom rule creation with pattern matching
|
||||
- Language-specific security rules (Python, JavaScript, Go, Java, etc.)
|
||||
- CI/CD integration (GitHub Actions, GitLab CI, Jenkins)
|
||||
@@ -27,6 +28,7 @@ This skill provides comprehensive guidance for setting up and configuring SAST t
|
||||
- Organizational policy enforcement
|
||||
|
||||
### 2. SonarQube Setup
|
||||
|
||||
- Quality gate configuration
|
||||
- Security hotspot analysis
|
||||
- Code coverage and technical debt tracking
|
||||
@@ -34,6 +36,7 @@ This skill provides comprehensive guidance for setting up and configuring SAST t
|
||||
- Enterprise integration with LDAP/SAML
|
||||
|
||||
### 3. CodeQL Analysis
|
||||
|
||||
- GitHub Advanced Security integration
|
||||
- Custom query development
|
||||
- Vulnerability variant analysis
|
||||
@@ -43,12 +46,14 @@ This skill provides comprehensive guidance for setting up and configuring SAST t
|
||||
## Quick Start
|
||||
|
||||
### Initial Assessment
|
||||
|
||||
1. Identify primary programming languages in your codebase
|
||||
2. Determine compliance requirements (PCI-DSS, SOC 2, etc.)
|
||||
3. Choose SAST tool based on language support and integration needs
|
||||
4. Review baseline scan to understand current security posture
|
||||
|
||||
### Basic Setup
|
||||
|
||||
```bash
|
||||
# Semgrep quick start
|
||||
pip install semgrep
|
||||
@@ -77,6 +82,7 @@ codeql database create mydb --language=python
|
||||
## Integration Patterns
|
||||
|
||||
### CI/CD Pipeline Integration
|
||||
|
||||
```yaml
|
||||
# GitHub Actions example
|
||||
- name: Run Semgrep
|
||||
@@ -88,6 +94,7 @@ codeql database create mydb --language=python
|
||||
```
|
||||
|
||||
### Pre-commit Hook
|
||||
|
||||
```bash
|
||||
# .pre-commit-config.yaml
|
||||
- repo: https://github.com/returntocorp/semgrep
|
||||
@@ -127,11 +134,13 @@ codeql database create mydb --language=python
|
||||
## Common Use Cases
|
||||
|
||||
### New Project Setup
|
||||
|
||||
```bash
|
||||
./scripts/run-sast.sh --setup --language python --tools semgrep,sonarqube
|
||||
```
|
||||
|
||||
### Custom Rule Development
|
||||
|
||||
```yaml
|
||||
# See references/semgrep-rules.md for detailed examples
|
||||
rules:
|
||||
@@ -142,6 +151,7 @@ rules:
|
||||
```
|
||||
|
||||
### Compliance Scanning
|
||||
|
||||
```bash
|
||||
# PCI-DSS focused scan
|
||||
semgrep --config p/pci-dss --json -o pci-scan-results.json
|
||||
@@ -150,18 +160,21 @@ semgrep --config p/pci-dss --json -o pci-scan-results.json
|
||||
## Troubleshooting
|
||||
|
||||
### High False Positive Rate
|
||||
|
||||
- Review and tune rule sensitivity
|
||||
- Add path filters to exclude test files
|
||||
- Use nostmt metadata for noisy patterns
|
||||
- Create organization-specific rule exceptions
|
||||
|
||||
### Performance Issues
|
||||
|
||||
- Enable incremental scanning
|
||||
- Parallelize scans across modules
|
||||
- Optimize rule patterns for efficiency
|
||||
- Cache dependencies and scan results
|
||||
|
||||
### Integration Failures
|
||||
|
||||
- Verify API tokens and credentials
|
||||
- Check network connectivity and proxy settings
|
||||
- Review SARIF output format compatibility
|
||||
@@ -175,11 +188,11 @@ semgrep --config p/pci-dss --json -o pci-scan-results.json
|
||||
|
||||
## Tool Comparison
|
||||
|
||||
| Tool | Best For | Language Support | Cost | Integration |
|
||||
|------|----------|------------------|------|-------------|
|
||||
| Semgrep | Custom rules, fast scans | 30+ languages | Free/Enterprise | Excellent |
|
||||
| SonarQube | Code quality + security | 25+ languages | Free/Commercial | Good |
|
||||
| CodeQL | Deep analysis, research | 10+ languages | Free (OSS) | GitHub native |
|
||||
| Tool | Best For | Language Support | Cost | Integration |
|
||||
| --------- | ------------------------ | ---------------- | --------------- | ------------- |
|
||||
| Semgrep | Custom rules, fast scans | 30+ languages | Free/Enterprise | Excellent |
|
||||
| SonarQube | Code quality + security | 25+ languages | Free/Commercial | Good |
|
||||
| CodeQL | Deep analysis, research | 10+ languages | Free (OSS) | GitHub native |
|
||||
|
||||
## Next Steps
|
||||
|
||||
|
||||
@@ -29,20 +29,20 @@ Business Requirements → Security Requirements → Technical Controls
|
||||
|
||||
### 2. Security Requirement Types
|
||||
|
||||
| Type | Focus | Example |
|
||||
|------|-------|---------|
|
||||
| **Functional** | What system must do | "System must authenticate users" |
|
||||
| Type | Focus | Example |
|
||||
| ------------------ | ----------------------- | ------------------------------------- |
|
||||
| **Functional** | What system must do | "System must authenticate users" |
|
||||
| **Non-functional** | How system must perform | "Authentication must complete in <2s" |
|
||||
| **Constraint** | Limitations imposed | "Must use approved crypto libraries" |
|
||||
| **Constraint** | Limitations imposed | "Must use approved crypto libraries" |
|
||||
|
||||
### 3. Requirement Attributes
|
||||
|
||||
| Attribute | Description |
|
||||
|-----------|-------------|
|
||||
| Attribute | Description |
|
||||
| ---------------- | --------------------------- |
|
||||
| **Traceability** | Links to threats/compliance |
|
||||
| **Testability** | Can be verified |
|
||||
| **Priority** | Business importance |
|
||||
| **Risk Level** | Impact if not met |
|
||||
| **Testability** | Can be verified |
|
||||
| **Priority** | Business importance |
|
||||
| **Risk Level** | Impact if not met |
|
||||
|
||||
## Templates
|
||||
|
||||
@@ -657,6 +657,7 @@ This epic covers all security requirements related to {domain.value.replace('_',
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Trace to threats** - Every requirement should map to threats
|
||||
- **Be specific** - Vague requirements can't be tested
|
||||
- **Include acceptance criteria** - Define "done"
|
||||
@@ -664,6 +665,7 @@ This epic covers all security requirements related to {domain.value.replace('_',
|
||||
- **Review regularly** - Requirements evolve with threats
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't be generic** - "Be secure" is not a requirement
|
||||
- **Don't skip rationale** - Explain why it matters
|
||||
- **Don't ignore priorities** - Not all requirements are equal
|
||||
|
||||
@@ -34,14 +34,14 @@ E - Elevation of → Authorization threats
|
||||
|
||||
### 2. Threat Analysis Matrix
|
||||
|
||||
| Category | Question | Control Family |
|
||||
|----------|----------|----------------|
|
||||
| **Spoofing** | Can attacker pretend to be someone else? | Authentication |
|
||||
| **Tampering** | Can attacker modify data in transit/rest? | Integrity |
|
||||
| **Repudiation** | Can attacker deny actions? | Logging/Audit |
|
||||
| **Info Disclosure** | Can attacker access unauthorized data? | Encryption |
|
||||
| **DoS** | Can attacker disrupt availability? | Rate limiting |
|
||||
| **Elevation** | Can attacker gain higher privileges? | Authorization |
|
||||
| Category | Question | Control Family |
|
||||
| ------------------- | ----------------------------------------- | -------------- |
|
||||
| **Spoofing** | Can attacker pretend to be someone else? | Authentication |
|
||||
| **Tampering** | Can attacker modify data in transit/rest? | Integrity |
|
||||
| **Repudiation** | Can attacker deny actions? | Logging/Audit |
|
||||
| **Info Disclosure** | Can attacker access unauthorized data? | Encryption |
|
||||
| **DoS** | Can attacker disrupt availability? | Rate limiting |
|
||||
| **Elevation** | Can attacker gain higher privileges? | Authorization |
|
||||
|
||||
## Templates
|
||||
|
||||
@@ -53,14 +53,17 @@ E - Elevation of → Authorization threats
|
||||
## 1. System Overview
|
||||
|
||||
### 1.1 Description
|
||||
|
||||
[Brief description of the system and its purpose]
|
||||
|
||||
### 1.2 Data Flow Diagram
|
||||
```
|
||||
|
||||
[User] --> [Web App] --> [API Gateway] --> [Backend Services]
|
||||
|
|
||||
v
|
||||
[Database]
|
||||
|
|
||||
v
|
||||
[Database]
|
||||
|
||||
```
|
||||
|
||||
### 1.3 Trust Boundaries
|
||||
@@ -163,12 +166,15 @@ E - Elevation of → Authorization threats
|
||||
### 4.1 Risk Matrix
|
||||
|
||||
```
|
||||
|
||||
IMPACT
|
||||
Low Med High Crit
|
||||
Low 1 2 3 4
|
||||
L Med 2 4 6 8
|
||||
I High 3 6 9 12
|
||||
K Crit 4 8 12 16
|
||||
|
||||
L Med 2 4 6 8
|
||||
I High 3 6 9 12
|
||||
K Crit 4 8 12 16
|
||||
|
||||
```
|
||||
|
||||
### 4.2 Prioritized Risks
|
||||
@@ -636,6 +642,7 @@ class StridePerInteraction:
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Involve stakeholders** - Security, dev, and ops perspectives
|
||||
- **Be systematic** - Cover all STRIDE categories
|
||||
- **Prioritize realistically** - Focus on high-impact threats
|
||||
@@ -643,6 +650,7 @@ class StridePerInteraction:
|
||||
- **Use visual aids** - DFDs help communication
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't skip categories** - Each reveals different threats
|
||||
- **Don't assume security** - Question every component
|
||||
- **Don't work in isolation** - Collaborative modeling is better
|
||||
|
||||
@@ -33,13 +33,13 @@ Corrective ────► Respond and recover from attacks
|
||||
|
||||
### 2. Control Layers
|
||||
|
||||
| Layer | Examples |
|
||||
|-------|----------|
|
||||
| **Network** | Firewall, WAF, DDoS protection |
|
||||
| **Application** | Input validation, authentication |
|
||||
| **Data** | Encryption, access controls |
|
||||
| **Endpoint** | EDR, patch management |
|
||||
| **Process** | Security training, incident response |
|
||||
| Layer | Examples |
|
||||
| --------------- | ------------------------------------ |
|
||||
| **Network** | Firewall, WAF, DDoS protection |
|
||||
| **Application** | Input validation, authentication |
|
||||
| **Data** | Encryption, access controls |
|
||||
| **Endpoint** | EDR, patch management |
|
||||
| **Process** | Security training, incident response |
|
||||
|
||||
### 3. Defense in Depth
|
||||
|
||||
@@ -725,6 +725,7 @@ class ControlTester:
|
||||
## Best Practices
|
||||
|
||||
### Do's
|
||||
|
||||
- **Map all threats** - No threat should be unmapped
|
||||
- **Layer controls** - Defense in depth is essential
|
||||
- **Mix control types** - Preventive, detective, corrective
|
||||
@@ -732,6 +733,7 @@ class ControlTester:
|
||||
- **Review regularly** - Controls degrade over time
|
||||
|
||||
### Don'ts
|
||||
|
||||
- **Don't rely on single controls** - Single points of failure
|
||||
- **Don't ignore cost** - ROI matters
|
||||
- **Don't skip testing** - Untested controls may fail
|
||||
|
||||
Reference in New Issue
Block a user