Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,19 @@ def post(self, request: Request, project: Project) -> Response:
password = serializer.validated_data.get("itunesPassword")
credentials_id = serializer.validated_data.get("id")

if credentials_id is not None:
no_new_password = not password or password == {"hidden-secret": True}
source_credentials_from_project = not user_name or no_new_password

if credentials_id is not None and source_credentials_from_project:
try:
symbol_source_config = appconnect.AppStoreConnectConfig.from_project_config(
project, credentials_id
)
except KeyError:
return Response("No credentials found.", status=400)

user_name = symbol_source_config.itunesUser
password = symbol_source_config.itunesPassword
user_name = symbol_source_config.itunesUser if not user_name else user_name
password = symbol_source_config.itunesPassword if no_new_password else password

if user_name is None:
return Response("No user name provided.", status=400)
Expand Down
2 changes: 1 addition & 1 deletion src/sentry/utils/appleconnect/itunes_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def start_login_sequence(self, username: str, password: str) -> None:
self._session_id = start_login.headers["x-apple-id-session-id"]
self._scnt = start_login.headers["scnt"]
self.state = ClientState.AUTH_REQUESTED
elif start_login.status_code == http.HTTPStatus.UNAUTHORIZED:
elif start_login.status_code in [http.HTTPStatus.UNAUTHORIZED, http.HTTPStatus.FORBIDDEN]:
raise InvalidUsernamePasswordError
else:
raise ITunesError(f"Unexpected status code form sign in: {start_login.status_code}")
Expand Down