Skip to content

Commit 3aa1bef

Browse files
authored
feat: forbid appstore connect payload (#72203)
This removes the "Appstore connect" payload from being sent to symbol source POST endpoint. This is done to prepare for sunsetting the App Store Connect integration. Ref: #51994
1 parent 69bf4f9 commit 3aa1bef

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/sentry/api/endpoints/project_symbol_sources.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from sentry.lang.native.sources import (
2222
REDACTED_SOURCE_SCHEMA,
2323
REDACTED_SOURCES_SCHEMA,
24+
SOURCES_WITHOUT_APPSTORE_CONNECT,
2425
VALID_CASINGS,
2526
VALID_LAYOUTS,
2627
InvalidSourcesError,
@@ -337,7 +338,8 @@ def post(self, request: Request, project: Project) -> Response:
337338
sources.append(source)
338339

339340
try:
340-
validate_sources(sources)
341+
# TODO(@anonrig): Update this schema when AppStore connect is sunset.
342+
validate_sources(sources, schema=SOURCES_WITHOUT_APPSTORE_CONNECT)
341343
except InvalidSourcesError:
342344
return Response(status=400)
343345

src/sentry/lang/native/sources.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@
138138
"items": SOURCE_SCHEMA,
139139
}
140140

141+
# TODO(@anonrig): Remove this when AppStore connect integration is sunset.
142+
# Ref: https://github.com/getsentry/sentry/issues/51994
143+
SOURCES_WITHOUT_APPSTORE_CONNECT = {
144+
"type": "array",
145+
"items": {
146+
"oneOf": [
147+
HTTP_SOURCE_SCHEMA,
148+
S3_SOURCE_SCHEMA,
149+
GCS_SOURCE_SCHEMA,
150+
]
151+
},
152+
}
153+
141154

142155
# Schemas for sources with redacted secrets
143156
HIDDEN_SECRET_SCHEMA = {
@@ -355,13 +368,13 @@ def secret_fields(source_type):
355368
yield from []
356369

357370

358-
def validate_sources(sources):
371+
def validate_sources(sources, schema=SOURCES_SCHEMA):
359372
"""
360373
Validates sources against the JSON schema and checks that
361374
their IDs are ok.
362375
"""
363376
try:
364-
jsonschema.validate(sources, SOURCES_SCHEMA)
377+
jsonschema.validate(sources, schema)
365378
except jsonschema.ValidationError as e:
366379
raise InvalidSourcesError(f"{e}")
367380

0 commit comments

Comments
 (0)