Commit Graph

17 Commits

Author SHA1 Message Date
Joao Lisboa
b2f3e69eae fix: follow redirects when downloading Twilio media
node:https request() doesn't follow redirects by default, causing
Twilio media URLs (which 302 to CDN) to save placeholder/metadata
instead of actual images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:07:13 +00:00
Joao Lisboa
d53d8da56f fix: media serving and id consistency
- server.ts: Replace sendFile with manual readFile+send to fix
  NotFoundError when serving media (sendFile failed even after stat)
- store.ts: Return id with file extension so it matches actual filename

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 21:07:13 +00:00
Peter Steinberger
dc226c4ee0 fix(media): block symlink traversal 2025-12-02 18:37:15 +00:00
Joao Lisboa
0ea182c0c1 Fix path traversal vulnerability in media server
The /media/:id endpoint was vulnerable to path traversal attacks.
Since this endpoint is exposed via Tailscale Funnel (unlike the
WhatsApp webhook which requires Twilio signature validation),
attackers could directly request paths like /media/%2e%2e%2fwarelay.json
to access sensitive files in ~/.warelay/ (e.g. warelay.json), or even
escape further to the user's home directory via multiple ../ sequences.

Fix: validate resolved paths stay within the media directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 19:33:21 +01:00
Peter Steinberger
258bb716c5 chore: release 1.2.1 2025-11-28 08:11:07 +01:00
Peter Steinberger
6b8240ab72 fix(media): sniff mime and keep extensions 2025-11-28 08:07:53 +01:00
Peter Steinberger
9fa3cbab8a chore: format to 2-space and bump changelog 2025-11-26 00:53:53 +01:00
Peter Steinberger
918ca94df8 feat: support audio/video/doc media caps and transcript context 2025-11-25 23:21:35 +01:00
Peter Steinberger
86df9a4fb6 Add media hosting and store tests 2025-11-25 12:30:43 +01:00
Peter Steinberger
d298ca2d81 chore: sync source updates 2025-11-25 12:12:13 +01:00
Peter Steinberger
9366140271 refactor: simplify MEDIA parsing, drop invalid lines, keep valid tokens 2025-11-25 06:17:48 +01:00
Peter Steinberger
e79ea15d47 debug: log MEDIA extraction and parse Claude text for tokens 2025-11-25 06:14:12 +01:00
Peter Steinberger
3e4cf4ee03 fix: strip trailing punctuation from MEDIA tokens and add tests 2025-11-25 06:07:11 +01:00
Peter Steinberger
5ad379e7d1 fix: keep MEDIA tokens with punctuation and log web media failures 2025-11-25 06:02:41 +01:00
Peter Steinberger
60e9344c2a refactor: extract MEDIA parsing helper and tidy whitespace 2025-11-25 05:49:18 +01:00
Peter Steinberger
b878d51488 feat: download inbound media and expose to templating 2025-11-25 05:17:59 +01:00
Peter Steinberger
0bd9c5f5c7 feat: add image support across web and twilio 2025-11-25 04:58:31 +01:00