-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
64 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,4 +107,17 @@ private static Try<Model> loadFromUri( final URI uri ) { | |
private static Try<Model> loadFromUrl( final URL url ) { | ||
return Try.ofSupplier( () -> TurtleLoader.openUrl( url ) ).flatMap( TurtleLoader::loadTurtle ); | ||
} | ||
|
||
/** | ||
* Sanitizes the file name to remove any path information and retain only the base file name. | ||
* This method is used to ensure that the file name does not contain any directory path components, | ||
* which helps prevent path traversal attacks. It extracts only the file name portion from a given | ||
* string that may represent a path. | ||
* | ||
* @param fileName The file name string potentially including path information. | ||
* @return The sanitized base file name without any path components. | ||
*/ | ||
public static String sanitizeFileInformation( String fileName ) { | ||
return new File( fileName ).getName(); | ||
Check failure Code scanning / CodeQL Uncontrolled data used in path expression High
This path depends on a
user-provided value Error loading related location Loading This path depends on a user-provided value Error loading related location Loading This path depends on a user-provided value Error loading related location Loading This path depends on a user-provided value Error loading related location Loading This path depends on a user-provided value. This path depends on a user-provided value. This path depends on a user-provided value. |
||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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