Namespace restriction for source= queries is inert: smwAskParserFunction/smwShowParserFunction hooks do not exist
还没有人认领这个 Issue。
评估
调研方向
从 src/HookRegistry.php 开始,检查已注册的 smwAskParserFunction 和 smwShowParserFunction 处理器。确认受支持的 Semantic MediaWiki hook 是否可以检查或覆盖 #ask 和 #show 调用,然后查看 HookRegistryTest.php。通过受支持的路径使 namespace 限制生效,或更新无用的处理器和文档,并提供回归测试覆盖,即视为完成。
由索引模型根据 Issue 内容生成。
描述
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/#showparser-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
$seqlgExternalQueryEnabledNamespacesdocumentation accordingly. - Add test coverage for whichever path is chosen so the guard cannot silently regress again.
- 主要语言
- PHP
- 星标
- 9
- 派生
- 8
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
SemanticMediaWiki/SemanticExternalQueryLookup 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
bug
难度 3/5 1-2 天 新手友好度 45/100
SemanticMediaWiki/SemanticExternalQueryLookup#33 · 1 条评论 · 1 个 reaction ·
-
enhancement
难度 4/5 3-5 天 新手友好度 35/100
SemanticMediaWiki/SemanticExternalQueryLookup#28 · 6 条评论 ·
查看 SemanticMediaWiki/SemanticExternalQueryLookup 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 4 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 66/100
-
Adapter: Algolia Performance
难度 2/5 1-3 小时 新手友好度 62/100