From 92ca95a1db028f8b49f8bd8954dbe5f27a55cfbe Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 27 Nov 2026 09:24:38 +0100 Subject: [PATCH 1/3] fix(attachments): drop the hardcoded 1 GiB size limit `sentry__attachment_validate()` rejected attachments over 1 GiB. That matched Relay's former `max_upload_size` default. When Relay introduced the upload endpoint, it only accepted the file as the body of the creation request, so the client was already sending an oversized file by the time Relay rejected it. Since getsentry/relay#5685, Relay accepts a bodiless TUS creation request followed by `PATCH` uploads, which is the flow the SDK uses. The creation request declares `Upload-Length`, and Relay rejects anything above `max_upload_size` with `413` before any attachment data is sent. The SDK then drops the attachment-ref item, records a client report, and sends the rest of the envelope. getsentry/relay#6515 raised the default `max_upload_size` to 10 GiB, leaving the SDK-side copy out of sync. Leave the size limit to the server. --- src/sentry_attachment.c | 7 ------- src/sentry_attachment.h | 1 - tests/unit/test_envelopes.c | 23 +++++++++-------------- tests/unit/tests.inc | 2 +- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/sentry_attachment.c b/src/sentry_attachment.c index 4d5c8ad22d..ad2a6b54d1 100644 --- a/src/sentry_attachment.c +++ b/src/sentry_attachment.c @@ -456,14 +456,7 @@ sentry__attachment_validate(sentry_value_t attachment) if (sentry_value_get_type(attachment) != SENTRY_VALUE_TYPE_OBJECT) { return false; } - size_t size = sentry__attachment_get_size(attachment); const char *filename = sentry__attachment_get_filename(attachment); - if (size > SENTRY_MAX_ATTACHMENT_SIZE) { - SENTRY_WARNF("rejected oversized attachment \"%s\" (%zu > %d MiB)", - filename ? filename : "", size / (1024 * 1024), - SENTRY_MAX_ATTACHMENT_SIZE / (1024 * 1024)); - return false; - } sentry_uuid_t attachment_id = sentry__attachment_get_id(attachment); return !sentry_uuid_is_nil(&attachment_id) && (sentry__attachment_get_path(attachment) diff --git a/src/sentry_attachment.h b/src/sentry_attachment.h index 808c3fe533..8275f008bc 100644 --- a/src/sentry_attachment.h +++ b/src/sentry_attachment.h @@ -7,7 +7,6 @@ #include "sentry_value.h" #define SENTRY_LARGE_ATTACHMENT_SIZE (100 * 1024 * 1024) // 100 MiB -#define SENTRY_MAX_ATTACHMENT_SIZE (1024 * 1024 * 1024) // 1 GiB /* * Attachments are object values with two data representations: diff --git a/tests/unit/test_envelopes.c b/tests/unit/test_envelopes.c index 7a0d78099c..f6e95237b7 100644 --- a/tests/unit/test_envelopes.c +++ b/tests/unit/test_envelopes.c @@ -1174,7 +1174,7 @@ SENTRY_TEST(attachment_ref_roundtrip) } static void -check_oversized_minidump(sentry_envelope_t *envelope, void *data) +check_large_minidump(sentry_envelope_t *envelope, void *data) { size_t *called = data; (*called)++; @@ -1184,43 +1184,38 @@ check_oversized_minidump(sentry_envelope_t *envelope, void *data) char filename[41]; sentry_uuid_as_string(&event_id, filename); memcpy(filename + 36, ".dmp", 5); - check_attachment_ref_item(envelope, 1, "sentry_test_oversized_minidump.dmp", + check_attachment_ref_item(envelope, 1, "sentry_test_large_minidump.dmp", "application/octet-stream", SENTRY_ATTACHMENT_TYPE_MINIDUMP, - SENTRY_MAX_ATTACHMENT_SIZE + 1, filename); + SENTRY_LARGE_ATTACHMENT_SIZE + 1, filename); SENTRY_WITH_OPTIONS (options) { sentry_path_t *cached = sentry__path_join_str(options->run->cache_path, filename); TEST_CHECK_INT_EQUAL( - sentry__path_get_size(cached), SENTRY_MAX_ATTACHMENT_SIZE + 1); + sentry__path_get_size(cached), SENTRY_LARGE_ATTACHMENT_SIZE + 1); sentry__path_remove(cached); sentry__path_free(cached); } sentry_envelope_free(envelope); } -SENTRY_TEST(capture_minidump_oversized) +SENTRY_TEST(capture_minidump_large) { #if defined(SENTRY_PLATFORM_ANDROID) || defined(SENTRY_PLATFORM_NX) \ || defined(SENTRY_PLATFORM_PS) || defined(SENTRY_PLATFORM_XBOX) SKIP_TEST(); #else const char *filename - = SENTRY_TEST_PATH_PREFIX "sentry_test_oversized_minidump.dmp"; + = SENTRY_TEST_PATH_PREFIX "sentry_test_large_minidump.dmp"; sentry_path_t *path = sentry__path_from_str(filename); FILE *f = fopen(filename, "wb"); TEST_ASSERT(!!f); - TEST_ASSERT_INT_EQUAL(fseek(f, SENTRY_MAX_ATTACHMENT_SIZE, SEEK_SET), 0); + TEST_ASSERT_INT_EQUAL(fseek(f, SENTRY_LARGE_ATTACHMENT_SIZE, SEEK_SET), 0); TEST_ASSERT_INT_EQUAL(fputc('x', f), 'x'); TEST_ASSERT_INT_EQUAL(fclose(f), 0); - sentry_value_t attachment = sentry_attachment_from_file(filename); - TEST_CHECK(sentry_value_is_null(attachment)); - sentry_value_decref(attachment); - size_t called = 0; - sentry_transport_t *transport - = sentry_transport_new(check_oversized_minidump); + sentry_transport_t *transport = sentry_transport_new(check_large_minidump); sentry_transport_set_state(transport, &called); SENTRY_TEST_OPTIONS_NEW(options); sentry_options_set_dsn(options, "https://foo@sentry.invalid/42"); @@ -1231,7 +1226,7 @@ SENTRY_TEST(capture_minidump_oversized) sentry_uuid_t event_id = sentry_capture_minidump(filename); TEST_CHECK(!sentry_uuid_is_nil(&event_id)); TEST_CHECK_INT_EQUAL( - sentry__path_get_size(path), SENTRY_MAX_ATTACHMENT_SIZE + 1); + sentry__path_get_size(path), SENTRY_LARGE_ATTACHMENT_SIZE + 1); sentry_close(); sentry__path_remove(path); sentry__path_free(path); diff --git a/tests/unit/tests.inc b/tests/unit/tests.inc index effb674974..4c6756694d 100644 --- a/tests/unit/tests.inc +++ b/tests/unit/tests.inc @@ -117,8 +117,8 @@ XX(capture_hint_cleanup) XX(capture_minidump_basic) XX(capture_minidump_discard) XX(capture_minidump_invalid_path) +XX(capture_minidump_large) XX(capture_minidump_null_path) -XX(capture_minidump_oversized) XX(capture_minidump_wide) XX(capture_minidump_without_sentry_init) XX(check_version) From d73f6a9388183e927e2286a4ce28da32636136e7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 27 Nov 2026 09:24:42 +0100 Subject: [PATCH 2/3] docs: drop server feature flag from enable_large_attachments The note named `projects:relay-upload-endpoint`, which Relay removed when the upload endpoint became generally available in getsentry/relay#6171. The remaining upload flags are temporary rollout flags: `projects:resumable-uploads` makes uploads resumable, and `projects:relay-minidump-uploads` gates minidump uploads. Naming them in the API docs would go stale the same way. --- include/sentry.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/sentry.h b/include/sentry.h index e8ba4a577e..103d6b62c3 100644 --- a/include/sentry.h +++ b/include/sentry.h @@ -3268,9 +3268,6 @@ SENTRY_EXPERIMENTAL_API int sentry_options_get_attach_stacktrace( * attachments are embedded in the envelope and oversized uploads are rejected * by Sentry. * - * Note: Requires the `projects:relay-upload-endpoint` server feature. See - * https://develop.sentry.dev/sdk/telemetry/attachments/#attachment-placeholders - * * Disabled by default. */ SENTRY_EXPERIMENTAL_API void sentry_options_set_enable_large_attachments( From 7a692b124f53590cd7831ef6999023fc10730d47 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 27 Nov 2026 11:01:31 +0100 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb90d95fb1..c812bec838 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +**Fixes**: + +- Drop the outdated 1 GiB size limit for TUS attachment uploads. ([#2352](https://github.com/getsentry/sentry-native/pull/2352)) + ## 1.0.0-beta.2 **Features**: