Repository navigation
Immutable
release. Only release title and notes can be modified.
Security
kses()now filters executable markup with its default config. Previously the default$config = 1ran htmLawed with no filtering, so<script>,on*event handlers andjavascript:URLs survived and{!! kses( $html ) !!}was open to stored XSS. The default is nowSecurity::KSES_SAFE_CONFIG(htmLawed safe mode, no<style>,<link>or<meta>elements, noon*orstyleattributes);javascript:anddata:URLs are rewritten todenied:…. Behavior change: callers that relied on the permissive default must now pass their own$config.sanitize()/BaseFormRequestwith thehtmlrule and the opt-inXssProtectionmiddleware pick up the same default. Passing any config other than1is forwarded unchanged (#52, #53).- The default
kses()config also removes elements that can restyle or hijack the page:<base>,<form>and form controls (<input>,<button>,<select>,<option>,<optgroup>,<textarea>,<datalist>,<keygen>,<isindex>) and frames (<frame>,<frameset>), which allowed fake login forms on the site's own origin. URLs are limited tohttp/https, plusmailtoandtelforhref; any other scheme (ftp:,file:, …) is rewritten todenied:…. Relative and fragment URLs are kept. Custom (hyphenated) elements are now dropped (their text is kept) and thepingattribute is denied: htmLawed let custom elements keep every attribute, so Alpine/Livewire directives such as<x-a x-data x-init="…">survivedkses()and ran as script. Custom element names returned byap.security.ksesAllowedTagsare ignored for the same reason. The default also removesclassattributes (so content can't borrow the site's CSS classes for a full-page phishing overlay) and Alpine/Livewire directive attributes (x-*,@*,:*,wire:*) andison every element, even when$specpermits them. It dropsrel="opener"and addsnoopenerto links with atarget(reverse tabnabbing), and prefixesid/namevalues withuser-content-(DOM clobbering).#fragmentlinks and ID references (usemap,headers,for,aria-labelledby, …) are rewritten to match, and sanitizing already-prefixed output again leaves it unchanged. New publicSecurity::KSES_ID_PREFIXandSecurity::ksesSafeTag()(thehook_taginKSES_SAFE_CONFIG). Behavior change: content that relied on forms or other URL schemes passing throughkses()must pass its own$config(#50). - Under the default config, IDs stay unique after the
user-content-prefix is added: a repeatedidor one containing whitespace is dropped. Uniqueness is checked perkses()call (htmLawed'sunique_idsis off inKSES_SAFE_CONFIG), so sanitizing content again, or sanitizing two fragments that share an ID, no longer strips IDs. Before this, htmLawed remembered IDs across calls, so a third pass or a second call dropped theidand broke#fragmentlinks.itemrefvalues are now prefixed too. - Under the default config,
$speccan no longer re-enableon*,style,classorpingattributes (htmLawed lets$specoverridedeny_attribute). Those entries are dropped before the spec reaches htmLawed (#52). - Tags returned by the
ap.security.ksesAllowedTagsfilter can no longer re-enablescript,style,link,meta,base,iframe,frame,frameset,object,embed,applet,audio,video,canvas,dialog, or forms and form controls. Entries are trimmed and lowercased, and anything that isn't a plain element name (wildcards, htmLawed+/-operators, comma lists, non-strings) is ignored. The safe attribute and URL rules also apply to the filtered list (#50, #52).
Added
- The release workflow now has a
sync-docsjob that queues documentation and changelog imports on docs.artisanpackui.dev after each release. It needs theDOCS_API_TOKENorg secret and skips with a notice when the secret isn't set. Both imports are attempted on every run, and the job fails unless each returns202. Set aDOCS_PACKAGE_SLUGrepository variable if the docs-site slug ever differs from the repo name. The Packagist update now runs in its own job, so a Packagist failure no longer blocks the docs import, and the workflow defaults to read-onlyGITHUB_TOKENpermissions (#51). - New HTML filtering guide covering the safe
kses()default, narrowing elements withap.security.ksesAllowedTags,$specand custom configs, plus an "Upgrading to 2.2" section in UPGRADE.md. The API reference now documentsSecurity::KSES_SAFE_CONFIG,Security::KSES_ID_PREFIXandSecurity::ksesSafeTag().
Changed
- The
XssProtectionmiddleware no longer filters the input keys listed in the newartisanpack.security.xss.exceptconfig (password,password_confirmationandcurrent_passwordby default), at any nesting depth. With the stricterkses()default, filtering passwords could stop existing credentials from matching their hashes. - The release workflow's docs import requests now time out after 30 seconds, so a stalled
import-docscall can't stopimport-changelogfrom running. - The security report generator's
generatorVersionmetadata now reports2.2.0. - The global
kses()helper now accepts and forwards$configand$speclikeSecurity::kses(). Previously it silently dropped them (#52).
Fixed
- Bundled htmLawed: safe mode no longer throws on
styleattributes containingurl(…)(thehl_urlcallback didn't resolve in the namespaced copy). Corruptedsrcset/archive/itemtypeandabs_urlcode paths are repaired, and$specstrings now parse on every call instead of failing on the namespacedhl_aux1/hl_aux2callbacks.srcsetvalues are no longer run throughhl_url()a second time (which double-converted the first candidate underabs_url). A$specdefaultnow goes through the same checks as an input value (values the spec only filtered aren't re-checked): eachsrcsetcandidate gets the scheme check, and astyledefault gets the CSSurl()andexpressionchecks.srcsetvalues are split into candidates per the HTML parsing rules, so commas inside a URL (such as adata:URL) no longer split it. Astyleattribute generated from deprecated markup (<center>,<font>,align,bgcolor, …) is dropped whendeny_attributeor a$spec-stylerule deniesstyle. An integerunique_idsconfig value no longer throws aTypeError(#52, #53).