-
Notifications
You must be signed in to change notification settings - Fork 4
Parse Content-Disposition header as user input #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…lename" This reverts commit e1ead53.
agent_api/src/main/java/dev/aikido/agent_api/vulnerabilities/StringsFromContext.java
Show resolved
Hide resolved
agent_api/src/main/java/dev/aikido/agent_api/helpers/ContentDispositionFilename.java
Show resolved
Hide resolved
agent_api/src/main/java/dev/aikido/agent_api/helpers/ContentDispositionHeader.java
Show resolved
Hide resolved
agent_api/src/main/java/dev/aikido/agent_api/helpers/ContentDispositionHeader.java
Outdated
Show resolved
Hide resolved
…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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
agent_api/src/main/java/dev/aikido/agent_api/helpers/ContentDispositionHeader.java
Show resolved
Hide resolved
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.