-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hawkbit-ddi-resource: do not log range requests
Range requests can be extremely numerous, and logging them is counter productive. The large number of messages can overflow the action history, making it nearly useless. Worse this can trigger denial-of-service protection limits, even on moderate artifact sizes. Signed-off-by: Zygmunt Krynicki <[email protected]>
- Loading branch information
Showing
1 changed file
with
4 additions
and
6 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 |
---|---|---|
|
@@ -204,7 +204,7 @@ public ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") fina | |
final ActionStatus action = checkAndLogDownload(requestResponseContextHolder.getHttpServletRequest(), | ||
target, module.getId()); | ||
|
||
final Long statusId = action.getId(); | ||
final Long statusId = action != null ? action.getId() : Long.valueOf(0); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
result = FileStreamingUtil.writeFileResponse(file, artifact.getFilename(), artifact.getCreatedAt(), | ||
requestResponseContextHolder.getHttpServletResponse(), | ||
|
@@ -226,13 +226,11 @@ private ActionStatus checkAndLogDownload(final HttpServletRequest request, final | |
final String range = request.getHeader("Range"); | ||
|
||
final String message; | ||
if (range != null) { | ||
message = RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: " | ||
+ request.getRequestURI(); | ||
} else { | ||
message = RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI(); | ||
if (range == null) { | ||
This comment has been minimized.
Sorry, something went wrong.
avgustinmm
Contributor
|
||
return null; | ||
} | ||
|
||
message = RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI(); | ||
return controllerManagement.addInformationalActionStatus( | ||
entityFactory.actionStatus().create(action.getId()).status(Status.DOWNLOAD).message(message)); | ||
} | ||
|
this could lead to incorrect event with action id 0