Harden NoActor check with runtime environment guard
Add Mix.env() check to match?/3 for defense in depth. Document NoActor pattern in CODE_GUIDELINES.md.
This commit is contained in:
parent
5506b5b2dc
commit
93216f3ee6
3 changed files with 128 additions and 1 deletions
|
|
@ -58,7 +58,8 @@ defmodule Mv.Authorization.Checks.NoActor do
|
|||
@impl true
|
||||
def match?(nil, _context, _opts) do
|
||||
# Actor is nil
|
||||
if @allow_no_actor_bypass do
|
||||
# Double-check: compile-time AND runtime environment
|
||||
if @allow_no_actor_bypass and Mix.env() == :test do
|
||||
# Test environment: Allow all operations
|
||||
true
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue