Commit 5f72894
authored
feat(webhooks): simplify host whitelist with permissive default (mcuadros#410)
## Summary
Simplifies webhook security to follow the same trust model as local
command execution: **if you control the configuration, you control the
behavior**.
- `webhook-allowed-hosts` defaults to `*` (allow all hosts)
- Setting specific hosts enables whitelist mode
- Removed complex SSRF blocking (inconsistent with local command trust
model)
Closes mcuadros#407
## Security Model
Since Ofelia already trusts users to:
- Run arbitrary commands via `job-local`
- Execute commands in containers via `job-exec`
It applies the same trust level to webhook destinations. The user
controls the config; the user controls what happens.
## Configuration
| Setting | Behavior |
|---------|----------|
| `webhook-allowed-hosts = *` (default) | All hosts allowed |
| `webhook-allowed-hosts = hooks.slack.com, ntfy.internal` | Whitelist
mode |
### Default (self-hosted environments)
No configuration needed - all hosts work out of the box:
```ini
# No config required - webhook-allowed-hosts defaults to "*"
```
### Whitelist mode (cloud/multi-tenant deployments)
```ini
[global]
webhook-allowed-hosts = hooks.slack.com, discord.com, ntfy.internal, 192.168.1.20
```
Supports wildcards:
```ini
[global]
webhook-allowed-hosts = *.slack.com, *.internal.example.com
```
## Test Plan
- [x] Unit tests for default `*` configuration (allow all)
- [x] Unit tests for whitelist mode with specific hosts
- [x] Unit tests for wildcard matching
- [x] Documentation updated (webhooks.md, SECURITY.md)
- [x] All existing tests passFile tree
7 files changed
+499
-467
lines changed- cli
- docs
- middlewares
7 files changed
+499
-467
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 320 | + | |
326 | 321 | | |
327 | | - | |
328 | | - | |
329 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
330 | 326 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
335 | 330 | | |
336 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
337 | 336 | | |
338 | | - | |
339 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
340 | 341 | | |
341 | | - | |
342 | | - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
343 | 347 | | |
344 | 348 | | |
345 | 349 | | |
| |||
482 | 486 | | |
483 | 487 | | |
484 | 488 | | |
485 | | - | |
| 489 | + | |
486 | 490 | | |
487 | 491 | | |
488 | 492 | | |
| |||
505 | 509 | | |
506 | 510 | | |
507 | 511 | | |
508 | | - | |
| 512 | + | |
509 | 513 | | |
510 | 514 | | |
511 | 515 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
| 368 | + | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
371 | 371 | | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
377 | 412 | | |
378 | 413 | | |
379 | 414 | | |
380 | 415 | | |
381 | 416 | | |
382 | 417 | | |
383 | 418 | | |
| 419 | + | |
384 | 420 | | |
385 | 421 | | |
386 | 422 | | |
| |||
441 | 477 | | |
442 | 478 | | |
443 | 479 | | |
444 | | - | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
445 | 489 | | |
446 | | - | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
447 | 495 | | |
448 | | - | |
449 | | - | |
450 | | - | |
| 496 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
299 | 304 | | |
300 | 305 | | |
301 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
| 150 | + | |
144 | 151 | | |
145 | 152 | | |
146 | 153 | | |
| |||
0 commit comments