Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.
Python calibrationclassificationdecision-modelhuggingfacejevmodernbertmultilingualnlppythonpytorchroutingtyped-decisionszero-shot
fix(revisions): reject drive-anchored components in expected digest paths
Rahul Ranjan74ce3f41d39e
diff --git a/laya/revisions.py b/laya/revisions.pyindex 4415141e..cb306d36 100644--- a/laya/revisions.py+++ b/laya/revisions.py@@ -137,6 +137,13 @@ def verify_digests(rel_norm = raw_rel.lstrip("/")if not rel_norm or rel_norm == ".." or rel_norm.startswith("../") or "/../" in rel_norm:raise ValueError("laya: unsafe path in expected digests: %r" % (rel,))+ # Drive-anchored components are not absolute by ntpath's own test+ # (ntpath.isabs("C:evil") is False), but on Windows ntpath.join resets to+ # the drive the moment one appears -- os.path.join("C:\\dir", "a", "b:c")+ # is "b:c" -- so a digest entry like "a/b:c" escapes model_dir and the+ # verification reads a file outside the checkpoint it is meant to gate.+ if any(ntpath.splitdrive(part)[0] for part in rel_norm.split("/")):+ raise ValueError("laya: unsafe drive-anchored path in expected digests: %r" % (rel,))path = os.path.join(model_dir, rel_norm)if not os.path.isfile(path):raise FileNotFoundError(diff --git a/tests/test_revision_pinning.py b/tests/test_revision_pinning.pyindex 7a235961..ed906f4d 100644--- a/tests/test_revision_pinning.py+++ b/tests/test_revision_pinning.py@@ -162,7 +162,10 @@ class VerifyDigestsTests(unittest.TestCase):verify_digests(self.dir, {"absent.bin": self.digest})def test_escaping_paths_rejected(self):- for rel in ("../evil", "..", "a/../../evil", "\\..\\evil", "/absolute/evil", "C:\\absolute\\evil"):+ for rel in ("../evil", "..", "a/../../evil", "\\..\\evil", "/absolute/evil", "C:\\absolute\\evil",+ # drive-anchored but not ntpath-absolute: ntpath.join("C:\\dir", "a", "b:c") == "b:c",+ # so on Windows these escape model_dir the same way the absolute ones do+ "C:evil", "c:evil", "a/b:c", "C:..\\evil"):with self.assertRaises(ValueError, msg=rel):verify_digests(self.dir, {rel: self.digest})