Skip to content

do not apply POSIX file attributes through symbolic links - #4229

Open
jmestwa-coder wants to merge 1 commit into
apache:2.xfrom
jmestwa-coder:posix-view-symlink
Open

do not apply POSIX file attributes through symbolic links#4229
jmestwa-coder wants to merge 1 commit into
apache:2.xfrom
jmestwa-coder:posix-view-symlink

Conversation

@jmestwa-coder

Copy link
Copy Markdown

PosixViewAttribute applies permissions and ownership through symbolic links:

  • FileUtils.defineFilePosixAttributeView looks the view up without NOFOLLOW_LINKS, so setPermissions/setOwner/setGroup land on the link target
  • walkFileTree still hands symlinks to visitFile, so the followLinks="false" default documented on AbstractPathAction has no effect here
  • a link planted in basePath whose name matches the PathCondition glob redirects the chmod/chown onto any file the process can reach
  • FileManager.defineAttributeView goes through the same helper

Requesting the view with NOFOLLOW_LINKS makes the change fail on a link rather than hit its target, and the visitor now skips symlinks so a planted one does not abort the rollover action.

Checklist

  • Base your changes on 2.x branch if you are targeting Log4j 2; use main otherwise
  • ./mvnw verify succeeds (the build instructions)
  • Non-trivial changes contain an entry file in the src/changelog/.2.x.x directory
  • Tests are provided

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant