Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import-annotation=no not working for subobjects #5598

Open
D-Groenewegen opened this issue Feb 5, 2024 · 1 comment
Open

import-annotation=no not working for subobjects #5598

D-Groenewegen opened this issue Feb 5, 2024 · 1 comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error

Comments

@D-Groenewegen
Copy link
Contributor

D-Groenewegen commented Feb 5, 2024

Setup

Current SMW sandbox:

  • SMW version: 4.1.2
  • MW version: 1.35.11
  • PHP version: 7.4.33
  • DB: 10.5.19-MariaDB-0+deb11u2
  • Elasticsearch 6.8.23

Also tested on MW 1.39.2 / SMW 4.1.1 / PHP 8.0.30 (litespeed) / MariaDB 10.6.16-MariaDB-0ubuntu0.22.04.1, which is what led me to reproduce the issue on SMW's Sandbox.

Issue

The import-annotation parameter (https://www.semantic-mediawiki.org/wiki/Help:Plainlist_format/parameter_import-annotation) was introduced to either disallow (default) or allow annotations on a result template to be applied to the page holding the plainlist query.

But tests show that at least subobject annotations on the template are applied regardless (I didn't test #set). I have tried using true/false instead as well as leaving out the parameter, but the annotations are set anyway.

Reproduced

References

@D-Groenewegen D-Groenewegen added the bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error label Feb 5, 2024
@D-Groenewegen
Copy link
Contributor Author

D-Groenewegen commented Feb 5, 2024

Notes

I did a minor test and can confirm that at least the SMW::off/SMW::on markers are placed:

  • ResultPrinter::handleNonFileResult(), where ( !$this->isHTML ) && ( $this->hasTemplates ), calls RecursiveTextProcessor::recursivePreprocess().
  • If import-annotation=no, then RecursiveTextProcessor::recursivePreprocess() returns: '[[SMW::off]]' . $this->parser->replaceVariables( $text ) . '[[SMW::on]]' (and goes for the other option if import-annotation=yes).

And yet subobjects are being set. Why?

The problem here I think is that the act of calling replaceVariables() is enough to trigger something in the parser that causes them to be set regardless. It loos like it invokes braceSubstitution(), which in turns invokes callParserFunction() and I guess that ParserFunctionFactory is the re-entry point from MW into SMW.

The markers don't have any impact on them because the damage is already done.

P. S. Are the on/pff markers Parsoid-proof ? In #4727 from 2020, about the removal of the InternalParseBeforeLinks hook, MWJames stated that "context that relies on those markers will be affected". If so, a redesign seems warranted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Occurrence of an unintended or unanticipated behaviour that causes a vulnerability or fatal error
Projects
None yet
Development

No branches or pull requests

1 participant