text
stringlengths
79
3.72M
<vulnerable_code> ump_config.setdefault("module", DEFAULT_USER_MAPPING_PROVIDER) ump_config.setdefault("config", {}) (user_mapping_provider_class, user_mapping_provider_config,) = load_module( ump_config, config_path + ("user_mapping_provider",) ) # Ensure loaded user mapping module has def...
<vulnerable_code> def parse_thumbnail_requirements(thumbnail_sizes): """ Takes a list of dictionaries with "width", "height", and "method" keys and creates a map from image media types to the thumbnail size, thumbnailing method, and thumbnail media type to precalculate <commit_title>[PATCH 01/14] Fix some ...
<vulnerable_code> hex_network = hex(network.first)[2:] hex_network = ("0" * (8 - len(hex_network))) + hex_network return IPNetwork( "2002:%s:%s::/%d" % (hex_network[:4], hex_network[4:], 16 + network.prefixlen,) ) # Whether to require sharing a room with a user to retrieve their ...
<vulnerable_code> class SSOConfig(Config): """SSO Configuration """ section = "sso" <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class SSOConfig(Config): """SSO Configuration""" section = "sso"
<vulnerable_code> @attr.s class InstanceLocationConfig: """The host and port to talk to an instance via HTTP replication. """ host = attr.ib(type=str) port = attr.ib(type=int) ) typing = attr.ib(default="master", type=str) to_device = attr.ib( default=["master"], type=List[str], con...
<vulnerable_code> do_sig_check: bool = True, do_size_check: bool = True, ) -> None: """ Checks if this event is correctly authed. Args: room_version_obj: the version of the room def check_redaction( room_version_obj: RoomVersion, event: EventBase, auth_events: StateMap[EventBase], ) -> boo...
<vulnerable_code> return self._state_key is not None async def build( self, prev_event_ids: List[str], auth_event_ids: Optional[List[str]], ) -> EventBase: """Transform into a fully signed and hashed event <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> ...
<vulnerable_code> def _decode_state_dict(input): """Decodes a state dict encoded using `_encode_state_dict` above """ if input is None: return None <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> def _decode_state_dict(input): """Decodes a state dict encoded using ...
<vulnerable_code> if module is not None: self.third_party_rules = module( config=config, module_api=hs.get_module_api(), ) async def check_event_allowed(<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> if module is not None: ...
<vulnerable_code> def prune_event(event: EventBase) -> EventBase: """ Returns a pruned version of the given event, which removes all keys we don't know about or think could potentially be dodgy. This is used when we "redact" an event. We want to remove all fields that<commit_title>[PATCH 01/14] Fix some t...
<vulnerable_code> return resp[1] async def send_invite( self, destination: str, room_id: str, event_id: str, pdu: EventBase, ) -> EventBase: room_version = await self.store.get_room_version(room_id) <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> retur...
<vulnerable_code>) pdu_process_time = Histogram( "synapse_federation_server_pdu_process_time", "Time taken to process an event", ) async def _handle_incoming_transaction( self, origin: str, transaction: Transaction, request_time: int ) -> Tuple[int, Dict[str, Any]]: """ Process an incomin...
<vulnerable_code> class TransactionActions: """ Defines persistence actions that relate to handling Transactions. """ def __init__(self, datastore): self.store = datastore async def set_response( self, origin: str, transaction: Transaction, code: int, response: JsonDict ) -> None: ...
<vulnerable_code> class EduRow(BaseFederationRow, namedtuple("EduRow", ("edu",))): # Edu """Streams EDUs that don't have keys. See KeyedEduRow """ TypeId = "e" # them into the appropriate collection and then send them off. buff = ParsedFederationStreamData( presence=[], presence_destina...
<vulnerable_code> # to allow us to perform catch-up later on if the remote is unreachable # for a while. await self.store.store_destination_rooms_entries( destinations, pdu.room_id, pdu.internal_metadata.stream_ordering, ) for destination in destinations: self...
<vulnerable_code> # processing. We have a guard in `attempt_new_transaction` that # ensure we don't start sending stuff. logger.error( "Create a per destination queue for %s on wrong worker", destination, ) self._should_send_on_this_instance = F...
<vulnerable_code> @measure_func("_send_new_transaction") async def send_new_transaction( self, destination: str, pdus: List[EventBase], edus: List[Edu], ) -> bool: """ Args:<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> @measure_func("_send_new_trans...
<vulnerable_code> @log_function def get_room_state_ids(self, destination, room_id, event_id): """ Requests all state for a given room from the given server at the given event. Returns the state's event_id's Args: @log_function def get_event(self, destination, event_id, timeout=...
<vulnerable_code> continue server.register_paths( method, (pattern,), self._wrap(code), self.__class__.__name__, ) # This is when someone is trying to send us a bunch of data. async def on_PUT(self, origin, content, query, transaction_id): """ C...
<vulnerable_code> @attr.s(slots=True) class Edu(JsonEncodedObject): """ An Edu represents a piece of data sent from one homeserver to another. In comparison to Pdus, Edus are not persisted for a long time on disk, are not meaningful beyond a given pair of homeservers, and don't have an class Transaction(...
<vulnerable_code> class GroupAttestationSigning: """Creates and verifies group attestations. """ def __init__(self, hs): self.keyring = hs.get_keyring() class GroupAttestionRenewer: """Responsible for sending and receiving attestation updates. """ def __init__(self, hs): sel...
<vulnerable_code> } async def get_group_categories(self, group_id, requester_user_id): """Get all categories in a group (as seen by user) """ await self.check_group_is_ours(group_id, requester_user_id, and_exists=True) categories = await self.store.get_group_categories(group...
<vulnerable_code> class ExfiltrationWriter(metaclass=abc.ABCMeta): """Interface used to specify how to write exported data. """ @abc.abstractmethod def write_events(self, room_id: str, events: List[EventBase]) -> None: """Write a batch of events for a room. """ raise NotImpleme...
<vulnerable_code> if not interested: continue presence_events, _ = await presence_source.get_new_events( user=user, service=service, from_key=from_key, ) time_now = self.clock.time_msec() events.extend(<commit_title>[PATCH 01/14]...
<vulnerable_code> # Ensure the identifier has a type if "type" not in identifier: raise SynapseError( 400, "'identifier' dict has no key 'type'", errcode=Codes.MISSING_PARAM, ) return identifier try: result, params, session_id = await self.check_ui_auth( ...
<vulnerable_code> class CasError(Exception): """Used to catch errors when validating the CAS ticket. """ def __init__(self, error, error_description=None): self.error = error Returns: The URL to use as a "service" parameter. """ return "%s?%s" % (self._cas_servi...
<vulnerable_code> run_as_background_process("user_parter_loop", self._user_parter_loop) async def _user_parter_loop(self) -> None: """Loop that parts deactivated users from rooms """ self._user_parter_running = True logger.info("Starting user parter") try: ...
<vulnerable_code> @trace async def get_device(self, user_id: str, device_id: str) -> JsonDict: """ Retrieve the given device Args: user_id: The user to get the device from @trace async def delete_device(self, user_id: str, device_id: str) -> None: """ Delete the giv...
<vulnerable_code> ) else: hs.get_federation_registry().register_instances_for_edu( "m.direct_to_device", hs.config.worker.writers.to_device, ) # The handler to call when we think a user's device list might be out of hs.get_device_handle...
<vulnerable_code> self._is_master = hs.config.worker_app is None if not self._is_master: self._user_device_resync_client = ReplicationUserDevicesResyncRestServlet.make_client( hs ) else: # Only register this edu handler on master as it requires...
<vulnerable_code> room_id: Optional[str] = None, is_guest: bool = False, ) -> JsonDict: """Fetches the events stream for a given user. """ if room_id: blocked = await self.store.is_room_blocked(room_id)<commit_title>[PATCH 01/14] Fix some typos.<commit_description...
<vulnerable_code> class FederationHandler(BaseHandler): """Handles events that originated from federation. Responsible for: a) handling received Pdus before handing them on as Events to the rest of the homeserver (including auth and state conflict resolutions) b) converting events th...
<vulnerable_code> async def get_users_in_group( self, group_id: str, requester_user_id: str ) -> JsonDict: """Get users in a group """ if self.is_mine_id(group_id): return await self.groups_server_handler.get_users_in_group( group_id, requester_user_id ...
<vulnerable_code> ) def ratelimit_request_token_requests( self, request: SynapseRequest, medium: str, address: str, ): """Used to ratelimit requests to `/requestToken` by IP and address. <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> ) def rateli...
<vulnerable_code> joined_rooms = [r.room_id for r in room_list if r.membership == Membership.JOIN] receipt = await self.store.get_linearized_receipts_for_rooms( joined_rooms, to_key=int(now_token.receipt_key), ) tags_by_room = await self.store.get_tags_for_user(user_id) ...
<vulnerable_code> class MessageHandler: """Contains some read only APIs to get state about a room """ def __init__(self, hs): self.auth = hs.get_auth() ) async def get_room_data( self, user_id: str, room_id: str, event_type: str, state_key: str, ) -> dict: """ ...
<vulnerable_code> class OidcHandler: """Handles requests related to the OpenID Connect login flow. """ def __init__(self, hs: "HomeServer"): self._sso_handler = hs.get_sso_handler() class OidcError(Exception): """Used to catch errors when calling the token_endpoint """ def __init__(...
<vulnerable_code> stream_ordering = await self.store.find_first_stream_ordering_after_ts(ts) r = await self.store.get_room_event_before_stream_ordering( room_id, stream_ordering, ) if not r: logger.warning( # the background so t...
<vulnerable_code> self.external_process_last_updated_ms.pop(process_id, None) async def current_state_for_user(self, user_id): """Get the current presence state for a user. """ res = await self.current_state_for_users([user_id]) return res[user_id] self.federatio...
<vulnerable_code> # This must be done by the target user himself. if by_admin: requester = create_requester( target_user, authenticated_entity=requester.authenticated_entity, ) await self.store.set_profile_displayname(<commit_title>[PATCH 01/14] Fix some t...
<vulnerable_code> ) else: hs.get_federation_registry().register_instances_for_edu( "m.receipt", hs.config.worker.writers.receipts, ) self.clock = self.hs.get_clock() self.state = hs.get_state_handler() async def _received_remote_receipt(se...
<vulnerable_code> self._register_device_client = RegisterDeviceReplicationServlet.make_client( hs ) self._post_registration_client = ReplicationPostRegisterActionsServlet.make_client( hs ) else: self.device_handler = hs.g...
<vulnerable_code> if r is None: raise NotFoundError("Unknown room id %s" % (old_room_id,)) new_room_id = await self._generate_room_id( creator_id=user_id, is_public=r["is_public"], room_version=new_version, ) logger.info("Creating new room %s to replace %s", new_r...
<vulnerable_code> # do it up front for efficiency.) if txn_id and requester.access_token_id: existing_event_id = await self.store.get_event_id_from_transaction_id( room_id, requester.user.to_string(), requester.access_token_id, txn_id, ) if existing_eve...
<vulnerable_code> user: UserID, content: dict, ) -> Tuple[str, int]: """Implements RoomMemberHandler._remote_join """ if len(remote_room_hosts) == 0: raise SynapseError(404, "No known servers") return ret["event_id"], ret["stream_id"] async def _user_...
<vulnerable_code> now = self.clock.time_msec() self._outstanding_requests_dict[reqid] = Saml2SessionData( creation_time=now, ui_auth_session_id=ui_auth_session_id, ) for key, value in info["headers"]: mxid_source = saml_response.ava[self._mxid_source_attribute][0...
<vulnerable_code> # Check if we already have a mapping for this user. previously_registered_user_id = await self._store.get_user_by_external_id( auth_provider_id, remote_user_id, ) # A match was found, return the user ID. with await self._mapping_lock.queue(auth_prov...
<vulnerable_code> self.clock.call_later(0, self.notify_new_event) def notify_new_event(self) -> None: """Called when there may be more deltas to process """ if not self.stats_enabled or self._is_processing: return <commit_title>[PATCH 01/14] Fix some typos.<commit_des...
<vulnerable_code> since_token: Optional[StreamToken] = None, full_state: bool = False, ) -> SyncResult: """Get the sync for client needed to match what the server has now. """ return await self.generate_sync_result(sync_config, since_token, full_state) async def push_rule...
<vulnerable_code> if hs.config.worker.writers.typing != hs.get_instance_name(): hs.get_federation_registry().register_instance_for_edu( "m.typing", hs.config.worker.writers.typing, ) # map room IDs to serial numbers self.clock.looping_call(self._handle_ti...
<vulnerable_code> return results def notify_new_event(self) -> None: """Called when there may be more deltas to process """ if not self.update_user_directory: return ) async def handle_user_deactivated(self, user_id: str) -> None: """Called when ...
<vulnerable_code> def get_request_user_agent(request: IRequest, default: str = "") -> str: """Return the last User-Agent header, or the given default. """ # There could be raw utf-8 bytes in the User-Agent header. # N.B. if you don't do this, the logger explodes cryptically<commit_title>[PATCH 01/14] ...
<vulnerable_code> body_producer = None if data is not None: body_producer = QuieterFileBodyProducer( BytesIO(data), cooperator=self._cooperator, ) request_deferred = treq.request( # we use our...
<vulnerable_code> @implementer(IAgentEndpointFactory) class MatrixHostnameEndpointFactory: """Factory for MatrixHostnameEndpoint for parsing to an Agent. """ def __init__( self, self._srv_resolver = srv_resolver def connect(self, protocol_factory: IProtocolFactory) -> defer.Deferred: ...
<vulnerable_code> class WellKnownResolver: """Handles well-known lookups for matrix servers. """ def __init__( self,<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class WellKnownResolver: """Handles well-known lookups for matrix servers.""" def __init__( ...
<vulnerable_code> # Use a BlacklistingAgentWrapper to prevent circumventing the IP # blacklist via IP literals in server names self.agent = BlacklistingAgentWrapper( self.agent, ip_blacklist=hs.config.federation_ip_range_blacklist, ) self.clock = hs.get_clock() ...
<vulnerable_code> self.update_metrics() def update_metrics(self): """Updates the in flight metrics with values from this request. """ new_stats = self.start_context.get_resource_usage() diff = new_stats - self._request_stats<commit_title>[PATCH 01/14] Fix some typos.<commit_...
<vulnerable_code> def return_json_error(f: failure.Failure, request: SynapseRequest) -> None: """Sends a JSON error response to clients. """ if f.check(SynapseError): error_code = f.value.code pass else: respond_with_json( request, error_code, error_dict, se...
<vulnerable_code> class RestServlet: """ A Synapse REST Servlet. An implementing class can either provide its own custom 'register' method, or use the automatic pattern handling provided by the base class.<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class RestServlet: ...
<vulnerable_code> ) def _finished_processing(self): """Log the completion of this request and update the metrics """ assert self.logcontext is not None usage = self.logcontext.get_resource_usage() # authenticated (e.g. and admin is puppetting a user) then we log ...
<vulnerable_code> # Make a new producer and start it. self._producer = LogProducer( buffer=self._buffer, transport=result.transport, format=self.format, ) result.transport.registerProducer(self._producer, True) self._producer.resumeProducing()<...
<vulnerable_code> ) # Either use the default formatter or the tersejson one. if logging_type in (DrainType.CONSOLE_JSON, DrainType.FILE_JSON,): formatter = "json" # type: Optional[str] elif logging_type in ( DrainType.CONSOLE_JSON_TERSE, ) def s...
<vulnerable_code> if self.previous_context != old_context: logcontext_error( "Expected previous context %r, found %r" % (self.previous_context, old_context,) ) return self class PreserveLoggingContext: """Context manager which replaces the logg...
<vulnerable_code> @attr.s(slots=True, frozen=True) class _WrappedRustReporter: """Wrap the reporter to ensure `report_span` never throws. """ _reporter = attr.ib(type=Reporter, default=attr.Factory(Reporter)) def init_tracer(hs: "HomeServer"): """Set the whitelists and initialise...
<vulnerable_code> def log_function(f): """ Function decorator that logs every call to that function. """ func_name = f.__name__ @wraps(f)<commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> def log_function(f): """Function decorator that logs every call to that function.""...
<vulnerable_code> self._registrations.setdefault(key, set()).add(callback) def unregister(self, key, callback): """Registers that we've exited a block with labels `key`. """ with self._lock: self._registrations.setdefault(key, set()).discard(callback) # T...
<vulnerable_code> @classmethod def factory(cls, registry): """Returns a dynamic MetricsHandler class tied to the passed registry. """ # This implementation relies on MetricsHandler.registry # (defined above and defaulted to REGISTRY).<commit_title>[PATCH 01/14] Fix som...
<vulnerable_code> return await maybe_awaitable(func(*args, **kwargs)) except Exception: logger.exception( "Background process '%s' threw an exception", desc, ) finally: _background_process_in_flight_count.labe...
<vulnerable_code> redirect them directly if whitelisted). """ self._auth_handler._complete_sso_login( registered_user_id, request, client_redirect_url, ) async def complete_sso_login_async( event, _, ) = await self._hs.get_event_cre...
<vulnerable_code> class _NotificationListener: """ This represents a single client connection to the events stream. The events stream handler will have yielded to the deferred, so to notify the handler it is sufficient to resolve the deferred. """ self.notify_deferred = ObservableDeferred(d...
<vulnerable_code> @lru_cache() def _get_rules_for_room(self, room_id: str) -> "RulesForRoom": """Get the current RulesForRoom object for the given room id """ # It's important that RulesForRoom gets added to self._get_rules_for_room.cache # before any lookup methods get called on...
<vulnerable_code> self._is_processing = True def _resume_processing(self) -> None: """Used by tests to resume processing of events after pausing. """ assert self._is_processing self._is_processing = False self._start_processing() being run. """ ...
<vulnerable_code> Never call this directly: use _process which will only allow this to run once per pusher. """ unprocessed = await self.store.get_unread_push_actions_for_user_in_range_for_http( self.user_id, self.last_stream_ordering, self.max_stream_ordering ) ...
<vulnerable_code> self.pushers = {} # type: Dict[str, Dict[str, Pusher]] def start(self) -> None: """Starts the pushers off in a background process. """ if not self._should_start_pushers: logger.info("Not starting pushers because they are disabled in the config") ...
<vulnerable_code> pattern = re.compile("^/_synapse/replication/%s/%s$" % (self.NAME, args)) http_server.register_paths( method, [pattern], self._check_auth_and_handle, self.__class__.__name__, ) def _check_auth_and_handle(self, request, **kwargs):<commit_title>[PATCH 01/14] Fix ...
<vulnerable_code> return {} async def _handle_request(self, request, user_id, room_id, tag): max_stream_id = await self.handler.remove_tag_from_room(user_id, room_id, tag,) return 200, {"max_stream_id": max_stream_id} <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_cod...
<vulnerable_code> # hopefully we're now on the master, so this won't recurse! event_id, stream_id = await self.member_handler.remote_reject_invite( invite_event_id, txn_id, requester, event_content, ) return 200, {"event_id": event_id, "stream_id": stream_id}<commit_title>[P...
<vulnerable_code> class ReplicationRegisterServlet(ReplicationEndpoint): """Register a new user """ NAME = "register_user" PATH_ARGS = ("user_id",) class ReplicationPostRegisterActionsServlet(ReplicationEndpoint): """Run any post registration actions """ NAME = "post_register" PATH_...
<vulnerable_code> class PingCommand(_SimpleCommand): """Sent by either side as a keep alive. The data is arbitrary (often timestamp) """ NAME = "PING" <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class PingCommand(_SimpleCommand): """Sent by either side as a keep alive...
<vulnerable_code> return self._redis_connection is not None async def set(self, cache_name: str, key: str, value: Any, expiry_ms: int) -> None: """Add the key/value to the named cache, with the expiry time given. """ if self._redis_connection is None: return ret...
<vulnerable_code> hs, outbound_redis_connection ) hs.get_reactor().connectTCP( hs.config.redis.redis_host, hs.config.redis.redis_port, self._factory, ) else: client_name = hs.get_instance_name() hs.get_reactor().connectTC...
<vulnerable_code> self.send_error("ping timeout") def lineReceived(self, line: bytes): """Called when we've received a line """ with PreserveLoggingContext(self._logging_context): self._parse_and_dispatch_line(line) self.on_connection_closed() def se...
<vulnerable_code> self.synapse_handler.send_positions_to_connection(self) def messageReceived(self, pattern: str, channel: str, message: str): """Received a message from redis. """ with PreserveLoggingContext(self._logging_context): self._parse_and_dispatch_message(messag...
<vulnerable_code> class ReplicationStreamProtocolFactory(Factory): """Factory for new replication connections. """ def __init__(self, hs): self.command_handler = hs.get_tcp_replication() raise logger.debug( "Sending %...
<vulnerable_code> return [], upto_token, False updates, upto_token, limited = await self.update_function( instance_name, from_token, upto_token, _STREAM_UPDATE_TARGET_ROW_COUNT, ) return updates, upto_token, limited class PushRulesStream(Stream): """A user has chan...
<vulnerable_code> class EventsStream(Stream): """We received a new event, or an event went from being an outlier to not """ NAME = "events" <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class EventsStream(Stream): """We received a new event, or an event went from being ...
<vulnerable_code> class DeleteGroupAdminRestServlet(RestServlet): """Allows deleting of local groups """ PATTERNS = admin_patterns("/delete_group/(?P<group_id>[^/]*)") <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> class DeleteGroupAdminRestServlet(RestServlet): """Allow...
<vulnerable_code> class ProtectMediaByID(RestServlet): """Protect local media from being quarantined. """ PATTERNS = admin_patterns("/media/protect/(?P<media_id>[^/]+)") class ListMediaInRoom(RestServlet): """Lists all of the media in a given room. """ PATTERNS = admin_patterns("/room/(?P<...
<vulnerable_code> if not admin_user_id: raise SynapseError( 400, "No local admin user in room", ) pl_content = power_levels.content admin_user_id = create_event.sender if not self.is_mine_id(admin_user_id): ...
<vulnerable_code> } Returns: 200 OK with empty object if success otherwise an error. """ PATTERNS = admin_patterns("/reset_password/(?P<target_user_id>[^/]*)") <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> } Returns: ...
<vulnerable_code> except jwt.PyJWTError as e: # A JWT error occurred, return some info back to the client. raise LoginError( 403, "JWT validation failed: %s" % (str(e),), errcode=Codes.FORBIDDEN, ) user = payload.get("sub", None) request, "...
<vulnerable_code> new_name = content["displayname"] except Exception: raise SynapseError( code=400, msg="Unable to parse name", errcode=Codes.BAD_JSON, ) await self.profile_handler.set_displayname(user, requester, new_name, is_admin)<commit_title>[PATC...
<vulnerable_code> self.notifier.on_new_replication_data() respond_with_html_bytes( request, 200, PushersRemoveRestServlet.SUCCESS_HTML, ) return None <commit_title>[PATCH 01/14] Fix some typos.<commit_description><fixed_code> self.notifier.on_new_replication_data() ...
<vulnerable_code> parse_and_validate_server_name(server) except ValueError: raise SynapseError( 400, "Invalid server name: %s" % (server,), Codes.INVALID_PARAM, ) try: parse_and_validate_server_name(server) ...
<vulnerable_code> requester = await self.auth.get_user_by_req(request) try: params, session_id = await self.auth_handler.validate_user_via_ui_auth( requester, request, body, "modify your account password", ) except InteractiveAuthInc...
<vulnerable_code> assert_params_in_dict(body, ["devices"]) await self.auth_handler.validate_user_via_ui_auth( requester, request, body, "remove device(s) from your account", ) await self.device_handler.delete_devices( raise await self.auth_handler.va...
<vulnerable_code> class GroupServlet(RestServlet): """Get the group profile """ PATTERNS = client_patterns("/groups/(?P<group_id>[^/]*)/profile$") class GroupSummaryServlet(RestServlet): """Get the full group summary """ PATTERNS = client_patterns("/groups/(?P<group_id>[^/]*)/summary$") ...
<vulnerable_code> body = parse_json_object_from_request(request) await self.auth_handler.validate_user_via_ui_auth( requester, request, body, "add a device signing key to your account", ) result = await self.e2e_keys_handler.upload_signing_keys_for_user(user_id, body)<commit...
<vulnerable_code> # not this will raise a user-interactive auth error. try: auth_result, params, session_id = await self.auth_handler.check_ui_auth( self._registration_flows, request, body, "register a new account", ) except InteractiveAuthIncompleteError a...
<vulnerable_code> requester = await self.auth.get_user_by_req(request, allow_guest=True) await self.auth.check_user_in_room_or_world_readable( room_id, requester.user.to_string(), allow_departed_users=True, ) # This checks that a) the event exists and b) the user is allowed ...