dalelane opened a new pull request, #30192:
URL: https://github.com/apache/flink/pull/30192

   ## What is the purpose of the change
   
   REST handlers that serve log and profiler files have the same gap that was 
fixed in FLINK-41694. They strip any path from the filename, but leave `.` and 
`..`.
   
   This doesn't cause any file outside of their directories to be read, as a 
directory can't be opened and results in an http-500 error, but this would be 
better recognised as a bad input parameter.
   
   ## Brief change log
   
   The filename check added in FLINK-41694 to JarIdPathParameter is moved into 
a new FileNameUtils class so that the REST path parameter classes can all share 
it.
   
   LogFileNamePathParameter and ProfilingFileNamePathParameter now reject a 
file name that doesn't name a file (after the path is stripped) so requests 
like this will now result in an http-400 error.
   
   ## Verifying this change
   
   FileNameUtilsTest verifies the shared file name check.
   
   LogAndProfilingFileNamePathParameterTest checks the path parameters. (Names 
with a path where the last part is a file are still allowed, because the 
handlers will strip the path)
   
   FileNameRoutingITCase verifies that this works through HTTP requests. It 
checks that invalid names (including single-encoded and double-encoded ones) 
get the http-400 error and that valid names (including file names that will 
only be a plain filename after the path is stripped) are still accepted.
   
   ## Does this pull request potentially affect one of the following parts:
   
   - Dependencies (does it add or upgrade a dependency): no
   - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
   - The serializers: no
   - The runtime per-record code paths (performance sensitive): no
   - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
   - The S3 file system connector: no
   
   ## Documentation
   
   - Does this pull request introduce a new feature? no
   - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [] Yes (please specify the tool below)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to