Skip to content

Commit

Permalink
validate buildjob file name
Browse files Browse the repository at this point in the history
  • Loading branch information
BBesrour committed Sep 10, 2024
1 parent 5d8926c commit f03a6b6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ public void saveBuildLogsToFile(List<BuildLogEntry> buildLogEntries, String buil
* @return A {@link FileSystemResource} representing the log file if it exists, or {@code null} if the log file cannot be found.
*/
public FileSystemResource retrieveBuildLogsFromFileForBuildJob(String buildJobId) {
if (buildJobId.contains("/") || buildJobId.contains("\\") || buildJobId.contains("..")) {
log.warn("Invalid build job ID: {}", buildJobId);
throw new IllegalArgumentException("Invalid build job ID");
}

ProgrammingExercise programmingExercise = retrieveProgrammingExerciseByBuildJobId(buildJobId);
String courseShortName = programmingExercise.getCourseViaExerciseGroupOrCourseMember().getShortName();
String exerciseShortName = programmingExercise.getShortName();
Expand Down

0 comments on commit f03a6b6

Please sign in to comment.