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
6 changes: 3 additions & 3 deletions lib/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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']);
Expand Down Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/FilesIntegrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of the URL so logged anyway

if (!$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES)
|| !$this->appConfig->getAppValueBool(Config::CONVERSATIONS_FILES_PUBLIC_SHARES)) {
return new DataResponse(null, Http::STATUS_BAD_REQUEST);
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/PublicShareAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/RoomController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down Expand Up @@ -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']);
Expand Down
1 change: 1 addition & 0 deletions lib/Events/AAttendeeRemovedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public function __construct(
Room $room,
protected Attendee $attendee,
protected string $reason,
#[\SensitiveParameter]
protected array $sessions,
) {
parent::__construct($room);
Expand Down
2 changes: 1 addition & 1 deletion lib/Events/BeforeSignalingResponseSentEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Events/BeforeTurnServersGetEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BeforeTurnServersGetEvent extends Event {
* @param list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}> $servers
*/
public function __construct(
protected array $servers,
#[\SensitiveParameter] protected array $servers,
) {
parent::__construct();
}
Expand All @@ -30,7 +30,7 @@ public function getServers(): array {
/**
* @param list<array{schemes?: string, server: string, protocols: string, username?: string, password?: string, secret?: string}> $servers
*/
public function setServers(array $servers): void {
public function setServers(#[\SensitiveParameter] array $servers): void {
$this->servers = $servers;
}
}
1 change: 1 addition & 0 deletions lib/Events/CallEndedForEveryoneEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct(
?Participant $actor,
\DateTime $oldActiveSince,
/** @var string[] */
#[\SensitiveParameter]
private readonly array $sessionIds = [],
/** @var string[] */
private readonly array $userIds = [],
Expand Down
2 changes: 1 addition & 1 deletion lib/Files/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions lib/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -861,6 +862,7 @@ public function getRoomByAccessToken(
string $actorId,
#[SensitiveParameter]
string $accessToken,
#[SensitiveParameter]
?string $sessionId = null,
): Room {
$query = $this->db->getQueryBuilder();
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Matrix/Client/Crypto/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function decryptSecret(#[SensitiveParameter] string $key, string $
* @return array<string, mixed> 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');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Model/AttendeeMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions lib/Model/SessionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -115,15 +115,15 @@ 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))
->where($update->expr()->in('session_id', $update->createNamedParameter($sessionIds, IQueryBuilder::PARAM_STR_ARRAY)));
$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'],
Expand Down
6 changes: 3 additions & 3 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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');
}
Expand Down Expand Up @@ -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');
}
Expand Down
8 changes: 4 additions & 4 deletions lib/Service/SessionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions lib/Signaling/BackendNotifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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',
Expand All @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions lib/Signaling/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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(
Expand Down Expand Up @@ -99,7 +99,7 @@ public function addMessageForAllParticipants(Room $room, string $message): void
* @param string $sessionId
* @return list<array{type: string, data: string}>
*/
public function getAndDeleteMessages(string $sessionId): array {
public function getAndDeleteMessages(#[\SensitiveParameter] string $sessionId): array {
$messages = [];
$time = $this->timeFactory->getTime() - 1;

Expand Down
4 changes: 2 additions & 2 deletions lib/TalkSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
Loading