Skip to content

Commit

Permalink
Add microseconds to filename format to make it harder to predict
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisjacquet committed Apr 30, 2022
1 parent 21dc2f7 commit d6e4dae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changes in 8.9.5
- Fix stored XSS security issue: escape HTML attribute in StudentAssignments.fnc.php, thanks to @dungtuanha
- Use big random number for parent password generation in NotifyParents.php & CreateParents.php, thanks to @intrapus
- Fix stored XSS security issue: remove inline JS from URL in PreparePHP_SELF.fnc.php, thanks to @intrapus
- Add microseconds to filename format to make it harder to predict in StudentAssignments.fnc.php, thanks to @dungtuanha

Changes in 8.9.4
----------------
Expand Down
6 changes: 5 additions & 1 deletion modules/Grades/includes/StudentAssignments.fnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* @uses FileUpload()
* @uses SanitizeHTML()
* @since 2.9
* @since 8.9.5 Add microseconds to filename format to make it harder to predict.
*
* @param string $assignment_id Assignment ID.
* @param array $error Global errors array.
Expand Down Expand Up @@ -59,7 +60,10 @@ function StudentAssignmentSubmit( $assignment_id, &$error )
$files = issetVal( $old_data['files'] );

$timestamp = date( 'Y-m-d H:i:s' );
$timestamp = new \DateTime();

// @since 8.9.5 Add microseconds to filename format to make it harder to predict.
$timestamp = $timestamp->format( 'Y-m-d H:i:s.u' );

$assignments_path = GetAssignmentsFilesPath( $assignment['STAFF_ID'] );

Expand Down

0 comments on commit d6e4dae

Please sign in to comment.