Project:ModSecurity false positive affecting Page Forms: Difference between revisions

From Azeroth Gazetteer
Jump to navigation Jump to search
m Beornulf moved page Project:Page Forms citation bug to Project:ModSecurity false positive affecting Page Forms without leaving a redirect: New information about the source
Update findings
 
Line 1: Line 1:
'''{{PAGENAME}}''' documents a reproducible problem on ''Azeroth Gazetteer'' involving the Page Forms extension and citations entered into template fields. Under PHP 8.4.27, literal <code>&lt;ref&gt;...&lt;/ref&gt;</code> citations could trigger HTTP 500 (Internal Server Error) during form preview or saving. Switching to PHP 8.3.36 allowed simple references to work, but '''did not eliminate the problem''': further tests isolated failures involving apostrophe-formatted wiki links and reference tags. The equivalent content works through the ordinary source editor. Two alternatives have rendered successfully in Page Forms previews: the self-contained <code>&#123;&#123;#tag:ref|...&#125;&#125;</code> syntax and self-closing named references (<code>&lt;ref name="source" /&gt;</code>) whose definitions are present elsewhere on the page. Only <code>#tag:ref</code> has been verified through saving and reopening.
'''{{PAGENAME}}''' documents a '''resolved ModSecurity false positive''' on ''Azeroth Gazetteer'', hosted by DreamHost. Legitimate MediaWiki wikitext entered through the [[mw:Extension:Page Forms|Page Forms]] extension, particularly citations combined with apostrophe-formatted wiki links, was mistaken for a possible SQL injection attempt. Page Forms previews or saves consequently appeared to fail with an internal server error. An Apache error log subsequently showed that the host's ModSecurity web application firewall (WAF) had rejected the request with '''HTTP 418'''.<ref name="DreamHostWAF">[https://help.dreamhost.com/hc/en-us/articles/215947927-Enabling-the-Web-Application-Firewall DreamHost Knowledge Base, “Enabling the Web Application Firewall”], documentation of ModSecurity blocks and HTTP 418</ref>


This is a record of observed behaviour and locally tested workarounds, '''not a confirmed identification of the faulty extension or function'''.
On '''5 November 2026''', DreamHost technical support confirmed that security rule <code>942550</code> was interfering with the requests and, with the site administrator's approval, removed the offending rule. '''The previously problematic citations then worked without further changes to MediaWiki, PHP, Page Forms, or Cargo.''' This before-and-after result, together with the server log, strongly supports the firewall rule as the cause of the observed editing failures. The precise scope of DreamHost's configuration change was not independently established; removing one detection rule should not be confused with disabling the entire WAF.


* '''First documented here:''' 5 November 2026
* '''First documented:''' 5 November 2026
* '''Status:''' Unresolved; PHP 8.3.36 narrows, but does not eliminate, the observed failures; <code>#tag:ref</code> verified through save and reopen
* '''Status:''' '''Resolved on this installation''' after DreamHost removed ModSecurity rule <code>942550</code>
* '''Affected workflow:''' Editing template parameters through Page Forms
* '''Affected operation:''' Previewing or saving certain template-field content through Page Forms
* '''Preferred workaround:''' <code>&#123;&#123;#tag:ref|citation&#125;&#125;</code> (self-contained)
* '''Detection rule:''' <code>942550</code> (“JSON-Based SQL Injection”)
* '''Additional preview-tested alternatives:''' <code>&lt;ref name="source" /&gt;</code> (requires a matching definition); moving apostrophe formatting inside a wiki-link label in one tested arrangement
* '''Blocking rule:''' <code>949110</code> (“Inbound Anomaly Score Exceeded”)
* '''Recorded firewall response:''' HTTP 418, despite the browser's generic internal-error message
* '''Earlier workarounds:''' <code>&#123;&#123;#tag:ref|...&#125;&#125;</code> and, for one tested pattern, placing italics inside a wiki link's display label


==Software environment==
'''This was not established to be a defect in Page Forms, Cite, Cargo, or PHP.''' A separate Cargo issue involving stored <code>UNIQ--ref...-QINU</code> placeholders remains distinct from the firewall problem.


The following software versions were reported from ''Azeroth Gazetteer'' on '''5 November 2026'''. PHP was changed during testing; the other listed versions were not reported to have changed:
==Software environment and chronology==
 
The investigation and successful remediation took place on 5 November 2026. The following versions were confirmed locally:


{| class="wikitable"
{| class="wikitable"
! Component
! Component
! Installed version
! Versions tested or installed
|-
|-
| MediaWiki
| MediaWiki
| 1.45.3
| '''1.45.3''', subsequently upgraded to '''1.46.2'''
|-
|-
| PHP
| PHP
| 8.4.27 (initial tests); '''8.3.36''' (follow-up tests)
| '''8.4.27''' initially; subsequently '''8.3.36'''
|-
|-
| Page Forms
| Page Forms
| 6.0.11
| '''6.0.11'''
|-
|-
| Cargo
| Cargo
| 3.9.4
| '''3.9.4'''
|-
|-
| Cite
| Cite
| Version not declared in [[Special:Version]]
| Installed and functional; no numerical version declared in [[Special:Version]]
|}
|}


Cite is installed and functional, but the installation's [[Special:Version]] interface does not supply a numerical Cite version. '''No Cite version is inferred.''' These details describe the local environment and do not by themselves establish which component causes the failure. The PHP downgrade altered which reference-markup patterns succeeded; it did '''not''' conclusively identify a PHP defect or fix the underlying issue.
Under PHP 8.4.27, even a simple literal reference in the affected form field produced an apparent internal server error. Changing the host's PHP version to 8.3.36 allowed simple references to work, but more complex markup continued to fail. A controlled series of fifteen tests isolated combinations of references, wiki links, formatting, and ordering (documented below).


==Symptoms==
MediaWiki was then upgraded from 1.45.3 to 1.46.2, retaining PHP 8.3.36 and the reported Page Forms and Cargo versions. Ordinary source editing and article saving worked after the upgrade. However, the following Page Forms input '''still failed''':


The problem has appeared in more than one form or template. During the initial PHP 8.4.27 investigation, a literal reference entered into certain Page Forms fields caused an HTTP 500 error when either '''Preview''' or '''Save''' was selected. Removing the reference allowed the form to proceed normally. Under PHP 8.3.36, simple literal references worked, while particular combinations of reference tags and formatted wiki links still caused failure (see the follow-up tests below).
<pre>
''[[Tides of Darkness]]''<ref>Test citation</ref>
</pre>


The failure is not a general inability to use templates in a form field: ordinary transclusions, including <code>&#123;&#123;df&#125;&#125;</code>, have worked. Nor does the Cite extension fail everywhere on the wiki: references in the article body work through normal source editing.
The alternative <code>&#91;&#91;Tides of Darkness|''Tides of Darkness''&#93;&#93;</code> continued to work in the subsequent test. Updating MediaWiki therefore did not resolve the observed form-submission failure. The problem was subsequently resolved only after DreamHost changed the ModSecurity configuration.


The clearest reproduction occurred while editing [[Blackened Woods]] using [[Form:Location]], in the '''Former name(s)''' field. An earlier incident affected a citation for Falstad Wildhammer in the current-ruler information of [[Wildhammer Clan]].
==Affected form and reproduction==


==Reproduction on Blackened Woods==
The clearest case involves [[Blackened Woods]], edited through [[Form:Location]]. The '''Former name(s)''' field is defined as:
 
In [[Form:Location]], the relevant input is defined as:


<pre>
<pre>
Line 51: Line 55:
</pre>
</pre>


Its value is passed to [[Template:Locationbox]], which displays the parameter and also passes it to Cargo as <code>Former_name</code>, declared as <code>Wikitext string</code>.
It supplies the <code>fname</code> parameter to [[Template:Locationbox]], which both displays the text and stores it in Cargo as <code>Former_name</code>, declared as <code>Wikitext string</code>.


To reproduce the failure:
To reproduce the problem in the tested environment:


# Open [[Blackened Woods]] using '''Edit with form'''.
# Open [[Blackened Woods]] using '''Edit with form'''.
# Enter a citation in '''Former name(s)''', for example:
# Enter the test markup below into '''Former name(s)'''.
# Select '''Preview''' or '''Save'''.
 
<pre>
<pre>
Eversong Forest<ref>Test citation</ref>
''[[Tides of Darkness]]''<ref>Test citation</ref>
</pre>
 
'''Observed result before the firewall change:''' The request failed, while equivalent markup could be entered through the ordinary source editor. Removing the problematic markup or using one of the tested alternatives allowed the form operation to proceed. '''After DreamHost removed rule <code>942550</code>, citation entry through Page Forms was reported to work normally.''' Not every one of the fifteen historical test combinations was individually retested after the change.
 
An earlier incident involved the citation for Falstad Wildhammer in the current-ruler information of [[Wildhammer Clan]]. The failures were therefore not confined to a single article, although the detailed reproduction tests were conducted using [[Form:Location]].
 
==Apache log evidence==
 
After MediaWiki 1.46.2 had been installed and the failure reproduced, the site's Apache error log was inspected through SSH. Three entries at '''12:48:05 on 5 November 2026 (server log time)''' identify a single blocked request to <code>/mediawiki/index.php</code>.
 
The relevant information, condensed from the log and with the client's IP address omitted, is:
 
<pre>
ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:Locationbox[fname]:
''[[tidesofdarkness]]''<ref>testcitation</ref>"]
 
ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:pf_free_text: ..."]
 
ModSecurity: Access denied with code 418 (phase 2)
[id "949110"]
[msg "Inbound Anomaly Score Exceeded (Total Score: 10)"]
[uri "/mediawiki/index.php"]
</pre>
</pre>
# Select '''Preview''' or '''Save'''.


'''Observed result with PHP 8.4.27 (5 November 2026):''' This simple test produced HTTP 500. Removing the <code>&lt;ref&gt;...&lt;/ref&gt;</code> element avoided the failure. '''With PHP 8.3.36, the same simple reference succeeded.''' It is therefore not a reliable reproduction case on both PHP versions.
The rules were loaded from DreamHost's installation of the OWASP Core Rule Set. Rule <code>942550</code> matched '''two parameters in the same request''': the location-infobox field (<code>Locationbox[fname]</code>) and the form's free-text field (<code>pf_free_text</code>). The latter contained existing page markup, including links and references. Rule <code>949110</code> then rejected the request when the inbound anomaly score reached 10.


The same citation works when placed directly into the <code>fname</code> template parameter through the ordinary source editor. Ordinary editing worked both with normal Cargo storage and with the template's existing <code>nocargo=yes</code> switch. This narrows the failure to the form-editing workflow, though it does not independently establish whether the fault lies in Page Forms, an interaction between extensions, or the server's handling of that path.
The log establishes that '''the firewall rejected this legitimate editing request as a suspected SQL injection'''. It does '''not''' show a PHP exception or establish that MediaWiki reached the PHP code that would normally process the edit. Consequently, a PHP exception backtrace was not needed to explain this particular blocked request.


No corresponding application error was identified in the available DreamHost panel logs. Unrelated Apache <code>AH01630</code> access-denied messages for <code>forbidden.html</code> did not coincide with the failed edits. The precise PHP exception or fatal error remains unknown.
DreamHost documents that ModSecurity uses HTTP 418 for blocked requests, and that the resulting page may display the generic message “The server encountered an internal error or misconfiguration”. DreamHost also states that individual ModSecurity rules cannot be modified through <code>.htaccess</code> on its hosting service.<ref>[https://help.dreamhost.com/hc/en-us/articles/215947927-Enabling-the-Web-Application-Firewall DreamHost Knowledge Base, “Enabling the Web Application Firewall”], sections on error responses and modifying rules</ref>


==Follow-up tests under PHP 8.3.36==
'''Limits of the evidence:''' The log establishes why this transaction failed, and the successful test after DreamHost removed the offending rule strongly corroborates the diagnosis. It does not establish that every earlier failed test had precisely the same cause. Comparable firewall entries were not preserved here for the initial PHP 8.4.27 tests, so their differing apparent behaviour remains unexplained. Two rule matches occurred in the same request; the log alone does not show whether either parameter would have been sufficient to trigger a block independently.


On '''5 November 2026''', the hosting control panel was used to change PHP from 8.4.27 to '''8.3.36'''. No concurrent update to MediaWiki, Page Forms, Cargo, or Cite was reported. An initial preview with a literal reference and a template transclusion succeeded, suggesting the issue might have disappeared. Further tests showed that the error '''still occurred with specific markup combinations'''.
==Controlled tests under PHP 8.3.36==


The following fifteen tests used the '''Former name(s)''' field in [[Form:Location]] while editing [[Blackened Woods]]. They were reported as successful or failing during the Page Forms preview workflow; the tests do not establish that all successful combinations were also saved and reopened. No underlying PHP exception was captured.
Before the firewall entries were discovered, fifteen Page Forms preview tests were conducted in the '''Former name(s)''' field while editing [[Blackened Woods]]. The following table records their '''historical results before the firewall change'''; “Fails” no longer describes the known current behaviour of the installation. Not every case was separately retested after remediation. These observations do '''not''' demonstrate a Page Forms parser defect.


{| class="wikitable"
{| class="wikitable"
Line 140: Line 171:
|}
|}


The following minimal examples demonstrate the most important distinctions. In these samples, <nowiki>''[[Tides of Darkness]]''</nowiki> and <nowiki>'''[[Tides of Darkness]]'''</nowiki> mean apostrophe-based formatting '''around the whole wiki link'''.
Representative examples are shown below.


'''Fails: formatting encloses the wiki link inside a reference (test 6).'''
'''Failed before remediation: an italicised wiki link inside the reference.'''
<pre>
<pre>
Eversong Forest<ref>''[[Tides of Darkness]]''</ref>
Eversong Forest<ref>''[[Tides of Darkness]]''</ref>
</pre>
</pre>


'''Fails: formatting encloses the wiki link before a reference, even with intervening whitespace (test 10).'''
'''Failed before remediation: an italicised wiki link before the reference.'''
<pre>
<pre>
Eversong Forest ''[[Tides of Darkness]]'' <ref>Test citation</ref>
Eversong Forest ''[[Tides of Darkness]]'' <ref>Test citation</ref>
</pre>
</pre>


'''Fails: bold wiki link before a reference (test 14).'''
'''Failed before remediation: a bold wiki link before the reference.'''
<pre>
<pre>
Eversong Forest '''[[Tides of Darkness]]''' <ref>Test citation</ref>
Eversong Forest '''[[Tides of Darkness]]''' <ref>Test citation</ref>
</pre>
</pre>


'''Works: reverse the order, placing the reference before the italicised link (test 11).'''
'''Worked before remediation: the reference precedes the italicised link.'''
<pre>
<pre>
Eversong Forest<ref>Test citation</ref>''[[Tides of Darkness]]''
Eversong Forest<ref>Test citation</ref>''[[Tides of Darkness]]''
</pre>
</pre>


'''Works: put italics inside the wiki link's display label (test 15).'''
'''Worked before remediation: italics are placed inside the wiki link's display label.'''
<pre>
<pre>
Eversong Forest [[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>
Eversong Forest [[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>
</pre>
</pre>


'''Interpretation:''' These results support an '''order-sensitive interaction between literal reference tags and apostrophe formatting around wiki links'''. Neither ordinary wiki links nor italicised text alone caused the problem in the tested arrangements. Both bold and italic formatting around the whole link failed when the formatted link preceded a reference. Moving the formatting inside a link label succeeded in the one tested arrangement. This identifies a useful reproduction pattern, '''not the faulty extension or parser function'''. In particular, the results do not establish whether changing PHP itself, the restart of the PHP execution environment, or another version-specific behaviour explains the difference from the initial PHP 8.4.27 tests.
The pre-remediation failures varied with the '''syntax and ordering''' of the submitted markup. The firewall finding supplies a strong explanation for the reproduced block: a generic attack-detection rule misclassified legitimate apostrophes, brackets, and other wikitext characters. The original tests did not measure individual ModSecurity rule scores, however; the table cannot establish precisely how each combination contributed to the blocking threshold.


===Additional preview-tested formatting alternative===
==Resolution by DreamHost==


When a source field needs an italicised wiki link followed by a reference, the following arrangement succeeded under PHP 8.3.36:
After the Apache log was examined, a support ticket was submitted to DreamHost identifying the domain, timestamp, endpoint <code>/mediawiki/index.php</code>, affected parameters <code>Locationbox[fname]</code> and <code>pf_free_text</code>, detection rule <code>942550</code>, blocking rule <code>949110</code>, HTTP 418 response, and the request identifier recorded in the log.


<pre>
A DreamHost technician confirmed that rule <code>942550</code> was interfering with the requests and requested permission to remove it. The administrator approved the change. After the technician reported removing the offending rule, '''citations which had caused the Page Forms error worked normally'''. No further MediaWiki, PHP, Page Forms, or Cargo version changes were made between the logged failure and the successful retest.
[[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>
 
</pre>
This is a successful local remediation, not an assertion that every unrelated form error is caused by ModSecurity. The technician's message did not establish whether the rule removal was restricted to particular parameters or to the entire domain. The remaining WAF protections were stated to remain active.
 
==Troubleshooting similar failures==
 
For other site administrators encountering apparent HTTP 500 errors while submitting legitimate wikitext through Page Forms:
 
# Reproduce the problem using a harmless, identifiable example, and note the time of the request.
# Inspect the hosting provider's Apache or web application firewall error logs, if available. A visible “internal server error” does not establish that PHP threw an exception.
# Look for a ModSecurity entry containing the submitted text, an <code>ARGS:</code> parameter name, a detection-rule ID, a blocking-rule ID, and the request identifier.
# Where a false positive is demonstrated, contact the hosting provider with the matching evidence. Request the '''narrowest practicable rule or parameter exclusion''' rather than disabling the entire WAF.
# Repeat the same input after the provider's change and verify that the operation succeeds. Check the firewall log again if the problem continues.
 
On DreamHost, a blocked ModSecurity request may produce HTTP 418. DreamHost's documentation states that individual ModSecurity rule modifications are not supported through <code>.htaccess</code>; an administrator who needs a tailored exception should consult support.<ref name="DreamHostWAF" /> Do not assume that every HTTP 500 response, or every Page Forms problem involving <code>&lt;ref&gt;</code>, is a firewall block.


This retains a literal <code>&lt;ref&gt;...&lt;/ref&gt;</code> element, but moves italics '''inside''' the link label. It has only been tested in the displayed order and spacing, and only during preview. It does not address the case of an italicised wiki link '''inside''' the reference itself. It should therefore be treated as a narrow alternative, not a replacement for the more thoroughly tested <code>#tag:ref</code> workaround.
==Earlier workarounds==


==Verified workaround==
===Construct the reference with #tag===


Use MediaWiki's <code>#tag</code> syntax to construct the reference instead of typing a literal opening and closing <code>ref</code> tag into the Page Forms field.
Before the firewall issue was resolved, the most thoroughly tested workaround was MediaWiki's <code>#tag</code> parser function, which can construct a reference without placing a literal opening and closing <code>ref</code> tag directly in the affected input field.


'''Instead of:'''
'''Instead of:'''
Line 193: Line 236:
</pre>
</pre>


The workaround also accepts tested citations containing other templates. Under PHP 8.3.36, <code>#tag:ref</code> continued to work in preview. For example:
For a citation containing a template:
 
<pre>
<pre>
Eversong Forest{{#tag:ref|{{df}}, pp. 152–153}}
Eversong Forest{{#tag:ref|{{df}}, pp. 152–153}}
</pre>
</pre>


'''Verified on Blackened Woods:''' The alternative syntax rendered citations correctly in preview, allowed the page to be saved, remained present when the page was reopened through '''Edit with form''', and allowed subsequent previews without an error. It was subsequently used to restore the missing Falstad Wildhammer citation in [[Wildhammer Clan]].
On [[Blackened Woods]], the <code>#tag:ref</code> form rendered in preview, survived saving, remained intact when the page was reopened through '''Edit with form''', and continued to preview normally. The method was also used to restore the Falstad Wildhammer citation in [[Wildhammer Clan]]. It uses standard MediaWiki parser-function syntax rather than a custom extension.<ref>[https://www.mediawiki.org/wiki/Help:Magic_words MediaWiki: Help:Magic words], section on <code>#tag</code>; [https://www.mediawiki.org/wiki/Help:XML-style_tags Help:XML-style tags]</ref>


This is standard MediaWiki parser-function syntax, not a Gazetteer-specific extension or a change to the Cite extension. MediaWiki's documentation notes that <code>#tag</code> processes enclosed template calls differently from literal XML-style tags.<ref>[https://www.mediawiki.org/wiki/Help:Magic_words MediaWiki: Help:Magic words], section on <code>#tag</code>; see also [https://www.mediawiki.org/wiki/Help:XML-style_tags Help:XML-style tags]</ref>
With the ModSecurity false positive removed, this alternative is '''no longer required''' to avoid the documented failure. It remains valid MediaWiki syntax, but neither its general acceptance by WAFs nor equivalence of Cargo storage should be assumed.


For now, prefer the self-contained <code>#tag:ref</code> form in affected Page Forms fields. Ordinary <code>&lt;ref&gt;...&lt;/ref&gt;</code> citations can continue to be used in article prose when editing normally. The workaround is verified for the tested cases, not guaranteed for every field or extension combination.
===Place formatting within the wiki link label===


===Named references and self-closing tags===
Before remediation, replacing:


MediaWiki permits a citation to be defined in one place and reused elsewhere with a self-closing tag such as <code>&lt;ref name="source" /&gt;</code>.<ref>[https://www.mediawiki.org/wiki/Help:Cite MediaWiki: Help:Cite], section on multiple uses of the same footnote</ref> Historical Page Forms release notes also mention a fix concerning self-closing tags.
<pre>
''[[Tides of Darkness]]''<ref>Test citation</ref>
</pre>


'''Verified in preview on Blackened Woods (5 November 2026):''' With the full named references defined elsewhere on the page, the following text was entered into the '''Former name(s)''' field of [[Form:Location]]:
with a wiki link whose display text contains the italics avoided the failure:


<pre>
<pre>
Eversong Forest<ref name="one" /><ref name="two" />
[[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>
</pre>
</pre>


Selecting '''Preview''' succeeded without an HTTP 500 error. The preview displayed two linked reference numbers after ''Eversong Forest'' in the infobox and displayed the corresponding citations under '''Endnotes'''. In this test, the citations referred to ''Tides of Darkness'' (2007), chapter 14, and ''Dark Factions'' (2008), pages 152–153. The screenshot also showed references to the same notes in the article body, producing multiple backlinks in the endnotes.
This alternative worked in the PHP 8.3.36 preview tests and continued to work after the MediaWiki 1.46.2 upgrade. Following the firewall fix, such rearrangement is no longer necessary for the successfully retested citations. The original testing did not establish the behaviour of every possible formatting combination.
 
===Reuse previously defined named references===


For example, the full citation definitions could be supplied in relevant article prose:
A further alternative, verified in '''Preview''' only, is to define the citation elsewhere on the page and insert a self-closing reference into the form field:


<pre>
<pre>
The earlier name is attested in the sources.<ref name="one">''[[Tides of Darkness]]'' (2007), ch. 14</ref><ref name="two">{{df}}, pp. 152–153</ref>
Eversong Forest<ref name="one" /><ref name="two" />
</pre>
</pre>


'''Limits of this test:''' Successful '''Preview''' is confirmed. Saving and reopening the form with these self-closing tags has not yet been independently verified. This alternative requires the matching full definitions to remain on the same page; removing or renaming a definition can leave an undefined named reference. Accordingly, <code>&#123;&#123;#tag:ref|...&#125;&#125;</code> remains the preferred workaround when a citation should be self-contained and local to the infobox field.
With the corresponding definitions present in the article, the preview displayed both reference numbers in the infobox and the full citations under '''Endnotes'''. The tested sources were ''Tides of Darkness'' (2007), chapter 14, and ''Dark Factions'' (2008), pages 152–153. This approach requires the named reference definitions to remain available, and saving and reopening were not independently verified.<ref>[https://www.mediawiki.org/wiki/Help:Cite MediaWiki: Help:Cite], section on reusing named references</ref>
 
==A distinct Cargo issue: UNIQ markers==


During the investigation, a separate problem was confirmed in the <code>Locations</code> Cargo table: the stored <code>Source</code> values for [[Kalidar]] and [[Nighthaven]] included internal reference placeholders such as <code>UNIQ--ref-00000008-QINU</code>, although the pages' raw wikitext contained valid <code>&lt;ref&gt;...&lt;/ref&gt;</code> citations.
==Separate Cargo issue: UNIQ markers==


The <code>Source</code> field is declared as <code>Wikitext</code>, whereas <code>Former_name</code> is declared as <code>Wikitext string</code>. These facts may matter to the parsing and storage behaviour, but the observations do not prove that field type is the cause of either problem.
During the same investigation, the <code>Locations</code> Cargo table was found to contain internal reference placeholders, including <code>UNIQ--ref-00000008-QINU</code>, in the stored <code>Source</code> values for [[Kalidar]] and [[Nighthaven]]. The raw page wikitext contained valid reference tags, and the pages could render normally.


'''Do not conflate the two symptoms.'''
This is '''a separate data-storage or parsing problem''', not evidence of a WAF block. The <code>Source</code> field is declared as <code>Wikitext</code>, whereas <code>Former_name</code> uses <code>Wikitext string</code>. Their differing types are relevant context but do not prove a cause.


* '''HTTP 500 on form preview/save:''' A request fails while processing a Page Forms edit containing a literal reference tag.
A January 2026 discussion on the MediaWiki website describes a similar UNIQ-marker problem as originating in Cargo's storage of partially parsed reference and <code>pre</code> content rather than Page Forms.<ref>[https://www.mediawiki.org/wiki/Extension_talk:Page_Forms#UNIQ...QINU_tag_problem_was_not_a_Page_Forms_problem MediaWiki: Extension talk:Page Forms], Jonathan3, 13 January 2026</ref>
* '''UNIQ markers in Cargo results:''' A page may render normally while Cargo stores or returns an internal parser placeholder instead of usable reference markup.


A January 2026 MediaWiki discussion specifically attributed a similar UNIQ-marker problem to Cargo's storage of partially parsed <code>ref</code> and <code>pre</code> content, correcting an earlier suspicion about Page Forms.<ref>[https://www.mediawiki.org/wiki/Extension_talk:Page_Forms#UNIQ...QINU_tag_problem_was_not_a_Page_Forms_problem MediaWiki: Extension talk:Page Forms], Jonathan3, 13 January 2026</ref>
The discovery of a ModSecurity block does not resolve this Cargo issue, which should be investigated independently if its stored values need to be queried or displayed.


No change to Cargo field declarations, infobox templates, or Page Forms settings was necessary to use the verified citation workaround.
==Related reports==


==Related reports and documentation==
Earlier discussions prompted the original suspicion of a Page Forms defect. They are useful background, but none is confirmed to describe the same hosting-level firewall issue:


The following material describes related difficulties, '''not confirmed duplicates''' of the current HTTP 500 failure:
* '''December 2014:''' A Semantic Forms user reported a literal reference in a textarea becoming a <code>UNIQ...ref...QINU</code> marker after saving, whereas direct editing worked.<ref>[https://www.mediawiki.org/wiki/Extension_talk:Page_Forms/Archive_September_to_December_2014 MediaWiki: Extension talk:Page Forms, September–December 2014 archive], section on references transformed into UNIQ markers (26–30 December 2014)</ref>
* '''2020:''' Page Forms 4.9 and 4.9.1 included improvements to handling XML-style tags and self-closing tags in template fields.<ref>[https://www.mediawiki.org/wiki/Extension:Page_Forms/Version_history MediaWiki: Extension:Page Forms/Version history], entries for versions 4.9 and 4.9.1</ref>
* '''July 2021:''' A MediaWiki support discussion recommended <code>#tag:ref</code> for a separate reference-expansion problem in templates, and the reporter confirmed that it worked.<ref>[https://www.mediawiki.org/wiki/Topic:Wc7wtiqcnn6u2y7q MediaWiki support desk, “Extension Cite: references-tag does not work in Templates for me”], 6–7 July 2021</ref>
* '''2025–2026:''' [https://phabricator.wikimedia.org/T406042 Phabricator T406042] described a different Page Forms HTTP 500 failure involving templates inside <code>pre</code> tags and memory exhaustion; it was resolved in March 2026.<ref>[https://phabricator.wikimedia.org/T406042 Wikimedia Phabricator T406042], history through March 2026</ref>


* '''December 2014:''' A Semantic Forms (the former name of Page Forms) user reported that a literal reference in a textarea became a <code>UNIQ...ref...QINU</code> marker after saving. Direct editing worked. Yaron Koren discussed the report, but no publicly documented resolution appears in that discussion.<ref>[https://www.mediawiki.org/wiki/Extension_talk:Page_Forms/Archive_September_to_December_2014 MediaWiki: Extension talk:Page Forms, September–December 2014 archive], section “&lt;ref&gt;&lt;/ref&gt; transformed to UNIQ…” (26–30 December 2014)</ref>
==Outcome and remaining questions==
* '''April–May 2020:''' Page Forms 4.9 improved handling of tags such as <code>nowiki</code> and <code>syntaxhighlight</code> in template fields. Version 4.9.1 specifically fixed handling of self-closing tags such as <code>&lt;ref /&gt;</code>. These release notes do not establish a fix for paired reference tags in the present environment.<ref>[https://www.mediawiki.org/wiki/Extension:Page_Forms/Version_history MediaWiki: Extension:Page Forms/Version history], entries for versions 4.9 and 4.9.1</ref>
* '''July 2021:''' A MediaWiki support discussion recommended <code>#tag:ref</code> to avoid a reference-expansion problem in templates; the original reporter confirmed that it worked.<ref>[https://www.mediawiki.org/wiki/Topic:Wc7wtiqcnn6u2y7q MediaWiki support desk: “Extension Cite: references-tag does not work in Templates for me”], 6–7 July 2021</ref>
* '''September 2025–March 2026:''' Wikimedia task [https://phabricator.wikimedia.org/T406042 T406042] reported a different Page Forms HTTP 500 failure involving templates inside <code>pre</code> tags and PHP memory exhaustion. A patch was merged in March 2026 and the task was subsequently marked resolved. It should not be assumed to fix this citation problem.<ref>[https://phabricator.wikimedia.org/T406042 Wikimedia Phabricator T406042], including its March 2026 event history</ref>


==Outstanding questions==
The Page Forms editing failure investigated here is '''resolved on Azeroth Gazetteer'''. The decisive evidence was an Apache ModSecurity log showing rule <code>942550</code> misclassifying valid wikitext, confirmation from DreamHost technical support, and successful citation editing after the rule was removed. A Page Forms defect report in Wikimedia Phabricator was therefore not submitted on the basis of these failures.


* Does the Cite extension have a distinct release or commit identifier relevant to the installation? [[Special:Version]] does not declare a Cite version; the other software versions have been recorded above.
Two qualifications remain. First, the differing results observed under PHP 8.4.27 and PHP 8.3.36 were not independently explained, and the original fifteen cases were not all repeated after the firewall change. Second, the '''Cargo UNIQ-marker issue''' is separate and has not been resolved by the firewall change. Neither qualification undermines the confirmed ModSecurity block or the successful local remediation.
* What PHP exception or fatal error causes the HTTP 500? The hosting panel's available logs did not establish this.
* Why did changing from PHP 8.4.27 to PHP 8.3.36 allow simple references while leaving more complex failures? Was PHP behaviour itself responsible, or did the runtime restart or another environmental difference contribute?
* Is the failure reproducible in a minimal Page Forms installation without Cargo, or is an extension interaction required?
* Can the newly isolated link-formatting/reference patterns be reproduced on a minimal Page Forms installation, and do they also fail in other input types or fields?
* Do the preview-tested self-closing named-reference tags and the reformatted wiki-link alternative survive '''Save''' and reopening the form?
* Does Cargo store reference text correctly when the corresponding page was saved through Page Forms using <code>#tag:ref</code>? Successful rendering alone does not establish correct Cargo storage.


The PHP 8.3.36 tests narrowed the failing combinations without establishing a root cause. Until the underlying error is identified, '''prefer the proven <code>#tag:ref</code> save-and-reopen workaround; treat the self-closing and link-label alternatives as preview-tested only, and avoid unnecessary modifications to the live Cargo schema or templates'''.
The practical lesson is to inspect web-server and WAF logs before concluding that complex wikitext has exposed a PHP or Page Forms bug. Legitimate markup can trigger generic security signatures, and a server-side rejection may appear in the browser as an application error.


==Endnotes==
==Endnotes==
<references />
<references />

Latest revision as of 9:18 AM, November 7, 2026

ModSecurity false positive affecting Page Forms documents a resolved ModSecurity false positive on Azeroth Gazetteer, hosted by DreamHost. Legitimate MediaWiki wikitext entered through the Page Forms extension, particularly citations combined with apostrophe-formatted wiki links, was mistaken for a possible SQL injection attempt. Page Forms previews or saves consequently appeared to fail with an internal server error. An Apache error log subsequently showed that the host's ModSecurity web application firewall (WAF) had rejected the request with HTTP 418.[1]

On 5 November 2026, DreamHost technical support confirmed that security rule 942550 was interfering with the requests and, with the site administrator's approval, removed the offending rule. The previously problematic citations then worked without further changes to MediaWiki, PHP, Page Forms, or Cargo. This before-and-after result, together with the server log, strongly supports the firewall rule as the cause of the observed editing failures. The precise scope of DreamHost's configuration change was not independently established; removing one detection rule should not be confused with disabling the entire WAF.

  • First documented: 5 November 2026
  • Status: Resolved on this installation after DreamHost removed ModSecurity rule 942550
  • Affected operation: Previewing or saving certain template-field content through Page Forms
  • Detection rule: 942550 (“JSON-Based SQL Injection”)
  • Blocking rule: 949110 (“Inbound Anomaly Score Exceeded”)
  • Recorded firewall response: HTTP 418, despite the browser's generic internal-error message
  • Earlier workarounds: {{#tag:ref|...}} and, for one tested pattern, placing italics inside a wiki link's display label

This was not established to be a defect in Page Forms, Cite, Cargo, or PHP. A separate Cargo issue involving stored UNIQ--ref...-QINU placeholders remains distinct from the firewall problem.

Software environment and chronology

The investigation and successful remediation took place on 5 November 2026. The following versions were confirmed locally:

Component Versions tested or installed
MediaWiki 1.45.3, subsequently upgraded to 1.46.2
PHP 8.4.27 initially; subsequently 8.3.36
Page Forms 6.0.11
Cargo 3.9.4
Cite Installed and functional; no numerical version declared in Special:Version

Under PHP 8.4.27, even a simple literal reference in the affected form field produced an apparent internal server error. Changing the host's PHP version to 8.3.36 allowed simple references to work, but more complex markup continued to fail. A controlled series of fifteen tests isolated combinations of references, wiki links, formatting, and ordering (documented below).

MediaWiki was then upgraded from 1.45.3 to 1.46.2, retaining PHP 8.3.36 and the reported Page Forms and Cargo versions. Ordinary source editing and article saving worked after the upgrade. However, the following Page Forms input still failed:

''[[Tides of Darkness]]''<ref>Test citation</ref>

The alternative [[Tides of Darkness|Tides of Darkness]] continued to work in the subsequent test. Updating MediaWiki therefore did not resolve the observed form-submission failure. The problem was subsequently resolved only after DreamHost changed the ModSecurity configuration.

Affected form and reproduction

The clearest case involves Blackened Woods, edited through Form:Location. The Former name(s) field is defined as:

{{{field|fname|input type=textarea|rows=2}}}

It supplies the fname parameter to Template:Locationbox, which both displays the text and stores it in Cargo as Former_name, declared as Wikitext string.

To reproduce the problem in the tested environment:

  1. Open Blackened Woods using Edit with form.
  2. Enter the test markup below into Former name(s).
  3. Select Preview or Save.
''[[Tides of Darkness]]''<ref>Test citation</ref>

Observed result before the firewall change: The request failed, while equivalent markup could be entered through the ordinary source editor. Removing the problematic markup or using one of the tested alternatives allowed the form operation to proceed. After DreamHost removed rule 942550, citation entry through Page Forms was reported to work normally. Not every one of the fifteen historical test combinations was individually retested after the change.

An earlier incident involved the citation for Falstad Wildhammer in the current-ruler information of Wildhammer Clan. The failures were therefore not confined to a single article, although the detailed reproduction tests were conducted using Form:Location.

Apache log evidence

After MediaWiki 1.46.2 had been installed and the failure reproduced, the site's Apache error log was inspected through SSH. Three entries at 12:48:05 on 5 November 2026 (server log time) identify a single blocked request to /mediawiki/index.php.

The relevant information, condensed from the log and with the client's IP address omitted, is:

ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:Locationbox[fname]:
''[[tidesofdarkness]]''<ref>testcitation</ref>"]

ModSecurity: Warning
[id "942550"] [msg "JSON-Based SQL Injection"]
[data "Matched Data: host found within ARGS:pf_free_text: ..."]

ModSecurity: Access denied with code 418 (phase 2)
[id "949110"]
[msg "Inbound Anomaly Score Exceeded (Total Score: 10)"]
[uri "/mediawiki/index.php"]

The rules were loaded from DreamHost's installation of the OWASP Core Rule Set. Rule 942550 matched two parameters in the same request: the location-infobox field (Locationbox[fname]) and the form's free-text field (pf_free_text). The latter contained existing page markup, including links and references. Rule 949110 then rejected the request when the inbound anomaly score reached 10.

The log establishes that the firewall rejected this legitimate editing request as a suspected SQL injection. It does not show a PHP exception or establish that MediaWiki reached the PHP code that would normally process the edit. Consequently, a PHP exception backtrace was not needed to explain this particular blocked request.

DreamHost documents that ModSecurity uses HTTP 418 for blocked requests, and that the resulting page may display the generic message “The server encountered an internal error or misconfiguration”. DreamHost also states that individual ModSecurity rules cannot be modified through .htaccess on its hosting service.[2]

Limits of the evidence: The log establishes why this transaction failed, and the successful test after DreamHost removed the offending rule strongly corroborates the diagnosis. It does not establish that every earlier failed test had precisely the same cause. Comparable firewall entries were not preserved here for the initial PHP 8.4.27 tests, so their differing apparent behaviour remains unexplained. Two rule matches occurred in the same request; the log alone does not show whether either parameter would have been sufficient to trigger a block independently.

Controlled tests under PHP 8.3.36

Before the firewall entries were discovered, fifteen Page Forms preview tests were conducted in the Former name(s) field while editing Blackened Woods. The following table records their historical results before the firewall change; “Fails” no longer describes the known current behaviour of the installation. Not every case was separately retested after remediation. These observations do not demonstrate a Page Forms parser defect.

Test Markup arrangement Preview result
1 Two consecutive plain <ref> elements Works
2 Italicised wiki link inside <ref>, followed by year and chapter Fails
3 {{df}} inside <ref> Works
4 Wiki link inside <ref>, without italics Works
5 Italicised plain text inside <ref>, without a wiki link Works
6 Italicised wiki link inside <ref>, without other citation text Fails
7 Italicised wiki link immediately before a plain reference Fails
8 Italicised wiki link alone, without any reference Works
9 Plain reference before italicised wiki link, separated by a space Works
10 Italicised wiki link before plain reference, separated by a space Fails
11 Plain reference immediately before italicised wiki link Works
12 Ordinary wiki link before plain reference Works
13 Italicised plain text before plain reference Works
14 Bold wiki link before plain reference Fails
15 Wiki link with an italicised display label before a plain reference Works

Representative examples are shown below.

Failed before remediation: an italicised wiki link inside the reference.

Eversong Forest<ref>''[[Tides of Darkness]]''</ref>

Failed before remediation: an italicised wiki link before the reference.

Eversong Forest ''[[Tides of Darkness]]'' <ref>Test citation</ref>

Failed before remediation: a bold wiki link before the reference.

Eversong Forest '''[[Tides of Darkness]]''' <ref>Test citation</ref>

Worked before remediation: the reference precedes the italicised link.

Eversong Forest<ref>Test citation</ref>''[[Tides of Darkness]]''

Worked before remediation: italics are placed inside the wiki link's display label.

Eversong Forest [[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>

The pre-remediation failures varied with the syntax and ordering of the submitted markup. The firewall finding supplies a strong explanation for the reproduced block: a generic attack-detection rule misclassified legitimate apostrophes, brackets, and other wikitext characters. The original tests did not measure individual ModSecurity rule scores, however; the table cannot establish precisely how each combination contributed to the blocking threshold.

Resolution by DreamHost

After the Apache log was examined, a support ticket was submitted to DreamHost identifying the domain, timestamp, endpoint /mediawiki/index.php, affected parameters Locationbox[fname] and pf_free_text, detection rule 942550, blocking rule 949110, HTTP 418 response, and the request identifier recorded in the log.

A DreamHost technician confirmed that rule 942550 was interfering with the requests and requested permission to remove it. The administrator approved the change. After the technician reported removing the offending rule, citations which had caused the Page Forms error worked normally. No further MediaWiki, PHP, Page Forms, or Cargo version changes were made between the logged failure and the successful retest.

This is a successful local remediation, not an assertion that every unrelated form error is caused by ModSecurity. The technician's message did not establish whether the rule removal was restricted to particular parameters or to the entire domain. The remaining WAF protections were stated to remain active.

Troubleshooting similar failures

For other site administrators encountering apparent HTTP 500 errors while submitting legitimate wikitext through Page Forms:

  1. Reproduce the problem using a harmless, identifiable example, and note the time of the request.
  2. Inspect the hosting provider's Apache or web application firewall error logs, if available. A visible “internal server error” does not establish that PHP threw an exception.
  3. Look for a ModSecurity entry containing the submitted text, an ARGS: parameter name, a detection-rule ID, a blocking-rule ID, and the request identifier.
  4. Where a false positive is demonstrated, contact the hosting provider with the matching evidence. Request the narrowest practicable rule or parameter exclusion rather than disabling the entire WAF.
  5. Repeat the same input after the provider's change and verify that the operation succeeds. Check the firewall log again if the problem continues.

On DreamHost, a blocked ModSecurity request may produce HTTP 418. DreamHost's documentation states that individual ModSecurity rule modifications are not supported through .htaccess; an administrator who needs a tailored exception should consult support.[1] Do not assume that every HTTP 500 response, or every Page Forms problem involving <ref>, is a firewall block.

Earlier workarounds

Construct the reference with #tag

Before the firewall issue was resolved, the most thoroughly tested workaround was MediaWiki's #tag parser function, which can construct a reference without placing a literal opening and closing ref tag directly in the affected input field.

Instead of:

Eversong Forest<ref>Citation text</ref>

Use:

Eversong Forest{{#tag:ref|Citation text}}

For a citation containing a template:

Eversong Forest{{#tag:ref|{{df}}, pp. 152–153}}

On Blackened Woods, the #tag:ref form rendered in preview, survived saving, remained intact when the page was reopened through Edit with form, and continued to preview normally. The method was also used to restore the Falstad Wildhammer citation in Wildhammer Clan. It uses standard MediaWiki parser-function syntax rather than a custom extension.[3]

With the ModSecurity false positive removed, this alternative is no longer required to avoid the documented failure. It remains valid MediaWiki syntax, but neither its general acceptance by WAFs nor equivalence of Cargo storage should be assumed.

Before remediation, replacing:

''[[Tides of Darkness]]''<ref>Test citation</ref>

with a wiki link whose display text contains the italics avoided the failure:

[[Tides of Darkness|''Tides of Darkness'']] <ref>Test citation</ref>

This alternative worked in the PHP 8.3.36 preview tests and continued to work after the MediaWiki 1.46.2 upgrade. Following the firewall fix, such rearrangement is no longer necessary for the successfully retested citations. The original testing did not establish the behaviour of every possible formatting combination.

Reuse previously defined named references

A further alternative, verified in Preview only, is to define the citation elsewhere on the page and insert a self-closing reference into the form field:

Eversong Forest<ref name="one" /><ref name="two" />

With the corresponding definitions present in the article, the preview displayed both reference numbers in the infobox and the full citations under Endnotes. The tested sources were Tides of Darkness (2007), chapter 14, and Dark Factions (2008), pages 152–153. This approach requires the named reference definitions to remain available, and saving and reopening were not independently verified.[4]

Separate Cargo issue: UNIQ markers

During the same investigation, the Locations Cargo table was found to contain internal reference placeholders, including UNIQ--ref-00000008-QINU, in the stored Source values for Kalidar and Nighthaven. The raw page wikitext contained valid reference tags, and the pages could render normally.

This is a separate data-storage or parsing problem, not evidence of a WAF block. The Source field is declared as Wikitext, whereas Former_name uses Wikitext string. Their differing types are relevant context but do not prove a cause.

A January 2026 discussion on the MediaWiki website describes a similar UNIQ-marker problem as originating in Cargo's storage of partially parsed reference and pre content rather than Page Forms.[5]

The discovery of a ModSecurity block does not resolve this Cargo issue, which should be investigated independently if its stored values need to be queried or displayed.

Earlier discussions prompted the original suspicion of a Page Forms defect. They are useful background, but none is confirmed to describe the same hosting-level firewall issue:

  • December 2014: A Semantic Forms user reported a literal reference in a textarea becoming a UNIQ...ref...QINU marker after saving, whereas direct editing worked.[6]
  • 2020: Page Forms 4.9 and 4.9.1 included improvements to handling XML-style tags and self-closing tags in template fields.[7]
  • July 2021: A MediaWiki support discussion recommended #tag:ref for a separate reference-expansion problem in templates, and the reporter confirmed that it worked.[8]
  • 2025–2026: Phabricator T406042 described a different Page Forms HTTP 500 failure involving templates inside pre tags and memory exhaustion; it was resolved in March 2026.[9]

Outcome and remaining questions

The Page Forms editing failure investigated here is resolved on Azeroth Gazetteer. The decisive evidence was an Apache ModSecurity log showing rule 942550 misclassifying valid wikitext, confirmation from DreamHost technical support, and successful citation editing after the rule was removed. A Page Forms defect report in Wikimedia Phabricator was therefore not submitted on the basis of these failures.

Two qualifications remain. First, the differing results observed under PHP 8.4.27 and PHP 8.3.36 were not independently explained, and the original fifteen cases were not all repeated after the firewall change. Second, the Cargo UNIQ-marker issue is separate and has not been resolved by the firewall change. Neither qualification undermines the confirmed ModSecurity block or the successful local remediation.

The practical lesson is to inspect web-server and WAF logs before concluding that complex wikitext has exposed a PHP or Page Forms bug. Legitimate markup can trigger generic security signatures, and a server-side rejection may appear in the browser as an application error.

Endnotes

  1. ↑ 1.0 1.1 DreamHost Knowledge Base, “Enabling the Web Application Firewall”, documentation of ModSecurity blocks and HTTP 418
  2. ↑ DreamHost Knowledge Base, “Enabling the Web Application Firewall”, sections on error responses and modifying rules
  3. ↑ MediaWiki: Help:Magic words, section on #tag; Help:XML-style tags
  4. ↑ MediaWiki: Help:Cite, section on reusing named references
  5. ↑ MediaWiki: Extension talk:Page Forms, Jonathan3, 13 January 2026
  6. ↑ MediaWiki: Extension talk:Page Forms, September–December 2014 archive, section on references transformed into UNIQ markers (26–30 December 2014)
  7. ↑ MediaWiki: Extension:Page Forms/Version history, entries for versions 4.9 and 4.9.1
  8. ↑ MediaWiki support desk, “Extension Cite: references-tag does not work in Templates for me”, 6–7 July 2021
  9. ↑ Wikimedia Phabricator T406042, history through March 2026