Repository navigation
Description
Summary
The three Redis ACL acceptance tests in tests/security/test_redis_network_isolation.py fail against any live stack with b'NOAUTH Authentication required.\n\n'. Root cause is a fixture-precedence bug: the global tests/conftest.py setdefaults REDIS_BACKEND_PASSWORD="test" at import time, and tests/security/conftest.py then tries to override it from .env but also uses setdefault — which is a no-op when the key already exists. The bogus "test" value sticks, so redis-cli --user backend -a test is sent to Redis, which (correctly) rejects it.
The Redis ACL itself is healthy. Confirmed in the phoenix worktree against a clean stack: docker run --rm --network trinity-platform-network redis:7-alpine redis-cli -h redis --user backend -a $REAL_PWD PING → PONG. The bug is purely in the test fixture wiring.
Context
Introduced by commit 6841e72b — fix(security): lock down Redis — auth + ACL + network split (#589) — on 2026-05-04. Both halves of the bug landed in that one commit:
tests/conftest.py:30—_os_589.environ.setdefault("REDIS_BACKEND_PASSWORD", "test")(runs first, at global pytest import, poisons the env)tests/security/conftest.py:25—os.environ.setdefault(key, value)for the.envload (runs later, can't override becausesetdefaultis a no-op when the key already exists)
Follow-up 3d15b5fa (#777 — skip-when-unset guard for REDIS_BACKEND_PASSWORD (#764)) added a per-test backend_password fixture with pytest.skip("REDIS_BACKEND_PASSWORD not set"), but the guard only skips on absence — the bogus "test" value satisfies the guard, so tests run with wrong creds and fail.
This means the Redis ACL acceptance tests have not actually validated the ACL since #589 merged. They've been a green silence in the "skip" path or a red noise in the "live stack" path, never the green truth they were written to be.
Failing tests (all 3, against a live stack):
test_platform_container_can_authenticatetest_backend_acl_blocks_flushalltest_backend_acl_blocks_config_get
Pytest traceback header reveals the smoking gun: backend_password = 'test'.
Acceptance Criteria
-
tests/security/conftest.pyoverridesREDIS_BACKEND_PASSWORDandREDIS_PASSWORDfrom.enveven when prior fixtures have set them (use direct assignment, notsetdefault) - The 3
test_redis_network_isolationtests pass against a freshly-started stack (./scripts/deploy/start.shfrom a clean worktree) - A regression test asserts that when
.envis present and exports a non-"test"REDIS_BACKEND_PASSWORD,os.environ["REDIS_BACKEND_PASSWORD"] != "test"after both conftests have loaded - No regression in the no-stack path: when neither
.envnor real env vars provide creds, the suite still skips cleanly
Technical Notes
One-line fix at tests/security/conftest.py:25:
# was: os.environ.setdefault(key, value)
os.environ[key] = valueAlternative: clear the "test" sentinel in the security conftest before loading .env:
for key in ("REDIS_PASSWORD", "REDIS_BACKEND_PASSWORD"):
if os.environ.get(key) == "test":
os.environ.pop(key)Direct assignment is simpler and clearer about intent.
Related: #589, #764, #777. Zone: security / Redis isolation.
Activity
fix(tests): override "test" sentinel in security conftest (closes #804)
fix(tests): override "test" sentinel in security conftest (#804) (#805)
vybe commentedon Jun 1, 2026
Shipped in v0.6.0 (released via #998).
fix(tests): resolve the integration Redis target once, and fail inste…
fix(tests): resolve the integration Redis target once, and fail inste…
fix(tests): resolve the integration Redis target once, and fail inste…