octobercms/october · error · Twig\Sandbox\SecurityNotAllowedPropertyError

Calling " " property on a " " object is blocked.

Error message

Calling "%s" property on a "%s" object is blocked.

What it means

Legacy Twig security policy checkPropertyAllowed: the template accessed a property listed in blockedProperties on the given object. Property access is denied to prevent leaking internals through Twig; remove the access or adjust the policy.

Solutions

  1. Access the value through an allowed method or precomputed variable
  2. Remove the property from the blocked list if access is intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/system/twig/SecurityPolicyLegacy.php:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/5527c1123ee2b99d. Report an issue: GitHub.

Appendix: source

Thrown at modules/system/twig/SecurityPolicyLegacy.php:140

            }
        }

        // Check general methods
        if (in_array($blockedMethod, $this->blockedMethods)) {
            $class = get_class($obj);
            throw new SecurityNotAllowedMethodError(sprintf('Calling "%s" method on a "%s" object is blocked.', $method, $class), $class, $method);
        }
    }

    /**
     * checkPropertyAllowed
     * @throws SecurityNotAllowedPropertyError
     */
    public function checkPropertyAllowed($obj, $property): void
    {
        if (in_array($property, $this->blockedProperties)) {
            $class = get_class($obj);
            throw new SecurityNotAllowedPropertyError(sprintf('Calling "%s" property on a "%s" object is blocked.', $property, $class), $class, $property);
        }
    }
}

View on GitHub (pinned to b608633a7e)