Commit b6be194
fix(media): remove <=1MB fallback and fix sanitize_slack_filename & escape
Address two blocking review findings from PR #793:
1. Remove the <=1MB raw-byte fallback in download_and_encode_image.
validate_image_response only sniffs magic bytes; resize_and_compress
does the full decode. The fallback forwarded raw bytes under Slack's
claimed MIME when resize failed on a corrupt/truncated body, reopening
the same JSONL poisoning class as #776. Now always returns
ProcessingFailed on resize failure.
2. Add & -> & escape to sanitize_slack_filename before < and >
replacements. Slack mrkdwn decodes HTML entities before markup parsing,
so <@here> would bypass the angle-bracket replacement and render
as a mention ping.
Add regression tests for both fixes.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>1 parent 6d7fd5f commit b6be194
2 files changed
Lines changed: 38 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
287 | 282 | | |
288 | 283 | | |
289 | 284 | | |
| |||
756 | 751 | | |
757 | 752 | | |
758 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
759 | 774 | | |
760 | 775 | | |
761 | 776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1236 | 1236 | | |
1237 | 1237 | | |
1238 | 1238 | | |
1239 | | - | |
| 1239 | + | |
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
| |||
1435 | 1435 | | |
1436 | 1436 | | |
1437 | 1437 | | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1438 | 1448 | | |
1439 | 1449 | | |
1440 | 1450 | | |
| |||
0 commit comments