Skip to content

fix(builtins): sanitize curl multipart field names to prevent header injection#1053

Merged
chaliy merged 3 commits intomainfrom
fix/issue-985-curl-multipart-injection
Apr 4, 2026
Merged

fix(builtins): sanitize curl multipart field names to prevent header injection#1053
chaliy merged 3 commits intomainfrom
fix/issue-985-curl-multipart-injection

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 3, 2026

Summary

  • Add sanitize_multipart_name() that rejects \r/\n and escapes " in field names/filenames
  • Early validation before network check (defense in depth)
  • Sanitization applied when building Content-Disposition headers in multipart body

Test plan

  • Field name with " is properly escaped
  • Field name with \r\n is rejected with error (exit 2)
  • Normal multipart fields still work
  • 5 unit tests + 3 integration tests pass
  • All existing curl tests pass

Closes #985

@chaliy chaliy merged commit 45e76cc into main Apr 4, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-985-curl-multipart-injection branch April 4, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Curl multipart header injection via unescaped field names/filenames

1 participant