| security | by dg | updated upgrading.md | | | |
| security | by dg | AGENTS.md: added invariants of identity hooks and TokenIdentity | | | |
| security | by dg | readme: authorization is described with voters | | | |
| security | by dg | User: $authenticatedRole is deprecated | | | |
| security | by dg | User: authorization is decided by voters instead of an authorizator per role (BC break) Voters decide about the Principal of the user, the effective state: the identity only while logged in (unlike User::getId(), which keeps returning the retained identity after logout) and the effective roles. User::createPrincipal() decides about someone else than the current user, or about a visitor for null, taking the identity as it is; getPrincipal() is built on it. Permission is one of the voters; its vote() ORs the roles, forbids when an explicit deny rule stopped them and abstains when only the default deny-all did, as well as on roles and resources the ACL does not know instead of throwing. SecurityExtension adds every service implementing Voter to the user. setAuthorizator() and the getters are deprecated; the third parameter of the User constructor is a variadic list of voters, User::isAllowed() types the privilege as ?string. | | | |
| security | by dg | added Voter, Vote and Principal A Voter decides about a Principal: the identity of a logged-in user (null for a guest), the effective roles and the voters, so that a voter may delegate through $principal->isAllowed(). Ownership is checked by Principal::hasId(), which never matches for a guest. A vote is a Vote: a single Forbid wins, otherwise a single Allow suffices. Vote::allowIf() allows or abstains, so forbidding is always written on purpose. | | | |
| security | by dg | Role is deprecated, the core works with role names only (BC break) Roles are names. An identity returning a Role object throws InvalidStateException, Permission::isAllowed() accepts the role only as a string, and getQueriedRole() and getQueriedResource() return names, so an assertion decides by names only. Resource stays: it maps an entity to the name of an ACL resource, so the rules of that resource apply to the entity. | | | |
| security | by dg | SimpleIdentity: reading an undeclared property throws (BC break) Until now __get() returned null for an unknown key and, because it returns by reference, silently created that key in the data (and thus in the storage). It now throws MemberAccessException, like any other Nette object. This also ends the by-ref write pattern $identity->cart[] = $item on a key that has not been set yet. | | | |
| security | by dg | SimpleIdentity: uses __serialize & __unserialize | | | |
| security | by dg | Identity -> SimpleIdentity Identity class must exist as an alias in order to read it from session | | | |
| security | by dg | IdentityHandler: make getGuestIdentity() a regular interface method (BC break) Promotes the optional @method to a required method, so User no longer needs method_exists() to call it. BC break: existing IdentityHandler implementations must now declare getGuestIdentity(). | | | |
| security | by dg | IIdentity: make getData() a regular interface method (BC break) | | | |
| security | by dg | IIdentity: added return typehint (BC break) | | | |
| security | by dg | User: deprecated magic properties (BC break) | | | |
| security | by dg | User: removed deprecated constants MANUAL & INACTIVITY (BC break) | | | |
| security | by dg | removed deprecated IAuthenticator (BC break) | | | |
| security | by dg | removed legacy services names (BC break) | | | |
| security | by dg | uses nette/utils 4.1 | | | |
| security | by dg | uses nette/http 3.4 | | | |
| security | by dg | used PHP 8.4 features | | | |
| security | by dg | requires PHP 8.4 | | | |
| security | by dg | opened 4.0-dev | | | |
| security | by dg | updated upgrading.md | | | |
| security | by dg | CookieStorage: token from the cookie never becomes the identity without being verified by IdentityHandler getState() returns a TokenIdentity, which User refuses to accept as the identity of the logged-in user: without an authenticator implementing IdentityHandler, or with one that does not exchange the token in wakeupIdentity(), anybody sending a cookie of 13 or more characters was logged in under that value as the ID. A TokenIdentity has no roles and no data, reading them throws. | | | |
| security | by dg | User: failed wakeupIdentity() or getGuestIdentity() no longer leaves the state half-loaded | | | |
| security | by dg | Permission: fixed whole-resource query ignoring a privilege deny on a parent resource | | | |
| security | by dg | fixed phpstan | | | |
| security | by dg | cs | | | |
| latte | by dg | Runtime: added TrustedUrl, which is not checked in URL attributes A URL in href, src and other URL attributes is checked by checkUrl() and the only way around was |nocheck in the template, which turns the check off for the place whatever the value is. TrustedUrl moves the decision to the PHP code that creates the URL, e.g. one with a scheme of its own. It is not a content type: anywhere else it is escaped like any other value. 90f5fdcf-a97a-42b5-bc27-65b36db215de | | | |
| latte | by dg | FilterExecutor: contextual filters get TrustedJavaScript, TrustedCss & TrustedXml as a string of their type A contextual filter in a print, {$js|trim}, got an HTML object as a string with the content type html and its result was wrapped back; the other trusted types were passed as objects of an unknown type. They are now treated the same way: the filter gets the string with the type js, css or xml and the result becomes the trusted class of the type the filter left. The class of a content type and the type of a trusted object are mapped in Helpers::getTrustedClass() and getTrustedType() only. 90f5fdcf-a97a-42b5-bc27-65b36db215de | | | |
| latte | by dg | Engine: added renderToTrusted() Returns the output as the trusted object of the content type it really has, which removes the trap of new Html($latte->renderToString(...)), where nobody checks that the output is HTML. The type comes from the template that printed the output, which with {layout} is the last one of the chain, so Template::render() returns it. A single block has the type of the place it is defined in: a block in <script> gives TrustedJavaScript, in <style> TrustedCss, a block in <title>, <textarea> or an attribute is converted to HTML. A text or iCal template and a block without a conversion to its main type (a comment, on*) throw. 90f5fdcf-a97a-42b5-bc27-65b36db215de | | | |
| latte | by dg | Helpers: printing an HTML object where its escaping differs from its conversion is deprecated TrustedHtml and other HtmlStringable objects are still printed by the escapers themselves. Where that differs from converting content type HTML into the context, the output stays and E_USER_DEPRECATED announces the change: - style, <style>, a CSS template, inside a tag, <script> of an unknown type and iCal have no conversion from HTML and will throw, - a text template keeps the markup and onclick={$html} turns its text into code; both will be converted like included HTML. In XML an HTML object is printed as XML, which {capture} relies on, so it is not deprecated there. 90f5fdcf-a97a-42b5-bc27-65b36db215de | | | |