Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Namespace restriction for source= queries is inert: smwAskParserFunction/smwShowParserFunction hooks do not exist

Aperta
#45 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
php
Ambito
backend

Direzione di ricerca

Inizia in src/HookRegistry.php e ispeziona gli handler registrati smwAskParserFunction e smwShowParserFunction. Verifica se un hook supportato di Semantic MediaWiki può ispezionare o sovrascrivere le chiamate #ask e #show, quindi esamina HookRegistryTest.php. Il lavoro è completato quando la restrizione del namespace funziona tramite un percorso supportato, oppure quando gli handler inattivi e la documentazione sono aggiornati, con copertura di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

HookRegistry registers handlers for two hook names — smwAskParserFunction and smwShowParserFunction — that do not exist in Semantic MediaWiki. As a result, the feature they implement (restricting source= queries to $seqlgExternalQueryEnabledNamespaces) never runs.

Details

src/HookRegistry.php registers a handler under both names:

$this->handlers['smwAskParserFunction'] = $this->handlers['smwShowParserFunction'] = static function ( $parser, $frame, $args, &$override ) {
    // ... sets:
    //   $override = 'Warning: source parameter is not allowed in the namespace!'
    // when the page's namespace is not in $GLOBALS['seqlgExternalQueryEnabledNamespaces']
};

This only does anything if Semantic MediaWiki fires hooks literally named smwAskParserFunction / smwShowParserFunction. Those names appear nowhere in the Semantic MediaWiki source tree, nor anywhere in its Git history, so the handlers are never invoked. The #ask / #show execution path (AskParserFunction / ShowParserFunction) does not run a hook of that name.

Impact

The $seqlgExternalQueryEnabledNamespaces namespace restriction is silently inert: a {{#ask: … |source=… }} (or {{#show:}}) query is not blocked in disallowed namespaces, contrary to what the setting documents.

This is pre-existing (identical on the current released code and on the SMW 7.0 branch) and was discovered during the SMW 7.0 migration (#44). The test suite does not catch it because HookRegistryTest only asserts the InterwikiLoadPrefix handler is registered, not that the ask/show guard fires.

Suggested next steps

  • Confirm whether Semantic MediaWiki exposes an equivalent hook in a supported version that allows inspecting/overriding #ask / #show parser-function invocations, and rewire the namespace guard to it; or
  • If no such hook exists, remove the dead handlers and either implement the namespace restriction by another mechanism or update the $seqlgExternalQueryEnabledNamespaces documentation accordingly.
  • Add test coverage for whichever path is chosen so the guard cannot silently regress again.
Lingua principale
PHP
Stelle
9
Fork
8
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SemanticMediaWiki/SemanticExternalQueryLookup

Tutte le issue di SemanticMediaWiki/SemanticExternalQueryLookup

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.