diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index 3e77a45d52e..f4e660e3c86 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -359,7 +359,7 @@ protected function validateRecordingConsent(bool $recordingConsent): void { 'apiVersion' => '(v4)', 'token' => '[a-z0-9]{4,30}', ])] - public function joinFederatedCall(string $sessionId, ?int $flags = null, bool $silent = false, bool $recordingConsent = false): DataResponse { + public function joinFederatedCall(#[\SensitiveParameter] string $sessionId, ?int $flags = null, bool $silent = false, bool $recordingConsent = false): DataResponse { if (!$this->federationAuthenticator->isFederationRequest()) { $response = new DataResponse(null, Http::STATUS_NOT_FOUND); $response->throttle(['token' => $this->room->getToken(), 'action' => 'talkRoomToken']); @@ -561,7 +561,7 @@ public function updateCallFlags(int $flags): DataResponse { 'apiVersion' => '(v4)', 'token' => '[a-z0-9]{4,30}', ])] - public function updateFederatedCallFlags(string $sessionId, int $flags): DataResponse { + public function updateFederatedCallFlags(#[\SensitiveParameter] string $sessionId, int $flags): DataResponse { if (!$this->federationAuthenticator->isFederationRequest()) { $response = new DataResponse(null, Http::STATUS_NOT_FOUND); $response->throttle(['token' => $this->room->getToken(), 'action' => 'talkRoomToken']); @@ -649,7 +649,7 @@ public function leaveCall(bool $all = false): DataResponse { 'apiVersion' => '(v4)', 'token' => '[a-z0-9]{4,30}', ])] - public function leaveFederatedCall(string $sessionId): DataResponse { + public function leaveFederatedCall(#[\SensitiveParameter] string $sessionId): DataResponse { if (!$this->federationAuthenticator->isFederationRequest()) { $response = new DataResponse(null, Http::STATUS_NOT_FOUND); $response->throttle(['token' => $this->room->getToken(), 'action' => 'talkRoomToken']); diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php index 90e8fa3c738..84f5d8ddd76 100644 --- a/lib/Controller/FilesIntegrationController.php +++ b/lib/Controller/FilesIntegrationController.php @@ -169,7 +169,7 @@ public function getRoomByFileId(string $fileId): DataResponse { 'apiVersion' => '(v1)', 'shareToken' => '.+', ])] - public function getRoomByShareToken(string $shareToken): DataResponse { + public function getRoomByShareToken(#[\SensitiveParameter] string $shareToken): DataResponse { if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES) || !$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES)) { return new DataResponse(null, Http::STATUS_BAD_REQUEST); diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php index ede1accb61d..39723e2f868 100644 --- a/lib/Controller/PublicShareAuthController.php +++ b/lib/Controller/PublicShareAuthController.php @@ -62,7 +62,7 @@ public function __construct( #[ApiRoute(verb: 'POST', url: '/api/{apiVersion}/publicshareauth', requirements: [ 'apiVersion' => '(v1)', ])] - public function createRoom(string $shareToken): DataResponse { + public function createRoom(#[\SensitiveParameter] string $shareToken): DataResponse { try { $share = $this->shareManager->getShareByToken($shareToken); } catch (ShareNotFound) { diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php index 8d6492b29d4..4c195228a2d 100644 --- a/lib/Controller/RoomController.php +++ b/lib/Controller/RoomController.php @@ -2521,7 +2521,7 @@ public function joinRoom(string $token, #[SensitiveParameter] string $password = 'apiVersion' => '(v4)', 'token' => '[a-z0-9]{4,30}', ])] - public function joinFederatedRoom(string $token, ?string $sessionId): DataResponse { + public function joinFederatedRoom(string $token, #[SensitiveParameter] ?string $sessionId): DataResponse { if (!$this->federationAuthenticator->isFederationRequest()) { $response = new DataResponse(null, Http::STATUS_NOT_FOUND); $response->throttle(['token' => $token, 'action' => 'talkRoomToken']); @@ -2940,7 +2940,7 @@ public function leaveRoom(string $token): DataResponse { 'apiVersion' => '(v4)', 'token' => '[a-z0-9]{4,30}', ])] - public function leaveFederatedRoom(string $token, string $sessionId): DataResponse { + public function leaveFederatedRoom(string $token, #[SensitiveParameter] string $sessionId): DataResponse { if (!$this->federationAuthenticator->isFederationRequest()) { $response = new DataResponse(null, Http::STATUS_NOT_FOUND); $response->throttle(['token' => $token, 'action' => 'talkRoomToken']); diff --git a/lib/Events/AAttendeeRemovedEvent.php b/lib/Events/AAttendeeRemovedEvent.php index 4ac70c048e8..369c729d6bf 100644 --- a/lib/Events/AAttendeeRemovedEvent.php +++ b/lib/Events/AAttendeeRemovedEvent.php @@ -25,6 +25,7 @@ public function __construct( Room $room, protected Attendee $attendee, protected string $reason, + #[\SensitiveParameter] protected array $sessions, ) { parent::__construct($room); diff --git a/lib/Events/BeforeSignalingResponseSentEvent.php b/lib/Events/BeforeSignalingResponseSentEvent.php index 1bfb65eca3b..f99035cc0a2 100644 --- a/lib/Events/BeforeSignalingResponseSentEvent.php +++ b/lib/Events/BeforeSignalingResponseSentEvent.php @@ -30,7 +30,7 @@ public function getAction(): string { return $this->action; } - public function setSession(array $session): void { + public function setSession(#[\SensitiveParameter] array $session): void { $this->session = $session; } diff --git a/lib/Events/BeforeTurnServersGetEvent.php b/lib/Events/BeforeTurnServersGetEvent.php index 392278cb56b..2a6d00467aa 100644 --- a/lib/Events/BeforeTurnServersGetEvent.php +++ b/lib/Events/BeforeTurnServersGetEvent.php @@ -15,7 +15,7 @@ class BeforeTurnServersGetEvent extends Event { * @param list $servers */ public function __construct( - protected array $servers, + #[\SensitiveParameter] protected array $servers, ) { parent::__construct(); } @@ -30,7 +30,7 @@ public function getServers(): array { /** * @param list $servers */ - public function setServers(array $servers): void { + public function setServers(#[\SensitiveParameter] array $servers): void { $this->servers = $servers; } } diff --git a/lib/Events/CallEndedForEveryoneEvent.php b/lib/Events/CallEndedForEveryoneEvent.php index 9fce6a91066..efd2ab0e509 100644 --- a/lib/Events/CallEndedForEveryoneEvent.php +++ b/lib/Events/CallEndedForEveryoneEvent.php @@ -17,6 +17,7 @@ public function __construct( ?Participant $actor, \DateTime $oldActiveSince, /** @var string[] */ + #[\SensitiveParameter] private readonly array $sessionIds = [], /** @var string[] */ private readonly array $userIds = [], diff --git a/lib/Files/Util.php b/lib/Files/Util.php index 61ba6b357f5..e99a4b7de5b 100644 --- a/lib/Files/Util.php +++ b/lib/Files/Util.php @@ -79,7 +79,7 @@ public function canGuestsAccessFile(string $fileId): bool { return $this->publicAccessLists[$fileId] === true; } - public function canGuestAccessFile(string $shareToken): bool { + public function canGuestAccessFile(#[\SensitiveParameter] string $shareToken): bool { try { $share = $this->shareManager->getShareByToken($shareToken); if ($share->getPassword() !== null) { diff --git a/lib/Manager.php b/lib/Manager.php index 8ec2179278d..9b657f80e7f 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -343,7 +343,7 @@ public function getInactiveRooms(\DateTime $inactiveSince): array { * @param bool $includeLastMessage * @return Room[] */ - public function getRoomsForUser(string $userId, array $sessionIds = [], bool $includeLastMessage = false): array { + public function getRoomsForUser(string $userId, #[SensitiveParameter] array $sessionIds = [], bool $includeLastMessage = false): array { return $this->getRoomsForActor(Attendee::ACTOR_USERS, $userId, $sessionIds, $includeLastMessage); } @@ -354,7 +354,7 @@ public function getRoomsForUser(string $userId, array $sessionIds = [], bool $in * @param bool $includeLastMessage * @return Room[] */ - public function getRoomsForActor(string $actorType, string $actorId, array $sessionIds = [], bool $includeLastMessage = false, array $tokens = []): array { + public function getRoomsForActor(string $actorType, string $actorId, #[SensitiveParameter] array $sessionIds = [], bool $includeLastMessage = false, array $tokens = []): array { $query = $this->db->getQueryBuilder(); $helper = new SelectHelper(); $helper->selectRoomsTable($query); @@ -676,7 +676,7 @@ public function getRoomsByIdForUser(array $roomIds, string $userId): array { * @return Room * @throws RoomNotFoundException */ - public function getRoomForUserByToken(string $token, ?string $userId, ?string $sessionId = null, bool $includeLastMessage = false, bool $isSIPBridgeRequest = false): Room { + public function getRoomForUserByToken(string $token, ?string $userId, #[SensitiveParameter] ?string $sessionId = null, bool $includeLastMessage = false, bool $isSIPBridgeRequest = false): Room { $query = $this->db->getQueryBuilder(); $helper = new SelectHelper(); $helper->selectRoomsTable($query); @@ -775,7 +775,7 @@ public function getRoomById(int $roomId): Room { /** * @throws RoomNotFoundException */ - public function getRoomByActor(string $token, string $actorType, string $actorId, ?string $sessionId = null, ?string $serverUrl = null): Room { + public function getRoomByActor(string $token, string $actorType, string $actorId, #[SensitiveParameter] ?string $sessionId = null, ?string $serverUrl = null): Room { $query = $this->db->getQueryBuilder(); $helper = new SelectHelper(); $helper->selectRoomsTable($query); @@ -841,6 +841,7 @@ public function getRoomByRemoteAccess( string $actorId, #[SensitiveParameter] string $remoteAccess, + #[SensitiveParameter] ?string $sessionId = null, ): Room { return $this->getRoomByAccessToken($token, $actorType, $actorId, $remoteAccess, $sessionId); @@ -861,6 +862,7 @@ public function getRoomByAccessToken( string $actorId, #[SensitiveParameter] string $accessToken, + #[SensitiveParameter] ?string $sessionId = null, ): Room { $query = $this->db->getQueryBuilder(); @@ -1065,7 +1067,7 @@ public function getRoomsByToken(array $tokens): array { * @return Room * @throws RoomNotFoundException */ - public function getRoomForSession(?string $userId, ?string $sessionId): Room { + public function getRoomForSession(?string $userId, #[SensitiveParameter] ?string $sessionId): Room { if ($sessionId === '' || $sessionId === '0') { throw new RoomNotFoundException(); } diff --git a/lib/Matrix/Client/Crypto/Backup.php b/lib/Matrix/Client/Crypto/Backup.php index 523fc738e99..bcb9d6fb47b 100644 --- a/lib/Matrix/Client/Crypto/Backup.php +++ b/lib/Matrix/Client/Crypto/Backup.php @@ -84,7 +84,7 @@ public static function decryptSecret(#[SensitiveParameter] string $key, string $ * @return array Content like a forwarded room key, without room and session id * @throws CryptoException */ - public static function decryptSession(#[SensitiveParameter] string $backupKey, array $sessionData): array { + public static function decryptSession(#[SensitiveParameter] string $backupKey, #[SensitiveParameter] array $sessionData): array { if (!is_string($sessionData['ephemeral'] ?? null) || !is_string($sessionData['ciphertext'] ?? null) || !is_string($sessionData['mac'] ?? null)) { throw new CryptoException('Incomplete backup session'); } diff --git a/lib/Model/AttendeeMapper.php b/lib/Model/AttendeeMapper.php index 113a4108138..8f6602e7040 100644 --- a/lib/Model/AttendeeMapper.php +++ b/lib/Model/AttendeeMapper.php @@ -72,7 +72,7 @@ public function getByAccessToken(#[SensitiveParameter] string $accessToken): arr * @throws DoesNotExistException * @throws MultipleObjectsReturnedException */ - public function getByRemoteIdAndToken(int $id, string $token): Attendee { + public function getByRemoteIdAndToken(int $id, #[SensitiveParameter] string $token): Attendee { $query = $this->db->getQueryBuilder(); $query->select('*') ->from($this->getTableName()) diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php index b50a935cce5..f52f166eb13 100644 --- a/lib/Model/SessionMapper.php +++ b/lib/Model/SessionMapper.php @@ -28,7 +28,7 @@ public function __construct(IDBConnection $db) { /** * @throws DoesNotExistException */ - public function findBySessionId(string $sessionId): Session { + public function findBySessionId(#[\SensitiveParameter] string $sessionId): Session { $query = $this->db->getQueryBuilder(); $query->select('*') ->from($this->getTableName()) @@ -115,7 +115,7 @@ public function deleteByIds(array $ids): int { /** * @param string[] $sessionIds */ - public function resetInCallByIds(array $sessionIds): void { + public function resetInCallByIds(#[\SensitiveParameter] array $sessionIds): void { $update = $this->db->getQueryBuilder(); $update->update($this->getTableName()) ->set('in_call', $update->createNamedParameter(Participant::FLAG_DISCONNECTED, IQueryBuilder::PARAM_INT)) @@ -123,7 +123,7 @@ public function resetInCallByIds(array $sessionIds): void { $update->executeStatement(); } - public function createSessionFromRow(array $row): Session { + public function createSessionFromRow(#[\SensitiveParameter] array $row): Session { return $this->mapRowToEntity([ 'id' => $row['s_id'], 'session_id' => $row['session_id'], diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 1b767321f85..c1132c20d0e 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -601,7 +601,7 @@ public function joinRoom(RoomService $roomService, Room $room, IUser $user, #[Se /** * @throws UnauthorizedException */ - public function joinRoomAsFederatedUser(Room $room, string $actorType, string $actorId, string $sessionId): Participant { + public function joinRoomAsFederatedUser(Room $room, string $actorType, string $actorId, #[SensitiveParameter] string $sessionId): Participant { $event = new BeforeFederatedUserJoinedRoomEvent($room, $actorId); $this->dispatcher->dispatchTyped($event); @@ -2402,7 +2402,7 @@ protected function generatePin(int $entropy = 7): string { * @return Participant * @throws ParticipantNotFoundException When the user is not a participant */ - public function getParticipant(Room $room, ?string $userId, $sessionId = null): Participant { + public function getParticipant(Room $room, ?string $userId, #[SensitiveParameter] $sessionId = null): Participant { if (!is_string($userId) || $userId === '') { throw new ParticipantNotFoundException('Not a user'); } @@ -2489,7 +2489,7 @@ public function getParticipantWithActiveSession(Room $room, string $userId): Par * @return Participant * @throws ParticipantNotFoundException When the user is not a participant */ - public function getParticipantBySession(Room $room, ?string $sessionId): Participant { + public function getParticipantBySession(Room $room, #[SensitiveParameter] ?string $sessionId): Participant { if (!is_string($sessionId) || $sessionId === '' || $sessionId === '0') { throw new ParticipantNotFoundException('Not a user'); } diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index 8e32d745bc3..9573a897c74 100644 --- a/lib/Service/SessionService.php +++ b/lib/Service/SessionService.php @@ -41,7 +41,7 @@ public function __construct( * @param string[] $sessionIds * @param int $lastPing */ - public function updateMultipleLastPings(array $sessionIds, int $lastPing): void { + public function updateMultipleLastPings(#[\SensitiveParameter] array $sessionIds, int $lastPing): void { $update = $this->connection->getQueryBuilder(); $update->update('talk_sessions') ->set('last_ping', $update->createNamedParameter($lastPing, IQueryBuilder::PARAM_INT)) @@ -88,7 +88,7 @@ public function getAllSessionsForAttendee(Attendee $attendee): array { * @return Session * @throws Exception */ - public function createSessionForAttendee(Attendee $attendee, string $forceSessionId = ''): Session { + public function createSessionForAttendee(Attendee $attendee, #[\SensitiveParameter] string $forceSessionId = ''): Session { $session = new Session(); $session->setAttendeeId($attendee->getId()); $session->setInCall(Participant::FLAG_DISCONNECTED); @@ -128,7 +128,7 @@ public function createSessionForAttendee(Attendee $attendee, string $forceSessio * If the resulting session id is longer than the column length it is * trimmed at the end as needed. */ - public function extendSessionIdWithCloudId(string $sessionId, string $invitedCloudId): string { + public function extendSessionIdWithCloudId(#[\SensitiveParameter] string $sessionId, string $invitedCloudId): string { // Session id column length is 512, while generated session ids are 255 // characters (+ 65 tabId if provided). $sessionId .= '#' . $invitedCloudId; @@ -140,7 +140,7 @@ public function extendSessionIdWithCloudId(string $sessionId, string $invitedClo * we add browser/client random generated tab ID to it, so leave the room can revoke the single * talk session afterwards. */ - public function extendSessionIdWithTabId(string $sessionId): string { + public function extendSessionIdWithTabId(#[\SensitiveParameter] string $sessionId): string { $tabId = $this->request->getHeader(TalkSession::HEADER_TAB_ID); if (preg_match(TalkSession::HEADER_TAB_ID_REGEX, $tabId)) { return $sessionId . TalkSession::TAB_ID_SEPARATOR . $tabId; diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index a5ed9fc2b2b..42bc38b8bbe 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -252,7 +252,7 @@ public function roomsDisinvited(Room $room, array $attendees): void { * @param string[] $sessionIds * @throws \Exception */ - public function roomSessionsRemoved(Room $room, array $sessionIds): void { + public function roomSessionsRemoved(Room $room, #[\SensitiveParameter] array $sessionIds): void { // TODO Remove once a new HPB is required $supportsChangedUsers = $this->appConfig->getAppValueBool(Manager::HAS_FEATURE_CHANGED_USERS); @@ -351,7 +351,7 @@ public function roomDeleted(Room $room): void { * @param string[] $sessionIds * @throws \Exception */ - public function switchToRoom(Room $room, string $switchToRoomToken, array $sessionIds): void { + public function switchToRoom(Room $room, string $switchToRoomToken, #[\SensitiveParameter] array $sessionIds): void { $start = microtime(true); $this->backendRequest($room, [ 'type' => 'switchto', @@ -377,7 +377,7 @@ public function switchToRoom(Room $room, string $switchToRoomToken, array $sessi * @param string[] $sessionIds * @throws \Exception */ - public function participantsModified(Room $room, array $sessionIds): void { + public function participantsModified(Room $room, #[\SensitiveParameter] array $sessionIds): void { // TODO Remove once a new HPB is required $supportsChangedUsers = $this->appConfig->getAppValueBool(Manager::HAS_FEATURE_CHANGED_USERS); @@ -471,7 +471,7 @@ public function participantsModified(Room $room, array $sessionIds): void { * @param bool $changeAll * @throws \Exception */ - public function roomInCallChanged(Room $room, int $flags, array $sessionIds, bool $changeAll = false): void { + public function roomInCallChanged(Room $room, int $flags, #[\SensitiveParameter] array $sessionIds, bool $changeAll = false): void { // TODO Remove once a new HPB is required $supportsChangedUsers = $this->appConfig->getAppValueBool(Manager::HAS_FEATURE_CHANGED_USERS); diff --git a/lib/Signaling/Messages.php b/lib/Signaling/Messages.php index 2eae82c44b8..5b945470de2 100644 --- a/lib/Signaling/Messages.php +++ b/lib/Signaling/Messages.php @@ -29,7 +29,7 @@ public function __construct( /** * @param string[] $sessionIds */ - public function deleteMessages(array $sessionIds): void { + public function deleteMessages(#[\SensitiveParameter] array $sessionIds): void { $delete = $this->db->getQueryBuilder(); $delete->delete('talk_internalsignaling') ->where($delete->expr()->in('recipient', $delete->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY))) @@ -45,7 +45,7 @@ public function deleteMessages(array $sessionIds): void { * @param string $recipientSessionId * @param string $message */ - public function addMessage(string $senderSessionId, string $recipientSessionId, string $message): void { + public function addMessage(#[\SensitiveParameter] string $senderSessionId, #[\SensitiveParameter] string $recipientSessionId, string $message): void { $insert = $this->db->getQueryBuilder(); $insert->insert('talk_internalsignaling') ->values( @@ -99,7 +99,7 @@ public function addMessageForAllParticipants(Room $room, string $message): void * @param string $sessionId * @return list */ - public function getAndDeleteMessages(string $sessionId): array { + public function getAndDeleteMessages(#[\SensitiveParameter] string $sessionId): array { $messages = []; $time = $this->timeFactory->getTime() - 1; diff --git a/lib/TalkSession.php b/lib/TalkSession.php index 6eb21eafbf4..e7d97ce3da9 100644 --- a/lib/TalkSession.php +++ b/lib/TalkSession.php @@ -43,7 +43,7 @@ public function getSessionForRoom(string $token): ?string { return $this->getValue('spreed-session', $token); } - public function setSessionForRoom(string $token, string $sessionId): void { + public function setSessionForRoom(string $token, #[SensitiveParameter] string $sessionId): void { $this->setValue('spreed-session', $token, $sessionId); } @@ -79,7 +79,7 @@ public function getFileShareTokenForRoom(string $roomToken): ?string { return $this->getValue('spreed-file-share-token', $roomToken); } - public function setFileShareTokenForRoom(string $roomToken, string $shareToken): void { + public function setFileShareTokenForRoom(string $roomToken, #[SensitiveParameter] string $shareToken): void { $this->setValue('spreed-file-share-token', $roomToken, $shareToken); }