You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HttpClient: a route's x-method_name can overwrite the client's own attributes #23
Found by the adversarial review of #22, and also present before it.
HttpClient.register_method does setattr(self, func.__name__, ...) with a name taken from the spec (x-method_name). A spec, possibly fetched from a server, can therefore name a route openapi_spec, binary_loads, session, handle_request or ensure_login and replace that attribute of the client. For example, a route named openapi_spec makes api_pkg_files crash with 'function' object has no attribute 'get'.
Suggested fix: refuse, or prefix, route names that collide with HttpClient attributes or start with _. Better still, keep the routes in a separate namespace (e.g. client.routes), with attribute access kept as sugar for names that do not collide.
Activity
Routes live in client.routes; a route name cannot replace a client at…