Parse Content-Disposition header as user input#254
Conversation
…lename" This reverts commit e1ead53.
…spositionHeader.java
| return val.replaceAll(NON_LATIN1_REGEXP.pattern(), "?"); | ||
| } | ||
|
|
||
| public record ParseResult(String type, Map<String, String> params) {} |
There was a problem hiding this comment.
Public record ParseResult exposes a mutable Map 'params' (HashMap) allowing unsynchronized concurrent mutation.
Details
✨ AI Reasoning
1) The new code defines a public record ParseResult that carries a Map<String,String> params which is the mutable HashMap created in parse(); 2) Exposing a mutable map from a public API allows callers to share and mutate the same Map across threads without synchronization, creating potential data races and non-deterministic behaviour; 3) This is a thread-safety risk introduced by the new ParseResult API because the Map is not wrapped immutable or defensively copied before being exposed.
🔧 How do I fix it?
Use locks, concurrent collections, or atomic operations when accessing shared mutable state. Avoid modifying collections during iteration. Use proper synchronization primitives like mutex, lock, or thread-safe data structures.
More info - Comment @AikidoSec feedback: [FEEDBACK] to get better review comments in the future.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Closing: this never made any sense, would be a header you send out, not one you receive, the protections work for file uploads |
No description provided.