Namespace restriction for source= queries is inert: smwAskParserFunction/smwShowParserFunction hooks do not exist
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu trong src/HookRegistry.php và kiểm tra các handler smwAskParserFunction và smwShowParserFunction đã đăng ký. Kiểm tra xem một hook được Semantic MediaWiki hỗ trợ có thể kiểm tra hoặc ghi đè các lệnh gọi #ask và #show hay không, sau đó xem lại HookRegistryTest.php. Công việc được xem là hoàn tất khi giới hạn namespace hoạt động thông qua một đường dẫn được hỗ trợ, hoặc các handler không còn được sử dụng và tài liệu được cập nhật, cùng với phạm vi kiểm thử hồi quy.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 9
- Fork
- 8
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SemanticMediaWiki/SemanticExternalQueryLookup
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Not working with SMW 4.xĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
SemanticMediaWiki/SemanticExternalQueryLookup#33 · 1 bình luận · 1 reaction ·
-
Use with private wikisĐang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
SemanticMediaWiki/SemanticExternalQueryLookup#28 · 6 bình luận ·
Tất cả issue của SemanticMediaWiki/SemanticExternalQueryLookup
Issue tương tự
-
FrameworkBundle SecurityBundle
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23277 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Sync EN] hard link does not need special permissionsCó thể đã có người làm @lacatoire đã nhận hôm nay. Đang mởsync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 4 ngày
-
feature-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
omegaup/omegaup#10323 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
-
bug mod:appointments
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
3pontos-tech/gil-benefits#303 ·