Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when deleting symlinks targeting locations outside temp dir #4306

Merged
merged 4 commits into from
Feb 10, 2025

Conversation

marcphilipp
Copy link
Member

Overview

Resolves #4303.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

Copy link
Contributor

@YongGoose YongGoose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an honor to review your code❕

It’s so clean that I only have one piece of feedback—and even that is just a minor code style improvement.

Great work!

Comment on lines 448 to 451
assertThat(listener.stream(Level.WARNING)).map(LogRecord::getMessage) //
.contains(("Deleting symbolic link from location inside of temp dir (%s) "
+ "to location outside of temp dir (%s) but not the target file/directory").formatted(
symbolicLink, directoryOutsideTempDir));
Copy link
Contributor

@YongGoose YongGoose Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertThat(listener.stream(Level.WARNING)).map(LogRecord::getMessage) //
.contains(("Deleting symbolic link from location inside of temp dir (%s) "
+ "to location outside of temp dir (%s) but not the target file/directory").formatted(
symbolicLink, directoryOutsideTempDir));
assertThat(listener.stream(Level.WARNING)) //
.map(LogRecord::getMessage) //
.contains(("Deleting symbolic link from location inside of temp dir (%s) "
+ "to location outside of temp dir (%s) but not the target file/directory") //
.formatted(symbolicLink, directoryOutsideTempDir));

This change looked a bit cleaner to me.
It's a very minor adjustment, so feel free to ignore it if you don’t think it’s necessary!


image

This is the change I’d like to make, but I’m not sure if it has been applied correctly... 😵‍💫
If you accept my change and it ends up failing at the check stage, I sincerely apologize..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8c1d995

@marcphilipp marcphilipp merged commit b9e075c into main Feb 10, 2025
15 checks passed
@marcphilipp marcphilipp deleted the marc/4303-warn-on-temp-dir-external-link branch February 10, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warn when deleting symlinks that point outside temp dir
3 participants