mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
Merge PR #414 (feature/web-app-wazuh/add-role) into feature/network/multi-network-serving
Brings web-app-wazuh to the reviewed state of #414. This branch was cut from an earlier #414 head, which has since been rebased and gained its review fixes, so both sides added the role and every role file conflicted as add/add. Conflicts, decided per file: - roles/web-app-wazuh: #414's side. It is the reviewed version of the same role, and this branch's own Wazuh changes are already part of it (drop the Tor dual-stack workarounds, drop the first commit's leftovers, ports 8096/8097, heap via service_memory_mb). - roles/web-app-wazuh/templates/opensearch_dashboards.yml.j2: #414's file with this branch's trust_dynamic_headers instead of base_redirect_url, so the OIDC redirect follows the network sibling the request came in on rather than pinning the clearnet URL. - plugins/filter/bcrypt_hash.py and its test: #414's stable salt, which the role's vars now pass. - test-e2e-playwright keycloak.js: #414's leave-group helper, which fails loudly on a missing user or group instead of returning silently. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
eefa14c125
26 files changed
+436
-272
No files matched your search
@@ -35,6 +35,56 @@ class TestBcryptHash(unittest.TestCase):
|
||||
bcrypt.checkpw(password.encode("utf-8"), hashed.encode("utf-8"))
|
||||
)
|
||||
|
||||
def test_72_byte_password_hashes_successfully(self):
|
||||
password = "A" * 72
|
||||
hashed = self.f(password)
|
||||
self.assertTrue(
|
||||
bcrypt.checkpw(password.encode("utf-8"), hashed.encode("utf-8"))
|
||||
)
|
||||
|
||||
def test_73_byte_password_raises(self):
|
||||
with self.assertRaisesRegex(ValueError, "73 bytes.*at most 72 bytes"):
|
||||
self.f("A" * 73)
|
||||
|
||||
def test_multibyte_password_over_72_bytes_raises(self):
|
||||
password = "ä" * 37
|
||||
self.assertEqual(len(password), 37)
|
||||
with self.assertRaisesRegex(ValueError, "74 bytes"):
|
||||
self.f(password)
|
||||
|
||||
def test_same_secret_and_seed_give_the_same_hash(self):
|
||||
self.assertEqual(
|
||||
self.f("same-password", "app:indexer-admin"),
|
||||
self.f("same-password", "app:indexer-admin"),
|
||||
)
|
||||
|
||||
def test_different_seed_gives_a_different_hash(self):
|
||||
self.assertNotEqual(
|
||||
self.f("same-password", "app:indexer-admin"),
|
||||
self.f("same-password", "app:dashboard-service"),
|
||||
)
|
||||
|
||||
def test_different_secret_gives_a_different_hash(self):
|
||||
self.assertNotEqual(
|
||||
self.f("password-one", "app:indexer-admin"),
|
||||
self.f("password-two", "app:indexer-admin"),
|
||||
)
|
||||
|
||||
def test_seeded_hash_verifies_against_the_original_password(self):
|
||||
password = "correct horse battery staple"
|
||||
hashed = self.f(password, "app:indexer-admin")
|
||||
self.assertTrue(
|
||||
bcrypt.checkpw(password.encode("utf-8"), hashed.encode("utf-8"))
|
||||
)
|
||||
self.assertTrue(hashed.startswith("$2b$12$"))
|
||||
|
||||
def test_no_seed_stays_randomized(self):
|
||||
self.assertNotEqual(self.f("same-password"), self.f("same-password"))
|
||||
|
||||
def test_empty_seed_raises(self):
|
||||
with self.assertRaises(ValueError):
|
||||
self.f("some-password", "")
|
||||
|
||||
def test_none_raises(self):
|
||||
with self.assertRaises(ValueError):
|
||||
self.f(None)
|
||||
|
||||
Reference in new issue
Block a user