Skip to content

Commit

Permalink
snyk: fix potential memory leak when maxAge = -1
Browse files Browse the repository at this point in the history
  • Loading branch information
oranheim committed Oct 1, 2024
1 parent 32f6480 commit 303c166
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public CORSHandler(HttpHandler next, HttpHandler fail, List<Pattern> originPatte
this.originPatterns = originPatterns;
this.supportsCredential = supportsCredential;
this.preflightResponseCode = preflightResponseCode;

if (maxAge == -1) {
throw new IllegalStateException("maxAge cannot be -1 due to potential memory leak vulnerabilities.");
}

this.maxAge = maxAge;
this.allowedMethods = allowedMethods;
this.allowedHeaders = allowedHeaders;
Expand Down

0 comments on commit 303c166

Please sign in to comment.