Skip to content

deleted#4

Closed
jechol wants to merge 1 commit into
mainfrom
fix/policy-refactoring-issue
Closed

deleted#4
jechol wants to merge 1 commit into
mainfrom
fix/policy-refactoring-issue

Conversation

@jechol

@jechol jechol commented Oct 17, 2025

Copy link
Copy Markdown
Owner

deleted

The Policy Refactoring (ash-project#2365) introduced a bug where bypass policies
were contributing only their condition to one_condition_matches instead
of their complete expression (condition AND policies).

This caused bypass policies with always-true conditions (like always())
to incorrectly satisfy the "at least one policy applies" requirement
even when the bypass policies themselves failed.

For example, with these policies:
- bypass always() do authorize_if actor_attribute_equals(:is_admin, true)
- policy action_type(:read) do authorize_if always()

A non-admin user performing a create action would be incorrectly
authorized because:
1. bypass condition (always) was true → one_condition_matches = true
2. policy condition (action_type(:read)) was false
3. Final: true AND (tautology) = true (incorrect!)

The fix restores the old behavior where bypass policies contribute
their complete expression to one_condition_matches, ensuring that
a bypass only satisfies the requirement if it actually authorizes.

Fixes authorization bypass when bypass conditions are always true but
bypass policies fail.
@jechol jechol force-pushed the fix/policy-refactoring-issue branch from c11b477 to 394b5cc Compare October 17, 2025 03:45
@jechol jechol closed this Oct 17, 2025
@jechol jechol deleted the fix/policy-refactoring-issue branch October 17, 2025 04:50
@jechol jechol changed the title fix: use complete expression for bypass policy (based on 79749c26) deleted Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant