Do not allow attachments on /up* topics
:lady_beetle: Describe the bug
Publishing binary data to an /up* topic can create an attachment that is then available through the /file/... endpoint.
/up* topics are used by UnifiedPush and allow anonymous publishing by design. UnifiedPush does not require attachment functionality, so attachments should not be created for these topics.
This can have an unexpected side effect for self-hosted ntfy instances. A private ntfy instance that is intended to be exclusively used by its owner or a private group can unintentionally be used as a temporary file store through the anonymous /up* endpoint.
For example:
curl -X PUT \
--data-binary @/tmp/test.bin \
https://<server>/upTESTThis creates an attachment with a publicly accessible /file/... URL.
:computer: Components impacted
- ntfy server
- UnifiedPush
/up*endpoint
:bulb: Screenshots and/or logs
Not applicable. The behavior can be reproduced with a simple curl request.
:crystal_ball: Additional context
This is mainly relevant for self-hosted ntfy instances that are intended to be private and exclusively used by their owner or a private group.
For intentionally public ntfy instances, this is less of a concern since the instance is already publicly accessible.
Expected behavior: Attachments should not be created when publishing to /up* topics, since UnifiedPush does not require this functionality.
Disabling attachment handling specifically for /up* topics would prevent the unintended file-storage use case while preserving the existing attachment functionality for regular topics.
Source: binwiederhier/ntfy