chore: add mise format and lint tasks (ruff + Biome)

Tools are pinned in mise.toml. ruff.toml points first-party detection at backend/, since the frontend's src/auth, src/books and src/notes otherwise get matched as first-party. biome.json uses spaces to match the existing Prettier-style formatting. Also combines a nested with in test_passwords.py (ruff SIM117).
This commit is contained in:
2026-10-02 15:06:56 -05:00
parent 0801a69cc0
commit d9b824851a
4 changed files with 41 additions and 5 deletions
+5 -4
View File
@@ -8,7 +8,6 @@ from unittest import mock
from auth import ITERATIONS, hash_password, load_pepper, needs_rehash, verify_password
PEPPER = b"p" * 32
# Independently computed: HMAC-SHA256(PEPPER, password) -> PBKDF2-SHA256, 1000 iterations, 16 zero-byte salt.
KNOWN_ANSWER = "pbkdf2_sha256$1000$AAAAAAAAAAAAAAAAAAAAAA==$9ZLLEusnEPU3Km8h+vnd4ue9fw7rHdm4QwuBX5ozynE="
@@ -41,9 +40,11 @@ class PasswordHashTests(unittest.TestCase):
class PepperTests(unittest.TestCase):
def test_env_pepper_must_be_long_enough(self):
with mock.patch.dict(os.environ, {"PASSWORD_PEPPER": "short"}):
with self.assertRaisesRegex(RuntimeError, "at least 32 characters"):
load_pepper(Path("/nonexistent"))
with (
mock.patch.dict(os.environ, {"PASSWORD_PEPPER": "short"}),
self.assertRaisesRegex(RuntimeError, "at least 32 characters"),
):
load_pepper(Path("/nonexistent"))
def test_env_pepper_is_used_when_set(self):
with mock.patch.dict(os.environ, {"PASSWORD_PEPPER": "e" * 40}):