Commit 0951902
authored
logs: enable NoFollow for process_log-discovered paths
Turn on the no-follow enforcement plumbed through in the previous stack
entries, for the one provider it's meant for:
- pkg/logs/schedulers/ad/scheduler.go sets cfg.NoFollow = true for sources
whose config.Provider is names.ProcessLog. process_log paths come from
readlink(/proc/<pid>/fd/<n>); the kernel resolves all symlinks at
file-open time, so the string in /proc/fd is already canonical - any
symlink appearing later at that path was planted after discovery and
indicates an attacker-controlled swap. Other providers (file, kubernetes,
...) are unaffected: their paths are explicitly specified by the user, and
it's up to the user to ensure such a path isn't swapped for a symlink by
an untrusted party.
- comp/core/autodiscovery/providers/process_log.go's checkFileReadable now
opens with privilegedlogsclient.OpenNoFollow instead of Open, to match
what the tailer does when it actually reads the discovered file.
Closes DSCVR-475. Final PR in the stack split out of PR #51746 for easier
review; depends on the tailer/fingerprinter NoFollow-plumbing PR.
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Vincent Whitchurch <vincent.whitchurch@datadoghq.com>1 parent 8a4b41e commit 0951902
3 files changed
Lines changed: 65 additions & 1 deletion
File tree
- comp/core/autodiscovery/providers
- pkg/logs/schedulers/ad
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
265 | 273 | | |
266 | 274 | | |
267 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
0 commit comments