Repository navigation
fix(file-source): [OBE-12847] add symlink_policy to control symlink following - #185
Open
JuanMantica45 wants to merge 1 commit into
Open
JuanMantica45 wants to merge 1 commit into
JuanMantica45 wants to merge 1 commit into
Conversation
…ollowing Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
filesource followed symlinks unconditionally, so a low-privilege user with write access to a globbed directory couldln -s /etc/shadow x.logand have Vector (often root) ship the contents to a sink.symlink_policyon thefilesource:follow(default, unchanged behavior),deny(skip symlinks),within_root(follow only if the real path stays under the include pattern's literal directory prefix).FileWatcher::new,update_path, 5 fingerprinter opens) go through oneSymlinkPolicy::openhelper usingO_NOFOLLOWon unix fordeny/within_root, so a swap after the glob check fails closed.followbecause k8s log paths (/var/log/containers/*.log) are symlinks;kubernetes_logsis hardcoded toFollow. Opting in (e.g. Observo-generatedfileconfigs usingwithin_root) is a follow-up template change.excludematches the symlink path, not its target. Cue reference hand-edited (not regenerated) and changelog fragment added.Known limits
within_root: a parent directory swapped into a symlink between the glob check and the open is not covered;O_NOFOLLOWonly guards the final component.emit_path_globbing_failedevery glob cycle (~1s default); I did not check whether that event is rate-limited.symlink_metadatacheck) is untested.Test plan
cargo test -p file-source(25 pass), incl. open-policy and glob policy tests; existing fingerprint/checkpoint tests unchangedcargo test --lib --no-default-features --features sources-file sources::file(34 pass), incl. end-to-end follow/deny/within_root testscargo check --lib --no-default-features --features sources-kubernetes_logsJira: OBE-12847
🤖 Generated with Claude Code