Spaces:
Running
Running
Challenge build: only kernel-task endpoints (no browser, store, RSI, backdoor, GPU, in-weights)
Browse files
server.py
CHANGED
|
@@ -12,8 +12,8 @@ HF_AUTH2 = os.environ.get("BACKEND2_HF_TOKEN", "") or HF_AUTH
|
|
| 12 |
BK_TOKEN = os.environ.get("BACKEND_TOKEN", "")
|
| 13 |
RATE = int(os.environ.get("RATE_PER_10MIN", "20"))
|
| 14 |
TIMEOUT = float(os.environ.get("BACKEND_TIMEOUT", "300"))
|
| 15 |
-
GET_OK = {"
|
| 16 |
-
POST_OK = {"chat", "scenario", "kill", "resume", "tamper", "reset", "
|
| 17 |
STATIC = {"challenge.html", "warm.js", "tour.js", "index.html", "app.js", "ag.js", "store.js", "common.js", "display.js", "terminal.js", "mines.js", "browser.js", "settings.js", "live_apps.js", "game.js", "rsi.js", "gpulab.js", "ztc.js", "backdoor.js", "backdoor.css", "backdoor_metrics.json", "downloads/vdrpack.py", "demo/poisoned-page", "samples/weather-plus.vdr", "samples/weather-plus-tampered.vdr", "i18n.js", "demo_data.js", "styles.css", "ag_replay.json"}
|
| 18 |
HITS = {}
|
| 19 |
BACKEND2_SPACE = os.environ.get("BACKEND2_SPACE", "SeaWolf-AI/vk-ag-graft")
|
|
@@ -122,6 +122,8 @@ class H(SimpleHTTPRequestHandler):
|
|
| 122 |
return self._json(200, {"user": RC.user_from(self.headers)})
|
| 123 |
if p == "/api/rt/leaderboard":
|
| 124 |
return self._json(200, RC.board_info())
|
|
|
|
|
|
|
| 125 |
if p.startswith("/api/ag/") or p.startswith("/api/agx/"):
|
| 126 |
x = p.startswith("/api/agx/")
|
| 127 |
name = p[9:] if x else p[8:]
|
|
@@ -154,8 +156,8 @@ class H(SimpleHTTPRequestHandler):
|
|
| 154 |
return self._json(code, out)
|
| 155 |
if (p.startswith("/api/ag/") or p.startswith("/api/agx/")) and p != "/api/ag/session/start" and not RC.user_from(self.headers):
|
| 156 |
return self._json(401, {"error": "sign in with Hugging Face to take part"})
|
| 157 |
-
x =
|
| 158 |
-
name = p[
|
| 159 |
if name not in POST_OK:
|
| 160 |
return self._json(404, {"error": "not found"})
|
| 161 |
ip = (self.headers.get("X-Forwarded-For") or self.client_address[0]).split(",")[0].strip()
|
|
|
|
| 12 |
BK_TOKEN = os.environ.get("BACKEND_TOKEN", "")
|
| 13 |
RATE = int(os.environ.get("RATE_PER_10MIN", "20"))
|
| 14 |
TIMEOUT = float(os.environ.get("BACKEND_TIMEOUT", "300"))
|
| 15 |
+
GET_OK = {"health", "status", "audit"} # challenge build: attack surface limited to the kernel tasks
|
| 16 |
+
POST_OK = {"chat", "scenario", "kill", "resume", "tamper", "reset", "gate/decide", "vmask", "settings/locked", "session/start"}
|
| 17 |
STATIC = {"challenge.html", "warm.js", "tour.js", "index.html", "app.js", "ag.js", "store.js", "common.js", "display.js", "terminal.js", "mines.js", "browser.js", "settings.js", "live_apps.js", "game.js", "rsi.js", "gpulab.js", "ztc.js", "backdoor.js", "backdoor.css", "backdoor_metrics.json", "downloads/vdrpack.py", "demo/poisoned-page", "samples/weather-plus.vdr", "samples/weather-plus-tampered.vdr", "i18n.js", "demo_data.js", "styles.css", "ag_replay.json"}
|
| 18 |
HITS = {}
|
| 19 |
BACKEND2_SPACE = os.environ.get("BACKEND2_SPACE", "SeaWolf-AI/vk-ag-graft")
|
|
|
|
| 122 |
return self._json(200, {"user": RC.user_from(self.headers)})
|
| 123 |
if p == "/api/rt/leaderboard":
|
| 124 |
return self._json(200, RC.board_info())
|
| 125 |
+
if p.startswith("/api/agx/"):
|
| 126 |
+
return self._json(404, {"error": "not available in the challenge"})
|
| 127 |
if p.startswith("/api/ag/") or p.startswith("/api/agx/"):
|
| 128 |
x = p.startswith("/api/agx/")
|
| 129 |
name = p[9:] if x else p[8:]
|
|
|
|
| 156 |
return self._json(code, out)
|
| 157 |
if (p.startswith("/api/ag/") or p.startswith("/api/agx/")) and p != "/api/ag/session/start" and not RC.user_from(self.headers):
|
| 158 |
return self._json(401, {"error": "sign in with Hugging Face to take part"})
|
| 159 |
+
x = False # challenge build: no in-weights GPU backend
|
| 160 |
+
name = p[8:] if p.startswith("/api/ag/") else ""
|
| 161 |
if name not in POST_OK:
|
| 162 |
return self._json(404, {"error": "not found"})
|
| 163 |
ip = (self.headers.get("X-Forwarded-For") or self.client_address[0]).split(",")[0].strip()
|