Wikiインポート検証・タスク結果APIにADMIN権限チェックを追加 - #798
Open
NishikawaKoharu wants to merge 2 commits into
Open
NishikawaKoharu wants to merge 2 commits into
NishikawaKoharu wants to merge 2 commits into
Conversation
yacchin1205
requested changes
Sep 18, 2026
yacchin1205
left a comment
There was a problem hiding this comment.
Redmine 62777 にコメントしました。ご確認ください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Harden authorization on Wiki import-related APIs so that unauthenticated users and non-admin contributors cannot start import validation or retrieve async task results.
Previously,
project_wiki_validate_for_importandproject_get_task_resultdid not require ADMIN permission (and the validate endpoint lacked registration/addon checks aligned with the production import API). This could allow unauthorized callers to obtain a task ID or read Celery task results.This PR requires ADMIN for both endpoints and aligns decorator checks with the existing import API.
Changes
@must_have_permission(ADMIN),@must_not_be_registration, and@must_have_addon('wiki', 'node')toproject_wiki_validate_for_import@must_have_permission(ADMIN)and@must_not_be_registrationtoproject_get_task_resultauthwhere neededReview follow-ups:
task_idto the node viaWikiImportTaskwhen starting the taskproject_get_task_resultwith 404 unless thetask_idbelongs to the requested node (prevents reading other projects' Wiki results or unrelated Celery results such as WEKO deposit)process_endso they do not affect importing UI / abort / concurrent-import checkstaskIdto avoid a race with pollingtask_idrejectionQA Notes
GET /api/v1/project/<pid>/wiki/import/<dir_id>/validate/→ expect 401GET /api/v1/project/<pid>/wiki/get_task_result/<task_id>/→ expect 401POST /api/v1/project/<pid>/wiki/import/<dir_id>/→ expect 401 (unchanged baseline)Documentation
No documentation updates required.
Side Effects
Unauthenticated or non-ADMIN callers can no longer start validation or poll task results. ADMIN users are unaffected aside from the intended permission enforcement.
Ticket
https://redmine.devops.rcos.nii.ac.jp/issues/62776
https://redmine.devops.rcos.nii.ac.jp/issues/62777