Skip to content

Clean up review feedback in SecurityUtils filename sanitization#101

Closed
Copilot wants to merge 2 commits intosentinel-fix-path-traversal-uiutils-18203989286040931931from
copilot/sub-pr-98
Closed

Clean up review feedback in SecurityUtils filename sanitization#101
Copilot wants to merge 2 commits intosentinel-fix-path-traversal-uiutils-18203989286040931931from
copilot/sub-pr-98

Conversation

Copy link

Copilot AI commented Feb 27, 2026

Two minor issues flagged in code review of the path traversal hardening changes:

  • Remove redundant try/catch in SecurityUtils.sanitizeFileName()String.replace() never throws, so the block implied false error-handling semantics
  • Rename test method testSanitizeFileName_onPathSegmentLikeInputstestSanitizeFileNameOnPathSegmentLikeInputs to match the camelCase convention used throughout SecurityUtilsTest

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: dlukt <201112286+dlukt@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 27, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.14.1-bin/baw1sv0jfoi8rxs14qo3h49cs/gradle-8.14.1/lib/gradle-daemon-main-8.14.1.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix path traversal in UiUtils filename extraction Clean up review feedback in SecurityUtils filename sanitization Feb 27, 2026
@dlukt dlukt marked this pull request as ready for review February 27, 2026 15:49
Copilot AI review requested due to automatic review settings February 27, 2026 15:49
@dlukt dlukt closed this Feb 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses two code review feedback items from the path traversal hardening changes in SecurityUtils.sanitizeFileName(): removing an unnecessary try-catch block around String.replace() operations that never throw exceptions, and renaming a test method to follow the consistent camelCase naming convention used throughout the test file.

Changes:

  • Removed redundant try-catch block in SecurityUtils.sanitizeFileName() since String.replace() never throws exceptions
  • Renamed test method from testSanitizeFileName_onPathSegmentLikeInputs to testSanitizeFileNameOnPathSegmentLikeInputs to match camelCase convention

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
mastodon/src/main/java/de/icod/techidon/utils/SecurityUtils.java Removed unnecessary try-catch wrapper around String.replace() calls in sanitizeFileName()
mastodon/src/test/java/de/icod/techidon/utils/SecurityUtilsTest.java Renamed test method to follow camelCase naming convention

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants