unstale

npm / @casl/ability

@casl/ability

What changed in @casl/ability 5 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.

27 breaking5 security15 new APIs and options4 performance3 behavior and defaults16 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

@casl/ability 719 changes

Breaking changes 9

  • Manually setting __caslSubjectType__ now throws an error during authorization; use the subject() helper to assign subject types.

    7.1.1release notes

  • Ability replaces PureAbility and no longer has default options; use createMongoAbility and MongoAbility to get the previous Ability behavior.

    7.0.0release notes

  • An empty conditions object now matches all.

    7.0.0release notes

  • The exported getDefaultErrorMessage function was removed.

    7.0.0release notes

  • possibleRulesFor now returns readonly Rule[], so callers can no longer treat its result as a mutable array.

    7.0.0release notes

  • PureAbility was renamed to Ability.

    7.0.0release notes

  • rulesFor now returns readonly Rule[], so callers can no longer treat its result as a mutable array.

    7.0.0release notes

  • rulesToCondition replaces rulesToQuery.

    7.0.0release notes

  • rulesToQuery has been replaced by rulesToCondition.

    7.0.0release notes

Security 1

  • Prevents rulesToFields from setting properties on prototypes and non-objects.

    7.0.2release notes

New APIs and options 1

  • Adds support for custom subject type detection types.

    7.1.0release notes

Behavior and default changes 1

  • Conditions that semantically match everything are treated the same as rules without conditions.

    7.0.0release notes

Fixes and other changes 7

  • Built-in detectSubjectType no longer reads an object's own constructor property; it reads constructor only from the prototype chain.

    5.4.9, 6.8.4, 7.1.3release notesrelease notesrelease notes

  • TaggedSubject now infers the subject type without widening it.

    7.1.2release notes

  • Instance inference now supports classes with abstract, private, or protected constructors.

    7.0.3release notes

  • Adds bugs metadata to all packages, giving developers a package-level issue-tracker reference.

    7.0.1release notes

  • Adds defensive protection against undefined returned from the rule conditions matcher.

    7.0.0release notes

  • Prevents the rules index cache from being polluted with undefined actions.

    7.0.0release notes

  • rulesToAST now generates conditions that respect rule priority.

    7.0.0release notes

@casl/ability 611 changes

Breaking changes 2

  • Manually setting __caslSubjectType__ now throws during authorization; use the subject() helper to assign subject types.

    5.4.5, 6.8.2release notesrelease notes

  • Drops support for Angular versions below 13.

    6.0.0release notes

Security 3

  • A proto pollution fix was ported from 7.x.

    6.8.3release notes

  • CASL Ability is Vulnerable to Prototype Pollution

    6.7.5security advisory

  • Ignores potentially insecure fields in rulesToFields, helping prevent insecure fields from being included.

    6.7.5release notes

New APIs and options 2

  • The Rule type is now exported for developers to use.

    6.8.0release notes

  • The RuleOptions type is now exported for developers to use.

    6.8.0release notes

Performance 2

  • Performance improves for edge cases.

    6.8.1release notes

  • A new array is created lazily during rule field filtering.

    6.8.1release notes

Fixes and other changes 2

  • Adds Angular 13 support.

    6.0.0release notes

  • Replaces object.hasOwnProperty calls with static Object.hasOwn calls and a polyfill.

    6.0.0release notes

@casl/ability 540 changes

Breaking changes 16

  • Calling update triggers an update event.

    5.0.0release notes

  • No longer compares objects; users relying on a value equaling a specific object need to change conditions or implement a custom equal function.

    5.0.0release notes

  • Removes the subjectName option; use detectSubjectType instead.

    5.0.0release notes

  • Rules with all as the subject are prioritized in the same way as other rules, so rule ordering works as expected.

    5.0.0release notes

  • Ability functionality is provided by the @casl/ability package after CASL was split into packages under the @casl scope.

    5.0.0release notes

  • MongoDB-related functions moved to the separate @casl/mongoose package.

    5.0.0release notes

  • Ability throws an error when a rule specifies field as an empty array.

    5.0.0release notes

  • Ability no longer warns when only inverted rules are used, leaving the decision to the developer.

    5.0.0release notes

  • Removes LegacyClaimRawRule and LegacySubjectRawRule; rule definitions can no longer use actions and must use the action property.

    5.0.0release notes

  • manage represents any action rather than a CRUD alias; replace it with crud to retain the previous behavior.

    5.0.0release notes

  • MongoQuery now accepts an object interface for custom operators instead of a generic type of AdditionalOperators.

    5.0.0release notes

  • Renames MongoQueryOperators and adds an optional Value generic parameter.

    5.0.0release notes

  • rulesToQuery moved to @casl/ability/extra and its signature changed to accept an ability, action, subject, and rule callback.

    5.0.0release notes

  • The rulesToQuery export was moved out of the main package into @casl/ability/extra.

    5.0.0release notes

  • Subject-specific rules take precedence over all rules.

    5.0.0release notes

  • Replaces siftjs as the query-matching implementation, changing MongoQuery types and buildMongoQueryMatcher parameters for users who implemented custom sift operators.

    5.0.0release notes

Security 1

  • The prototype pollution fix was ported to ability-5.x.

    5.4.5release notes

New APIs and options 12

  • The on method was added, and update triggers an update event.

    5.0.0release notes

  • AbilityBuilder can accept the subject's Type.

    5.0.0release notes

  • Rule stores an ast property when conditionsMatcher has an ast property.

    5.0.0release notes

  • Rules support field patterns, allowing fields to be specified using patterns.

    5.0.0release notes

  • Forbidden reasons were added.

    5.0.0release notes

  • Methods to pack and unpack rules were added.

    5.0.0release notes

  • Per-field rules are supported.

    5.0.0release notes

  • The permittedAttributesOf helper was added.

    5.0.0release notes

  • The $regex condition is supported.

    5.0.0release notes

  • action was added as an alias for the actions Rule field.

    5.0.0release notes

  • A rulesToFields method was added.

    5.0.0release notes

  • Subjects can be passed as comma-separated items.

    5.0.0release notes

Performance 2

  • Fields are checked only when fields were specified in rules.

    5.0.0release notes

  • The permittedFieldsOf helper function was optimized.

    5.0.0release notes

Behavior and default changes 2

  • The third parameter to Ability.can is validated.

    5.0.0release notes

  • AbilityBuilder.define accepts an async function.

    5.0.0release notes

Fixes and other changes 7

  • The on method was added to the TypeScript definitions.

    5.0.0release notes

  • The TypeScript definitions for Ability were updated.

    5.0.0release notes

  • Event listeners are copied before they are called.

    5.0.0release notes

  • Inverted rules with conditions are ignored when checking subject type.

    5.0.0release notes

  • A TypeScript definition for rulesToFields was added.

    5.0.0release notes

  • An additional check was added to rulesToFields.

    5.0.0release notes

  • Returns null when an ability has only inverted rules.

    5.0.0release notes