hedra 1.0.0 → 1.0.1
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 +80 -207
- data/lib/hedra/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7ead36ae675253cd990b46928a4ce3cfa7046dde55e2353c6101b53953edd18
|
|
4
|
+
data.tar.gz: 3c5361c38a9393ca66310eb19809a9a770b4ef91476d21010c56cccb5d76fec3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4505267cfc8111cc24680a5962941786edeae9bbd133d75d9ab7bbc61c7ea32ca2dd4281bd655d090cf8513f1951232fa074edd64ba33b4544e9bd425294566c
|
|
7
|
+
data.tar.gz: 36616c7e22a2fd223d1d5c760a96bfa6c09c5a06392073c836d4b8414f81a272896ec96f57f348e8c78f65cc9f45481c930dbdeceb899d2b26afd5a9663b7e68
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,171 +1,102 @@
|
|
|
1
1
|
# Hedra 🛡️
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.ruby-lang.org/)
|
|
4
|
+
[](https://github.com/blackstack/hedra/actions)
|
|
5
|
+
[](https://badge.fury.io/rb/hedra)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
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
|
+
A comprehensive security header analyzer for modern web applications.
|
|
26
9
|
|
|
27
10
|
## Installation
|
|
28
11
|
|
|
29
|
-
### From Source
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
# Clone the repository
|
|
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
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### Quick Start
|
|
47
|
-
|
|
48
12
|
```bash
|
|
49
|
-
|
|
50
|
-
chmod +x bin/hedra
|
|
51
|
-
bin/hedra --help
|
|
13
|
+
gem install hedra
|
|
52
14
|
```
|
|
53
15
|
|
|
54
16
|
## Usage
|
|
55
17
|
|
|
56
|
-
###
|
|
18
|
+
### Scan a URL
|
|
57
19
|
|
|
58
|
-
Scan a single URL:
|
|
59
20
|
```bash
|
|
60
21
|
hedra scan https://example.com
|
|
61
22
|
```
|
|
62
23
|
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
hedra scan -f urls.txt
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Deep Audit
|
|
24
|
+
### Detailed Audit
|
|
69
25
|
|
|
70
|
-
Perform detailed security analysis:
|
|
71
26
|
```bash
|
|
72
27
|
hedra audit https://example.com
|
|
73
28
|
```
|
|
74
29
|
|
|
75
|
-
Export
|
|
76
|
-
```bash
|
|
77
|
-
hedra audit https://example.com --json --output result.json
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Advanced Scanning
|
|
30
|
+
### Export as JSON
|
|
81
31
|
|
|
82
|
-
Concurrent scanning with custom settings:
|
|
83
32
|
```bash
|
|
84
|
-
hedra
|
|
33
|
+
hedra audit https://example.com --json --output report.json
|
|
85
34
|
```
|
|
86
35
|
|
|
87
|
-
Scan
|
|
88
|
-
```bash
|
|
89
|
-
hedra scan https://example.com --proxy http://127.0.0.1:8080
|
|
90
|
-
```
|
|
36
|
+
### Scan Multiple URLs
|
|
91
37
|
|
|
92
|
-
Custom User-Agent and follow redirects:
|
|
93
38
|
```bash
|
|
94
|
-
|
|
39
|
+
# Create urls.txt with one URL per line
|
|
40
|
+
hedra scan -f urls.txt --concurrency 20
|
|
95
41
|
```
|
|
96
42
|
|
|
97
|
-
###
|
|
43
|
+
### Monitor Over Time
|
|
98
44
|
|
|
99
|
-
Watch a URL and check every hour:
|
|
100
45
|
```bash
|
|
101
46
|
hedra watch https://example.com --interval 3600
|
|
102
47
|
```
|
|
103
48
|
|
|
104
49
|
### Compare Headers
|
|
105
50
|
|
|
106
|
-
Compare security headers between two URLs:
|
|
107
51
|
```bash
|
|
108
52
|
hedra compare https://staging.example.com https://prod.example.com
|
|
109
53
|
```
|
|
110
54
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
Export scan results:
|
|
114
|
-
```bash
|
|
115
|
-
hedra scan -f urls.txt --output results.csv --format csv
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Plugin Management
|
|
55
|
+
## Security Headers Checked
|
|
119
56
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
57
|
+
- **Content-Security-Policy (CSP)** - Prevents XSS attacks
|
|
58
|
+
- **Strict-Transport-Security (HSTS)** - Enforces HTTPS
|
|
59
|
+
- **X-Frame-Options** - Prevents clickjacking
|
|
60
|
+
- **X-Content-Type-Options** - Prevents MIME-sniffing
|
|
61
|
+
- **Referrer-Policy** - Controls referrer information
|
|
62
|
+
- **Permissions-Policy** - Controls browser features
|
|
63
|
+
- **Cross-Origin-Opener-Policy (COOP)**
|
|
64
|
+
- **Cross-Origin-Embedder-Policy (COEP)**
|
|
65
|
+
- **Cross-Origin-Resource-Policy (CORP)**
|
|
124
66
|
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
hedra plugin install path/to/plugin.rb
|
|
128
|
-
```
|
|
67
|
+
## Options
|
|
129
68
|
|
|
130
|
-
Remove a plugin:
|
|
131
69
|
```bash
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
## Security Headers Checked
|
|
70
|
+
# Concurrent scanning
|
|
71
|
+
hedra scan -f urls.txt --concurrency 20 --timeout 15
|
|
136
72
|
|
|
137
|
-
|
|
73
|
+
# Through a proxy
|
|
74
|
+
hedra scan https://example.com --proxy http://127.0.0.1:8080
|
|
138
75
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
- **Strict-Transport-Security (HSTS)** - Enforces HTTPS connections
|
|
76
|
+
# Custom User-Agent
|
|
77
|
+
hedra scan https://example.com --user-agent "MyBot/1.0"
|
|
142
78
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- **X-Content-Type-Options** - Prevents MIME-sniffing attacks
|
|
79
|
+
# Follow redirects
|
|
80
|
+
hedra scan https://example.com --follow-redirects
|
|
146
81
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
82
|
+
# Export as CSV
|
|
83
|
+
hedra scan -f urls.txt --output results.csv --format csv
|
|
84
|
+
```
|
|
153
85
|
|
|
154
86
|
## Configuration
|
|
155
87
|
|
|
156
|
-
Create
|
|
88
|
+
Create `~/.hedra/config.yml`:
|
|
157
89
|
|
|
158
90
|
```yaml
|
|
159
91
|
timeout: 10
|
|
160
92
|
concurrency: 10
|
|
161
|
-
follow_redirects: false
|
|
162
93
|
user_agent: "Hedra/1.0.0"
|
|
163
94
|
output_format: table
|
|
164
95
|
```
|
|
165
96
|
|
|
166
|
-
|
|
97
|
+
## Custom Rules
|
|
167
98
|
|
|
168
|
-
|
|
99
|
+
Create `~/.hedra/rules.yml`:
|
|
169
100
|
|
|
170
101
|
```yaml
|
|
171
102
|
rules:
|
|
@@ -174,18 +105,11 @@ rules:
|
|
|
174
105
|
severity: warning
|
|
175
106
|
message: "Custom security header is missing"
|
|
176
107
|
fix: "Add X-Custom-Security header"
|
|
177
|
-
|
|
178
|
-
- header: "Server"
|
|
179
|
-
type: pattern
|
|
180
|
-
pattern: "(Apache|nginx|IIS)"
|
|
181
|
-
severity: info
|
|
182
|
-
message: "Server header exposes server software"
|
|
183
|
-
fix: "Remove or obfuscate Server header"
|
|
184
108
|
```
|
|
185
109
|
|
|
186
|
-
##
|
|
110
|
+
## Plugins
|
|
187
111
|
|
|
188
|
-
Create custom
|
|
112
|
+
Create custom header checks:
|
|
189
113
|
|
|
190
114
|
```ruby
|
|
191
115
|
# ~/.hedra/plugins/my_plugin.rb
|
|
@@ -193,43 +117,69 @@ module Hedra
|
|
|
193
117
|
class MyPlugin < Plugin
|
|
194
118
|
def self.check(headers)
|
|
195
119
|
findings = []
|
|
196
|
-
|
|
197
120
|
unless headers.key?('x-my-header')
|
|
198
121
|
findings << {
|
|
199
122
|
header: 'x-my-header',
|
|
200
|
-
issue: '
|
|
123
|
+
issue: 'Custom header missing',
|
|
201
124
|
severity: :warning,
|
|
202
125
|
recommended_fix: 'Add X-My-Header'
|
|
203
126
|
}
|
|
204
127
|
end
|
|
205
|
-
|
|
206
128
|
findings
|
|
207
129
|
end
|
|
208
130
|
end
|
|
209
131
|
end
|
|
210
132
|
```
|
|
211
133
|
|
|
134
|
+
Install plugin:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
hedra plugin install ~/.hedra/plugins/my_plugin.rb
|
|
138
|
+
hedra plugin list
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Clone and install
|
|
145
|
+
git clone https://github.com/blackstack/hedra.git
|
|
146
|
+
cd hedra
|
|
147
|
+
bundle install
|
|
148
|
+
|
|
149
|
+
# Run tests
|
|
150
|
+
bundle exec rspec
|
|
151
|
+
|
|
152
|
+
# Run linter
|
|
153
|
+
bundle exec rubocop
|
|
154
|
+
|
|
155
|
+
# Build gem
|
|
156
|
+
rake build
|
|
157
|
+
```
|
|
158
|
+
|
|
212
159
|
## Output Examples
|
|
213
160
|
|
|
214
|
-
### Table
|
|
161
|
+
### Table Format
|
|
162
|
+
|
|
215
163
|
```
|
|
216
164
|
https://example.com
|
|
217
165
|
Score: 75/100
|
|
218
166
|
Timestamp: 2025-11-12T10:30:00Z
|
|
219
167
|
|
|
220
|
-
|
|
221
|
-
│ Header │ Issue │ Severity
|
|
222
|
-
|
|
223
|
-
│
|
|
224
|
-
│
|
|
225
|
-
|
|
168
|
+
┌─────────────────────────────┬──────────────────────────────┬──────────────┐
|
|
169
|
+
│ Header │ Issue │ Severity │
|
|
170
|
+
├─────────────────────────────┼──────────────────────────────┼──────────────┤
|
|
171
|
+
│ x-frame-options │ Header is missing │ ● WARNING │
|
|
172
|
+
│ referrer-policy │ Header is missing │ ● INFO │
|
|
173
|
+
└─────────────────────────────┴──────────────────────────────┴──────────────┘
|
|
226
174
|
```
|
|
227
175
|
|
|
228
|
-
### JSON
|
|
176
|
+
### JSON Format
|
|
177
|
+
|
|
229
178
|
```json
|
|
230
179
|
{
|
|
231
180
|
"url": "https://example.com",
|
|
232
181
|
"timestamp": "2025-11-12T10:30:00Z",
|
|
182
|
+
"score": 75,
|
|
233
183
|
"headers": {
|
|
234
184
|
"content-security-policy": "default-src 'self'",
|
|
235
185
|
"strict-transport-security": "max-age=31536000"
|
|
@@ -241,72 +191,10 @@ Timestamp: 2025-11-12T10:30:00Z
|
|
|
241
191
|
"severity": "warning",
|
|
242
192
|
"recommended_fix": "Add X-Frame-Options: DENY or SAMEORIGIN"
|
|
243
193
|
}
|
|
244
|
-
]
|
|
245
|
-
"score": 75
|
|
194
|
+
]
|
|
246
195
|
}
|
|
247
196
|
```
|
|
248
197
|
|
|
249
|
-
## Development
|
|
250
|
-
|
|
251
|
-
### Running Tests
|
|
252
|
-
|
|
253
|
-
```bash
|
|
254
|
-
# Run all tests
|
|
255
|
-
bundle exec rspec
|
|
256
|
-
|
|
257
|
-
# Run with coverage
|
|
258
|
-
bundle exec rspec --format documentation
|
|
259
|
-
|
|
260
|
-
# Run specific test file
|
|
261
|
-
bundle exec rspec spec/hedra/analyzer_spec.rb
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
### Linting
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
# Run RuboCop
|
|
268
|
-
bundle exec rubocop
|
|
269
|
-
|
|
270
|
-
# Auto-fix issues
|
|
271
|
-
bundle exec rubocop -a
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Building
|
|
275
|
-
|
|
276
|
-
```bash
|
|
277
|
-
# Build gem
|
|
278
|
-
rake build
|
|
279
|
-
|
|
280
|
-
# Install locally
|
|
281
|
-
gem install pkg/hedra-1.0.0.gem
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
## CI/CD
|
|
285
|
-
|
|
286
|
-
Hedra includes GitHub Actions CI configuration that:
|
|
287
|
-
- Runs tests on Ruby 3.0, 3.1, and 3.2
|
|
288
|
-
- Executes RuboCop linting
|
|
289
|
-
- Builds the gem package
|
|
290
|
-
|
|
291
|
-
## Architecture
|
|
292
|
-
|
|
293
|
-
### Core Components
|
|
294
|
-
|
|
295
|
-
- **CLI** - Thor-based command-line interface with subcommands
|
|
296
|
-
- **Analyzer** - Core logic for header analysis and validation
|
|
297
|
-
- **HttpClient** - HTTP wrapper with retry logic, proxy support, and TLS verification
|
|
298
|
-
- **Scorer** - Calculates security scores based on header coverage
|
|
299
|
-
- **PluginManager** - Discovers and executes custom plugins
|
|
300
|
-
- **Exporter** - Handles JSON and CSV output formats
|
|
301
|
-
|
|
302
|
-
### Design Decisions
|
|
303
|
-
|
|
304
|
-
1. **Modular Architecture** - Each header check is isolated, making it easy to add new checks
|
|
305
|
-
2. **Secure Defaults** - TLS verification on, no redirect following, conservative timeouts
|
|
306
|
-
3. **Thread-Safe Concurrency** - Uses Ruby's concurrent-ruby gem for safe parallel scanning
|
|
307
|
-
4. **Extensible Plugin System** - Simple base class for custom header checks
|
|
308
|
-
5. **Comprehensive Testing** - WebMock stubs prevent live network calls in tests
|
|
309
|
-
|
|
310
198
|
## Contributing
|
|
311
199
|
|
|
312
200
|
1. Fork the repository
|
|
@@ -322,21 +210,6 @@ Hedra includes GitHub Actions CI configuration that:
|
|
|
322
210
|
|
|
323
211
|
MIT License - see [LICENSE](LICENSE) file for details.
|
|
324
212
|
|
|
325
|
-
## Support
|
|
326
|
-
|
|
327
|
-
- 📖 Documentation: [GitHub Wiki](https://github.com/hedra/hedra/wiki)
|
|
328
|
-
- 🐛 Issues: [GitHub Issues](https://github.com/hedra/hedra/issues)
|
|
329
|
-
- 💬 Discussions: [GitHub Discussions](https://github.com/hedra/hedra/discussions)
|
|
330
|
-
|
|
331
|
-
## Acknowledgments
|
|
332
|
-
|
|
333
|
-
Built with:
|
|
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
|
|
339
|
-
|
|
340
213
|
---
|
|
341
214
|
|
|
342
|
-
|
|
215
|
+
Built by [BlackStack](https://github.com/bl4ckstack)
|
data/lib/hedra/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hedra
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- BlackStack
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 2025-11-12 00:00:00.000000000 Z
|
|
@@ -96,7 +96,7 @@ dependencies:
|
|
|
96
96
|
description: A comprehensive security header analyzer with scanning, auditing, and
|
|
97
97
|
monitoring capabilities
|
|
98
98
|
email:
|
|
99
|
-
-
|
|
99
|
+
- info@blackstack.com
|
|
100
100
|
executables:
|
|
101
101
|
- hedra
|
|
102
102
|
extensions: []
|
|
@@ -116,7 +116,7 @@ files:
|
|
|
116
116
|
- lib/hedra/plugin_manager.rb
|
|
117
117
|
- lib/hedra/scorer.rb
|
|
118
118
|
- lib/hedra/version.rb
|
|
119
|
-
homepage: https://github.com/
|
|
119
|
+
homepage: https://github.com/bl4ckstack/hedra
|
|
120
120
|
licenses:
|
|
121
121
|
- MIT
|
|
122
122
|
metadata:
|