hedra 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.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +374 -213
- data/config/example_config.yml +88 -10
- data/lib/hedra/analyzer.rb +10 -2
- data/lib/hedra/baseline.rb +83 -0
- data/lib/hedra/cache.rb +67 -0
- data/lib/hedra/certificate_checker.rb +94 -0
- data/lib/hedra/circuit_breaker.rb +80 -0
- data/lib/hedra/cli.rb +232 -16
- data/lib/hedra/config.rb +1 -1
- data/lib/hedra/exporter.rb +7 -0
- data/lib/hedra/html_reporter.rb +136 -0
- data/lib/hedra/http_client.rb +46 -9
- data/lib/hedra/progress_tracker.rb +45 -0
- data/lib/hedra/rate_limiter.rb +60 -0
- data/lib/hedra/security_txt_checker.rb +93 -0
- data/lib/hedra/version.rb +1 -1
- data/lib/hedra.rb +17 -9
- metadata +13 -5
data/README.md
CHANGED
|
@@ -1,205 +1,248 @@
|
|
|
1
|
-
# Hedra
|
|
1
|
+
# Hedra
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.ruby-lang.org/)
|
|
4
|
+
[](https://rubygems.org/gems/hedra)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://rubygems.org/gems/hedra)
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
_ _ _
|
|
7
|
-
| | | | ___ __| |_ __ __ _
|
|
8
|
-
| |_| |/ _ \/ _` | '__/ _` |
|
|
9
|
-
| _ | __/ (_| | | | (_| |
|
|
10
|
-
|_| |_|\___|\__,_|_| \__,_|
|
|
11
|
-
|
|
12
|
-
Security Header Analyzer
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Features
|
|
16
|
-
|
|
17
|
-
- 🔍 **Comprehensive Scanning** - Analyze security headers for single or multiple URLs
|
|
18
|
-
- 🎯 **Deep Auditing** - Detailed security header analysis with recommendations
|
|
19
|
-
- 👁️ **Continuous Monitoring** - Watch URLs for header changes over time
|
|
20
|
-
- 📊 **Multiple Output Formats** - Table, JSON, and CSV export options
|
|
21
|
-
- 🔌 **Plugin Architecture** - Extend with custom header checks
|
|
22
|
-
- ⚡ **Concurrent Scanning** - Fast parallel URL scanning with configurable concurrency
|
|
23
|
-
- 🌐 **Proxy Support** - HTTP and SOCKS proxy compatibility
|
|
24
|
-
- 🎨 **Beautiful CLI** - Color-coded output with severity badges
|
|
25
|
-
- 📈 **Security Scoring** - 0-100 score based on header coverage
|
|
8
|
+
> Security header analyzer with SSL/TLS validation, baseline tracking, and CI/CD integration.
|
|
26
9
|
|
|
27
10
|
## Installation
|
|
28
|
-
|
|
29
|
-
### From Source
|
|
30
|
-
|
|
31
11
|
```bash
|
|
32
|
-
|
|
33
|
-
git clone https://github.com/hedra/hedra.git
|
|
34
|
-
cd hedra
|
|
35
|
-
|
|
36
|
-
# Install dependencies
|
|
37
|
-
bundle install
|
|
38
|
-
|
|
39
|
-
# Build the gem
|
|
40
|
-
rake build
|
|
41
|
-
|
|
42
|
-
# Install the gem
|
|
43
|
-
gem install pkg/hedra-1.0.0.gem
|
|
12
|
+
gem install hedra
|
|
44
13
|
```
|
|
45
14
|
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
## Quick Start
|
|
48
16
|
```bash
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
17
|
+
hedra scan https://github.com
|
|
18
|
+
hedra audit https://stripe.com --json
|
|
19
|
+
hedra scan -f urls.txt --format html --output report.html
|
|
52
20
|
```
|
|
53
21
|
|
|
54
|
-
##
|
|
22
|
+
## Commands
|
|
55
23
|
|
|
56
|
-
###
|
|
24
|
+
### scan
|
|
57
25
|
|
|
58
|
-
Scan
|
|
26
|
+
Scan URLs for security headers with flexible output options.
|
|
59
27
|
```bash
|
|
60
|
-
hedra scan https://
|
|
28
|
+
hedra scan https://github.com
|
|
29
|
+
hedra scan -f urls.txt --concurrency 20
|
|
30
|
+
hedra scan https://stripe.com --cache --rate 10/s
|
|
61
31
|
```
|
|
62
32
|
|
|
63
|
-
|
|
33
|
+
**Key Options:**
|
|
34
|
+
- `-f, --file FILE` • Read URLs from file
|
|
35
|
+
- `-c, --concurrency N` • Concurrent requests (default: 10)
|
|
36
|
+
- `-t, --timeout N` • Request timeout in seconds (default: 10)
|
|
37
|
+
- `--rate RATE` • Rate limit: 10/s, 100/m, 1000/h
|
|
38
|
+
- `--cache` • Enable response caching
|
|
39
|
+
- `--cache-ttl N` • Cache TTL in seconds (default: 3600)
|
|
40
|
+
- `-o, --output FILE` • Output file
|
|
41
|
+
- `--format FORMAT` • table, json, csv, html (default: table)
|
|
42
|
+
- `--proxy URL` • HTTP/SOCKS proxy
|
|
43
|
+
- `--user-agent STRING` • Custom User-Agent
|
|
44
|
+
- `--save-baseline NAME` • Save results as baseline
|
|
45
|
+
- `--[no-]progress` • Show/hide progress bar
|
|
46
|
+
- `--[no-]check-certificates` • SSL checks (default: enabled)
|
|
47
|
+
- `--[no-]check-security-txt` • RFC 9116 checks
|
|
48
|
+
|
|
49
|
+
### audit
|
|
50
|
+
|
|
51
|
+
Deep security audit with detailed recommendations.
|
|
64
52
|
```bash
|
|
65
|
-
hedra
|
|
53
|
+
hedra audit https://github.com
|
|
54
|
+
hedra audit https://api.stripe.com --json --output report.json
|
|
66
55
|
```
|
|
67
56
|
|
|
68
|
-
|
|
57
|
+
**Options:**
|
|
58
|
+
- `--json` • JSON output format
|
|
59
|
+
- `-o, --output FILE` • Output file
|
|
60
|
+
- `--proxy URL` • HTTP/SOCKS proxy
|
|
61
|
+
- `--user-agent STRING` • Custom User-Agent
|
|
62
|
+
- `-t, --timeout N` • Request timeout
|
|
63
|
+
- `--[no-]check-certificates` • SSL/TLS validation
|
|
64
|
+
- `--[no-]check-security-txt` • security.txt checks
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
hedra audit https://example.com
|
|
73
|
-
```
|
|
66
|
+
### watch
|
|
74
67
|
|
|
75
|
-
|
|
68
|
+
Monitor security headers periodically.
|
|
76
69
|
```bash
|
|
77
|
-
hedra
|
|
70
|
+
hedra watch https://myapp.com --interval 3600
|
|
78
71
|
```
|
|
79
72
|
|
|
80
|
-
|
|
73
|
+
**Options:**
|
|
74
|
+
- `--interval N` • Check interval in seconds (default: 3600)
|
|
81
75
|
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
hedra scan -f urls.txt --concurrency 20 --timeout 15
|
|
85
|
-
```
|
|
76
|
+
### compare
|
|
86
77
|
|
|
87
|
-
|
|
78
|
+
Compare security headers between environments.
|
|
88
79
|
```bash
|
|
89
|
-
hedra
|
|
80
|
+
hedra compare https://staging.myapp.com https://myapp.com
|
|
90
81
|
```
|
|
91
82
|
|
|
92
|
-
|
|
83
|
+
### ci_check
|
|
84
|
+
|
|
85
|
+
CI/CD-friendly check with exit codes and thresholds.
|
|
93
86
|
```bash
|
|
94
|
-
hedra
|
|
87
|
+
hedra ci_check https://myapp.com --threshold 85
|
|
88
|
+
hedra ci_check -f urls.txt --fail-on-critical
|
|
95
89
|
```
|
|
96
90
|
|
|
97
|
-
|
|
91
|
+
**Options:**
|
|
92
|
+
- `-f, --file FILE` • Read URLs from file
|
|
93
|
+
- `--threshold N` • Minimum score threshold (default: 80)
|
|
94
|
+
- `--fail-on-critical` • Fail on critical issues (default: true)
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
```
|
|
96
|
+
**Exit Codes:**
|
|
97
|
+
- `0` • All checks passed
|
|
98
|
+
- `1` • Score below threshold or critical issues found
|
|
103
99
|
|
|
104
|
-
###
|
|
100
|
+
### baseline
|
|
105
101
|
|
|
106
|
-
|
|
102
|
+
Track security posture changes over time.
|
|
107
103
|
```bash
|
|
108
|
-
hedra
|
|
104
|
+
hedra baseline list
|
|
105
|
+
hedra baseline compare production-v1 -f urls.txt
|
|
106
|
+
hedra baseline delete production-v1
|
|
109
107
|
```
|
|
110
108
|
|
|
111
|
-
###
|
|
109
|
+
### cache
|
|
112
110
|
|
|
113
|
-
|
|
111
|
+
Manage response cache for faster repeated scans.
|
|
114
112
|
```bash
|
|
115
|
-
hedra
|
|
113
|
+
hedra cache clear
|
|
114
|
+
hedra cache clear-expired
|
|
116
115
|
```
|
|
117
116
|
|
|
118
|
-
###
|
|
117
|
+
### plugin
|
|
119
118
|
|
|
120
|
-
|
|
119
|
+
Extend functionality with custom security checks.
|
|
121
120
|
```bash
|
|
122
121
|
hedra plugin list
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Install a custom plugin:
|
|
126
|
-
```bash
|
|
127
122
|
hedra plugin install path/to/plugin.rb
|
|
123
|
+
hedra plugin remove plugin_name
|
|
128
124
|
```
|
|
129
125
|
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
hedra plugin remove my_plugin
|
|
133
|
-
```
|
|
126
|
+
## Security Checks
|
|
134
127
|
|
|
135
|
-
|
|
128
|
+
### HTTP Headers Analyzed
|
|
136
129
|
|
|
137
|
-
|
|
130
|
+
| Header | Weight | Purpose |
|
|
131
|
+
|--------|--------|---------|
|
|
132
|
+
| Content-Security-Policy | 25 pts | Prevent XSS and injection attacks |
|
|
133
|
+
| Strict-Transport-Security | 25 pts | Enforce HTTPS connections |
|
|
134
|
+
| X-Frame-Options | 15 pts | Prevent clickjacking |
|
|
135
|
+
| X-Content-Type-Options | 10 pts | Stop MIME-type sniffing |
|
|
136
|
+
| Referrer-Policy | 10 pts | Control referrer information |
|
|
137
|
+
| Permissions-Policy | 5 pts | Manage browser features |
|
|
138
|
+
| Cross-Origin-Opener-Policy | 5 pts | Isolate browsing context |
|
|
139
|
+
| Cross-Origin-Embedder-Policy | 3 pts | Enable cross-origin isolation |
|
|
140
|
+
| Cross-Origin-Resource-Policy | 2 pts | Control resource loading |
|
|
138
141
|
|
|
139
|
-
###
|
|
140
|
-
- **Content-Security-Policy (CSP)** - Prevents XSS and injection attacks
|
|
141
|
-
- **Strict-Transport-Security (HSTS)** - Enforces HTTPS connections
|
|
142
|
+
### Additional Validations
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
-
|
|
144
|
+
**SSL/TLS Checks:**
|
|
145
|
+
- Certificate expiry dates
|
|
146
|
+
- Signature algorithm strength
|
|
147
|
+
- Key size validation
|
|
148
|
+
- Chain verification
|
|
146
149
|
|
|
147
|
-
|
|
148
|
-
-
|
|
149
|
-
- **Permissions-Policy** - Controls browser features
|
|
150
|
-
- **Cross-Origin-Opener-Policy (COOP)** - Isolates browsing context
|
|
151
|
-
- **Cross-Origin-Embedder-Policy (COEP)** - Controls resource embedding
|
|
152
|
-
- **Cross-Origin-Resource-Policy (CORP)** - Controls resource sharing
|
|
150
|
+
**RFC 9116:**
|
|
151
|
+
- security.txt file presence and format
|
|
153
152
|
|
|
154
|
-
|
|
153
|
+
### Scoring System
|
|
154
|
+
|
|
155
|
+
**Base:** 100 points from header weights
|
|
155
156
|
|
|
156
|
-
|
|
157
|
+
**Penalties:**
|
|
158
|
+
- Critical issue: -20 points
|
|
159
|
+
- Warning: -10 points
|
|
160
|
+
- Info: -5 points
|
|
157
161
|
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
Create `~/.hedra/config.yml`:
|
|
158
165
|
```yaml
|
|
166
|
+
# HTTP settings
|
|
159
167
|
timeout: 10
|
|
160
168
|
concurrency: 10
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
user_agent: "Hedra/2.0.0"
|
|
170
|
+
follow_redirects: true
|
|
171
|
+
max_retries: 3
|
|
172
|
+
|
|
173
|
+
# Performance
|
|
174
|
+
cache_enabled: false
|
|
175
|
+
cache_ttl: 3600
|
|
176
|
+
rate_limit: "10/s"
|
|
177
|
+
|
|
178
|
+
# Security checks
|
|
179
|
+
check_certificates: true
|
|
180
|
+
check_security_txt: false
|
|
181
|
+
|
|
182
|
+
# Output
|
|
183
|
+
output_format: "table"
|
|
184
|
+
progress_bar: true
|
|
185
|
+
|
|
186
|
+
# Circuit breaker
|
|
187
|
+
circuit_breaker_threshold: 5
|
|
188
|
+
circuit_breaker_timeout: 60
|
|
164
189
|
```
|
|
165
190
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
Add custom header checks in `~/.hedra/rules.yml`:
|
|
191
|
+
## Custom Rules
|
|
169
192
|
|
|
193
|
+
Define organization-specific policies in `~/.hedra/rules.yml`:
|
|
170
194
|
```yaml
|
|
171
195
|
rules:
|
|
172
196
|
- header: "X-Custom-Security"
|
|
173
197
|
type: missing
|
|
174
198
|
severity: warning
|
|
175
199
|
message: "Custom security header is missing"
|
|
176
|
-
fix: "Add X-Custom-Security
|
|
177
|
-
|
|
200
|
+
fix: "Add X-Custom-Security: enabled"
|
|
201
|
+
|
|
178
202
|
- header: "Server"
|
|
179
203
|
type: pattern
|
|
180
|
-
pattern: "(Apache|nginx
|
|
204
|
+
pattern: "^(Apache|nginx)"
|
|
181
205
|
severity: info
|
|
182
|
-
message: "Server header exposes
|
|
206
|
+
message: "Server header exposes software version"
|
|
183
207
|
fix: "Remove or obfuscate Server header"
|
|
184
208
|
```
|
|
185
209
|
|
|
186
|
-
|
|
210
|
+
**Rule Types:**
|
|
211
|
+
- `missing` • Header should be present
|
|
212
|
+
- `pattern` • Header value must match regex
|
|
213
|
+
|
|
214
|
+
**Severity Levels:**
|
|
215
|
+
- `critical` • -20 points, immediate action required
|
|
216
|
+
- `warning` • -10 points, should be addressed
|
|
217
|
+
- `info` • -5 points, best practice
|
|
187
218
|
|
|
188
|
-
|
|
219
|
+
## Plugin System
|
|
189
220
|
|
|
221
|
+
Create custom checks in `~/.hedra/plugins/`:
|
|
190
222
|
```ruby
|
|
191
|
-
# ~/.hedra/plugins/
|
|
223
|
+
# ~/.hedra/plugins/corporate_policy.rb
|
|
192
224
|
module Hedra
|
|
193
|
-
class
|
|
225
|
+
class CorporatePolicyPlugin < Plugin
|
|
194
226
|
def self.check(headers)
|
|
195
227
|
findings = []
|
|
196
228
|
|
|
197
|
-
|
|
229
|
+
# Enforce corporate header
|
|
230
|
+
unless headers.key?('x-corp-security')
|
|
231
|
+
findings << {
|
|
232
|
+
header: 'x-corp-security',
|
|
233
|
+
issue: 'Corporate security header missing',
|
|
234
|
+
severity: :critical,
|
|
235
|
+
recommended_fix: 'Add X-Corp-Security: v2'
|
|
236
|
+
}
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
# Check version disclosure
|
|
240
|
+
if headers['server']&.match?(/\d+\.\d+/)
|
|
198
241
|
findings << {
|
|
199
|
-
header: '
|
|
200
|
-
issue: '
|
|
242
|
+
header: 'server',
|
|
243
|
+
issue: 'Server version exposed',
|
|
201
244
|
severity: :warning,
|
|
202
|
-
recommended_fix: '
|
|
245
|
+
recommended_fix: 'Remove version from Server header'
|
|
203
246
|
}
|
|
204
247
|
end
|
|
205
248
|
|
|
@@ -209,134 +252,252 @@ module Hedra
|
|
|
209
252
|
end
|
|
210
253
|
```
|
|
211
254
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
255
|
+
**Management:**
|
|
256
|
+
```bash
|
|
257
|
+
hedra plugin install ~/.hedra/plugins/corporate_policy.rb
|
|
258
|
+
hedra plugin list
|
|
259
|
+
hedra plugin remove corporate_policy
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
## CI/CD Integration
|
|
263
|
+
|
|
264
|
+
### GitHub Actions
|
|
265
|
+
```yaml
|
|
266
|
+
name: Security Headers Check
|
|
267
|
+
|
|
268
|
+
on: [push, pull_request]
|
|
269
|
+
|
|
270
|
+
jobs:
|
|
271
|
+
security-scan:
|
|
272
|
+
runs-on: ubuntu-latest
|
|
273
|
+
steps:
|
|
274
|
+
- uses: actions/checkout@v3
|
|
275
|
+
|
|
276
|
+
- name: Setup Ruby
|
|
277
|
+
uses: ruby/setup-ruby@v1
|
|
278
|
+
with:
|
|
279
|
+
ruby-version: '3.2'
|
|
280
|
+
|
|
281
|
+
- name: Install Hedra
|
|
282
|
+
run: gem install hedra
|
|
283
|
+
|
|
284
|
+
- name: Run Security Check
|
|
285
|
+
run: hedra ci_check ${{ secrets.APP_URL }} --threshold 85
|
|
286
|
+
|
|
287
|
+
- name: Generate HTML Report
|
|
288
|
+
if: always()
|
|
289
|
+
run: hedra scan ${{ secrets.APP_URL }} --output report.html --format html
|
|
290
|
+
|
|
291
|
+
- name: Upload Report
|
|
292
|
+
if: always()
|
|
293
|
+
uses: actions/upload-artifact@v3
|
|
294
|
+
with:
|
|
295
|
+
name: security-report
|
|
296
|
+
path: report.html
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### GitLab CI
|
|
300
|
+
```yaml
|
|
301
|
+
security_headers:
|
|
302
|
+
image: ruby:3.2
|
|
303
|
+
script:
|
|
304
|
+
- gem install hedra
|
|
305
|
+
- hedra ci_check $APP_URL --threshold 85
|
|
306
|
+
- hedra scan $APP_URL --output report.json --format json
|
|
307
|
+
artifacts:
|
|
308
|
+
reports:
|
|
309
|
+
junit: report.json
|
|
310
|
+
paths:
|
|
311
|
+
- report.json
|
|
312
|
+
only:
|
|
313
|
+
- merge_requests
|
|
314
|
+
- main
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Jenkins Pipeline
|
|
318
|
+
```groovy
|
|
319
|
+
pipeline {
|
|
320
|
+
agent any
|
|
321
|
+
|
|
322
|
+
stages {
|
|
323
|
+
stage('Security Headers') {
|
|
324
|
+
steps {
|
|
325
|
+
sh 'gem install hedra'
|
|
326
|
+
sh 'hedra ci_check ${APP_URL} --threshold 85'
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
post {
|
|
332
|
+
always {
|
|
333
|
+
sh 'hedra scan ${APP_URL} --output report.html --format html'
|
|
334
|
+
publishHTML([
|
|
335
|
+
reportDir: '.',
|
|
336
|
+
reportFiles: 'report.html',
|
|
337
|
+
reportName: 'Security Report'
|
|
338
|
+
])
|
|
339
|
+
}
|
|
243
340
|
}
|
|
244
|
-
],
|
|
245
|
-
"score": 75
|
|
246
341
|
}
|
|
247
342
|
```
|
|
248
343
|
|
|
249
|
-
##
|
|
344
|
+
## Export Formats
|
|
345
|
+
|
|
346
|
+
### Table (Default)
|
|
347
|
+
```bash
|
|
348
|
+
hedra scan https://github.com
|
|
349
|
+
```
|
|
250
350
|
|
|
251
|
-
|
|
351
|
+
Clean, colored terminal output with scores and recommendations.
|
|
252
352
|
|
|
353
|
+
### JSON
|
|
253
354
|
```bash
|
|
254
|
-
|
|
255
|
-
|
|
355
|
+
hedra scan https://stripe.com --output report.json --format json
|
|
356
|
+
```
|
|
256
357
|
|
|
257
|
-
|
|
258
|
-
bundle exec rspec --format documentation
|
|
358
|
+
Structured data for automation and parsing.
|
|
259
359
|
|
|
260
|
-
|
|
261
|
-
|
|
360
|
+
### CSV
|
|
361
|
+
```bash
|
|
362
|
+
hedra scan -f urls.txt --output report.csv --format csv
|
|
262
363
|
```
|
|
263
364
|
|
|
264
|
-
|
|
365
|
+
Import into spreadsheets for analysis and tracking.
|
|
265
366
|
|
|
367
|
+
### HTML
|
|
266
368
|
```bash
|
|
267
|
-
|
|
268
|
-
|
|
369
|
+
hedra scan -f urls.txt --output report.html --format html
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Interactive report with sorting, filtering, and charts.
|
|
373
|
+
|
|
374
|
+
## Real-World Examples
|
|
269
375
|
|
|
270
|
-
|
|
271
|
-
|
|
376
|
+
### Basic Security Audit
|
|
377
|
+
```bash
|
|
378
|
+
hedra scan https://myapp.com
|
|
272
379
|
```
|
|
273
380
|
|
|
274
|
-
###
|
|
381
|
+
### Production Deployment Check
|
|
382
|
+
```bash
|
|
383
|
+
# Save baseline after deployment
|
|
384
|
+
hedra scan -f production-urls.txt --save-baseline prod-v2.1.0
|
|
275
385
|
|
|
386
|
+
# Compare before next deployment
|
|
387
|
+
hedra baseline compare prod-v2.1.0 -f production-urls.txt
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### High-Volume Scanning
|
|
276
391
|
```bash
|
|
277
|
-
#
|
|
278
|
-
|
|
392
|
+
# Scan 1000 URLs with rate limiting and caching
|
|
393
|
+
hedra scan -f large-list.txt \
|
|
394
|
+
--concurrency 50 \
|
|
395
|
+
--rate 20/s \
|
|
396
|
+
--cache \
|
|
397
|
+
--output results.json \
|
|
398
|
+
--format json
|
|
399
|
+
```
|
|
279
400
|
|
|
280
|
-
|
|
281
|
-
|
|
401
|
+
### Continuous Monitoring
|
|
402
|
+
```bash
|
|
403
|
+
# Check every hour
|
|
404
|
+
hedra watch https://api.myapp.com --interval 3600
|
|
282
405
|
```
|
|
283
406
|
|
|
284
|
-
|
|
407
|
+
### Environment Comparison
|
|
408
|
+
```bash
|
|
409
|
+
hedra compare https://staging.myapp.com https://myapp.com
|
|
410
|
+
```
|
|
285
411
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
412
|
+
### Proxy-Based Testing
|
|
413
|
+
```bash
|
|
414
|
+
# Route through Burp Suite
|
|
415
|
+
hedra scan https://target.com --proxy http://127.0.0.1:8080
|
|
416
|
+
```
|
|
290
417
|
|
|
291
|
-
|
|
418
|
+
### Custom User-Agent
|
|
419
|
+
```bash
|
|
420
|
+
hedra scan https://myapp.com --user-agent "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0)"
|
|
421
|
+
```
|
|
292
422
|
|
|
293
|
-
|
|
423
|
+
## Performance Tuning
|
|
294
424
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
- **PluginManager** - Discovers and executes custom plugins
|
|
300
|
-
- **Exporter** - Handles JSON and CSV output formats
|
|
425
|
+
### Caching Strategy
|
|
426
|
+
```bash
|
|
427
|
+
# Enable caching for repeated scans
|
|
428
|
+
hedra scan -f urls.txt --cache --cache-ttl 7200
|
|
301
429
|
|
|
302
|
-
|
|
430
|
+
# Clear cache when needed
|
|
431
|
+
hedra cache clear
|
|
432
|
+
```
|
|
303
433
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
5. **Comprehensive Testing** - WebMock stubs prevent live network calls in tests
|
|
434
|
+
### Rate Limiting
|
|
435
|
+
```bash
|
|
436
|
+
# Conservative approach
|
|
437
|
+
hedra scan -f urls.txt --rate 10/s --concurrency 5
|
|
309
438
|
|
|
310
|
-
|
|
439
|
+
# Aggressive scanning
|
|
440
|
+
hedra scan -f urls.txt --rate 100/s --concurrency 50
|
|
441
|
+
```
|
|
311
442
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
5. Ensure linting passes (`bundle exec rubocop`)
|
|
317
|
-
6. Commit your changes (`git commit -am 'Add amazing feature'`)
|
|
318
|
-
7. Push to the branch (`git push origin feature/amazing-feature`)
|
|
319
|
-
8. Open a Pull Request
|
|
443
|
+
### Timeout Configuration
|
|
444
|
+
```bash
|
|
445
|
+
# Fast scan for responsive servers
|
|
446
|
+
hedra scan -f urls.txt --timeout 5
|
|
320
447
|
|
|
321
|
-
|
|
448
|
+
# Patient scan for slow servers
|
|
449
|
+
hedra scan -f urls.txt --timeout 30
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## Development
|
|
453
|
+
```bash
|
|
454
|
+
# Clone and setup
|
|
455
|
+
git clone https://github.com/blackstack/hedra.git
|
|
456
|
+
cd hedra
|
|
457
|
+
bundle install
|
|
458
|
+
|
|
459
|
+
# Run tests
|
|
460
|
+
bundle exec rspec
|
|
461
|
+
|
|
462
|
+
# Check code style
|
|
463
|
+
bundle exec rubocop
|
|
322
464
|
|
|
323
|
-
|
|
465
|
+
# Build gem
|
|
466
|
+
rake build
|
|
467
|
+
gem install pkg/hedra-*.gem
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
## Troubleshooting
|
|
471
|
+
|
|
472
|
+
### SSL Certificate Errors
|
|
473
|
+
```bash
|
|
474
|
+
# Skip certificate validation
|
|
475
|
+
hedra scan https://self-signed.badssl.com --no-check-certificates
|
|
476
|
+
```
|
|
324
477
|
|
|
325
|
-
|
|
478
|
+
### Rate Limiting Issues
|
|
479
|
+
```bash
|
|
480
|
+
# Reduce load on target server
|
|
481
|
+
hedra scan -f urls.txt --concurrency 1 --rate 1/s
|
|
482
|
+
```
|
|
326
483
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
484
|
+
### Timeout Problems
|
|
485
|
+
```bash
|
|
486
|
+
# Increase timeout for slow servers
|
|
487
|
+
hedra scan https://slow-server.com --timeout 60
|
|
488
|
+
```
|
|
330
489
|
|
|
331
|
-
##
|
|
490
|
+
## Resources
|
|
491
|
+
|
|
492
|
+
**GitHub:** https://github.com/blackstack/hedra
|
|
493
|
+
**RubyGems:** https://rubygems.org/gems/hedra
|
|
494
|
+
**Issues:** https://github.com/blackstack/hedra/issues
|
|
495
|
+
**OWASP Headers:** https://owasp.org/www-project-secure-headers/
|
|
496
|
+
|
|
497
|
+
## License
|
|
332
498
|
|
|
333
|
-
|
|
334
|
-
- [Thor](https://github.com/rails/thor) - CLI framework
|
|
335
|
-
- [HTTP.rb](https://github.com/httprb/http) - HTTP client
|
|
336
|
-
- [TTY::Table](https://github.com/piotrmurach/tty-table) - Terminal tables
|
|
337
|
-
- [Pastel](https://github.com/piotrmurach/pastel) - Terminal colors
|
|
338
|
-
- [RSpec](https://rspec.info/) - Testing framework
|
|
499
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
339
500
|
|
|
340
501
|
---
|
|
341
502
|
|
|
342
|
-
|
|
503
|
+
**Built by [BlackStack](https://github.com/blackstack)** • Securing the web, one header at a time.
|