From: Michael Tremer Date: Sun, 23 Oct 2022 20:12:02 +0000 (+0000) Subject: hub: Fix builders connecting to the builder handler X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57de8eb62c2539bf0393c24edeb996461aa990b7;p=pbs.git hub: Fix builders connecting to the builder handler Signed-off-by: Michael Tremer --- diff --git a/src/hub/jobs.py b/src/hub/jobs.py index 9aaa924a..1d682435 100644 --- a/src/hub/jobs.py +++ b/src/hub/jobs.py @@ -31,16 +31,8 @@ class BuilderHandler(BackendMixin, tornado.websocket.WebSocketHandler): We can pass information about this build around in real time. """ - def get_current_user(self): - name, password = self.get_basic_auth_credentials() - if name is None: - return - - return self.backend.builders.auth(name, password) - - @property - def builder(self): - return self.current_user + # Don't allow users to authenticate + allow_users = False @tornado.web.authenticated def open(self, job_id): @@ -49,11 +41,11 @@ class BuilderHandler(BackendMixin, tornado.websocket.WebSocketHandler): raise tornado.web.HTTPError(404, "Could not find job %s" % job_id) # Check if the builder matches - if not self.builder == self.job.builder: + if not self.current_user == self.job.builder: raise tornado.web.HTTPError(403, "Job %s belongs to %s, not %s" % \ - (self.job, self.job.builder, self.builder)) + (self.job, self.job.builder, self.current_user)) - logging.debug("Connection opened for %s by %s" % (self.job, self.builder)) + logging.debug("Connection opened for %s by %s" % (self.job, self.current_user)) async def on_message(self, message): # Decode JSON message