Skip to content

CC BY-NC-ND 4.0の文面を修正 - #1939

Open
nabeta wants to merge 1 commit into
RCOSDP:mainfrom
nabeta:fix-cc-by-nc-nd-txt
Open

nabeta wants to merge 1 commit into
RCOSDP:mainfrom
nabeta:fix-cc-by-nc-nd-txt

Conversation

@nabeta

@nabeta nabeta commented Oct 7, 2026 •

Copy link
Copy Markdown

概要 (Summary)

  • CC BY-NC-ND 4.0のライセンスの文面がCC BY-NC-SA 4.0のものになっていたのを修正しています。

関連Issue / チケット (Related Issues)

変更タイプ (Type of Change)

  • 🚀 新機能追加 (Feature)
  • 🐛 バグ修正 (Bug Fix)
  • 🔒 セキュリティ修正 (Security Fix)
  • 🚫 機能のクローズ・非公開化・削除 (Feature Deprecation/Disable)
  • ⚠️ 破壊的変更・データ移行を伴う修正 (Breaking Change / Migration)
  • 📚 仕様書・マニュアル・APIリストの更新 (Documentation)

🤖 0. CI 自動チェック (API Inventory Drift)

PR ごとに WEKO3 コンテナを起動し、url_map のダンプ・台帳との突き合わせ・変更行の
到達可否測定を自動実行する。結果は PR コメントと Actions の artifact
(api-inventory-summary) に出る。

このリポジトリは public のため、台帳もベースラインも同梱していない。
実データはプライベートリポジトリ RCOSDP/weko-secret にあり、CI は Secret 経由で取得する。
以降この文書では、そこを単にプライベートリポジトリと呼ぶ。

台帳はブランチごとに内容が違うため、CI は weko 側と同名のブランチを
プライベートリポジトリから探して使う(head → base → 既定ブランチ の順)。
採用されたブランチ名は PR コメントの冒頭に出るので、件数を読む前にそこを見ること。
対応ブランチが無い場合は既定ブランチと比較され、コメント冒頭に警告が出る。
その件数は当てにならないので、PASS でも「確認済み」と読まないこと。
詳細: tools/api-inventory/ci/README.md §3a

  • CI が PASS している、または FAIL の各項目に対処済み
    Secret (API_INVENTORY_REPO / API_INVENTORY_SSH_KEY) が未設定のリポジトリ、
    および fork からの PR では、このジョブは何もせずスキップされる。

API を追加・変更した場合(必須)

  • プライベートリポジトリ側の作業ブランチを、この PR のブランチと同名で切った
    この PR が fix/issue62569 → develop_v2.0.4 なら、プライベート側も
    fix/issue62569 → develop_v2.0.4。同名にしておけば台帳 PR が未マージでも
    CI がそれを見るので、2つの PR のマージ順を気にしなくてよい。
  • プライベートリポジトリの api_snapshot.json を更新し、対応する PR を出した
    bash export WEKO_API_INVENTORY_DIR=/path/to/weko-secret ./install.sh python3 tools/api-inventory/scripts/snapshot.py --out "$WEKO_API_INVENTORY_DIR/api_snapshot.json"
    更新しないと CI が落ちる。公開リポジトリのコード変更とは別の PRになる。
  • プライベートリポジトリの weko3_api_list_full.tsv に行を追加・更新し、
    build_checklist.py で 24 列版を再生成した(未収載だと reconcile が FAIL する)
  • 台帳・スナップショット・実測結果をこの公開リポジトリにコミットしていない
    (git status に *.tsv / api_snapshot.json が出ていないこと)

FAIL したときの対処(要約)

まず PR コメント冒頭の台帳ブランチを見る。警告が出ていれば、件数を追う前に
プライベートリポジトリ側の対応ブランチを用意すること(比較相手が違うので件数に意味がない)。

ジョブが落ちる条件は 3 つある。PR コメントのどのセクションに件数が出ているかで切り分ける。

落ちた場所 落ちる条件
ベースラインとの差分 (drift.md) G1〜G7 のいずれかに該当
台帳との突き合わせ (reconcile.md) A + B + C + D + E の合計が 1 件以上
変更行の到達可否測定 (probe) G8 / G9 に該当(結果は artifact に含めないので Actions のログで件数を見る)
検出 意味 対処
G1 / G2 新規経路に認証系デコレータが無い / 認証系デコレータが削除された 実装を直す。意図的な公開なら台帳に根拠を書いてベースライン更新
G3 認証・認可デコレータのコメントアウトが増えた 原則やり直し。残す場合は理由をコード中のコメントに明記する
G4 *_PERMISSION_FACTORY / CSRF 保護 等が危険側の値に変わった 原則やり直し
G5 ModelView の can_delete / can_export が False → True 意図的なら台帳の data_op を更新
G6 静的解析で属性が取れない経路が追加された 台帳に行を追加してレビューする(外部ライブラリ由来など)
G7 依存パッケージの更新で経路が増減した 増えた経路は台帳に追加。消えた経路は行を削除するか allow に登録
G8 台帳で data_op が作成/更新/削除の経路に、未認証で到達した 原則やり直し。意図的な公開なら台帳の根拠を更新。data_op の記載誤りなら台帳を直す
G9 台帳では遮断なのに実測で到達(認可の回帰) 原則やり直し
reconcile A / E 実機にあるが台帳に無い(A: URI 単位 / E: 同一 URI の endpoint 単位) 台帳に行を追加する
reconcile B 台帳にあるが実機の url_map に無い 理由を確認し、正当なら allow に登録する
reconcile C / D メソッド・app 列の記載誤り 台帳を実機に合わせる

reconcile B のうち、実機に存在しないことが正当な行(プラグイン未登録・config で無効等)は
プライベートリポジトリの reconcile_allow.json に理由付きで登録する。理由なしの登録は不可。
登録済みの行は B'(既知・許容)として集計され、E'(endpoint が実機に無い)と併せてゲート対象外になる。

W1〜W6 は WARN でゲートは通るが、レビューでは見ること
(ModelView の追加 / 実装本体の変化 / HTTP メソッド・URL の変化 / 監視対象 config の変化 /
依存パッケージの版の変化)。特に W6(依存の版)は、ベースラインを CI と異なる環境で作ると
毎回出続けて形骸化するため、ベースラインは install.sh で作った環境から生成する。

CI の出力は件数のみ。該当した経路名は Actions には出ないので、プライベートリポジトリ側の
完全版レポート(--summary-only なしで再実行したもの)で確認すること
(このリポジトリは public で、ログ・artifact・PR コメントは誰でも読めるため)。


🔒 1. セキュリティ & API アクセス制御チェック (必須)

認証・認可 (Authentication & Authorization)

  • 新規/変更された Blueprint・View・REST リソースに適切なデコレータ / Permission を設定している
    • 例: @login_required, @pass_record, need(...), Invenio Access Action
    • /api/* では Permission.require(http_exception=403) を使うこと。
      @login_required は API アプリに security.login が無いため 401 ではなく 500 になる
    • CI: G1 / G2 が自動検出(デコレータの有無・削除)
  • 状態変更・破壊的メソッド (POST / PUT / PATCH / DELETE) の権限が正しく制限されている
    • CI: G8 が変更行を未認証で実測(使い捨て環境なので --allow-writes 付きで
      GET / HEAD 以外も叩く)
  • 未ログイン(Anonymous)状態でアクセスした際、意図しないデータ取得・変更が拒絶される
    • CI: G8 / G9 が変更行を実測。ただし測定対象は変更行のみ、かつ既定プロファイルで
      起動した経路のみ。ワークフロー系など未解決プレースホルダの行は skip される
  • 認可を config の permission factory に委ねている場合、None で無効化していない
    • CI: G4 が *_PERMISSION_FACTORY 等を監視

機能クローズ・非公開化の場合 (Feature Disable)

  • UI(画面・ボタン)の非表示だけでなく、バックエンド API(ルーティング・View)も完全に遮断されている
  • 無効化状態で直接 API を叩いた場合、404 Not Found または 403 Forbidden が返ることを確認した

🧪 2. テストコード観点チェック (pytest / Invenio Test Suite)

権限・異常系テスト (Negative & Authorization Tests)

  • 未認証アクセス (Anonymous): トークン/セッションなしのリクエストで 401 Unauthorized または 403 Forbidden / 404 Not Found が返ることを検証するテストがある
  • 権限不足ユーザー (Forbidden): 閲覧権限のみのユーザーが更新/削除 API を叩いた際に 403 になるテストがある
  • 無効化/非公開機能の遮断テスト: 対象機能が無効化されている場合、エンドポイントが 404 / 403 を返すテストがある

境界値・入力バリデーションテスト (Boundary & Validation)

  • 不正なパラメータ(巨大ファイル、異常な MIME タイプ、無効な JSON/XML スキーマ、SQLi/XSS ペイロード等)で適切に 400 Bad Request / バリデーションエラーが返るテストがある

データ整合性・トランザクションテスト (Integrity & Rollback)

  • ファイルストレージ(S3/ローカル)書き込み失敗時や DB エラー時に、中途半端なレコードやゴミファイルが残らずロールバックされるテストがある

🛡️ 3. データ保護 & 破壊的変更防止チェック (Data Safety)

  • 物理削除・上書きの安全性:
    • ファイル・アイテム・メタデータの完全削除/置換処理に、意図しない一括削除や別レコードへの誤適用リスクがない
    • 論理削除、バージョン管理、バックアップ等のロールバック機構が考慮されている
  • トランザクション整合性:
    • DB 更新とストレージ操作がアトミックに管理されている

⚙️ 4. マイグレーション & システム影響チェック (Invenio / WEKO3 Stack)

データベース (DB / Alembic)

  • invenio alembic upgrade(適用)および downgrade(ロールバック)スクリプトを作成・検証した
  • 既存データに対する破壊的変更(カラム削除、型変更、NOT NULL 制約追加等)の移行スクリプト/データパッチを用意した

検索インデックス (Elasticsearch / OpenSearch)

  • マッピング定義変更の有無を確認した
  • インデックス再作成(Reindex)やエイリアス切り替え手順を準備・検証した

設定 & 非同期処理 (Config / Celery / Cache)

  • invenio.cfg / 環境変数のデフォルト値を設定した
  • Celery タスクのシグネチャ変更によるキュー滞留・不整合が発生しない
  • キャッシュ(Redis/Memcached)のパージが必要か確認した

📚 5. ドキュメント・仕様書更新チェック (weko-document)

  • API インベントリ: ツールは本リポジトリの tools/api-inventory/、
    台帳・調査記録はプライベートリポジトリ(public リポジトリには置かない)。
    §0 のチェック項目で対応済みなら、ここは確認のみ。
    • エンドポイントの追加・変更・廃止、メソッド、認証・認可要件、リクエスト/レスポンス仕様を更新した
    • 調査記録(weko3_api_auth_findings.md)もプライベートリポジトリに置く。台帳は二重管理しない
  • WEKO3 機能仕様書:
    • 対象機能の仕様追加・変更・クローズ(非公開化)内容を反映した
  • 各種マニュアル (管理者 / 利用者マニュアル):
    • 画面導線・操作手順・権限仕様の変更を反映した
  • 更新不要な場合(理由):

📋 6. 動作検証エビデンス (Verification Evidence)

テスト実行結果

cd modules/<対象モジュール> && pytest
# -> PASS

CI の成果物 (artifact: api-inventory-summary)

ファイル 内容
drift.md ベースラインとの差分(件数のみ)
reconcile.md 台帳と実機の突き合わせ(件数のみ)

明細(該当した経路名・実測結果)は公開できないため artifact に含めていない。
プライベートリポジトリ側で同じコマンドを --summary-only なしで実行して確認する。

手動で確認したこと

Summary by Sourcery

Correct the displayed Creative Commons BY-NC-ND 4.0 license wording throughout the application.

Bug Fixes:

  • Correct the Creative Commons BY-NC-ND 4.0 license text so it uses “NonCommercial-NoDerivatives” instead of the BY-NC-SA wording across application configuration and test fixtures.

Tests:

  • Update affected test expectations to match the corrected license text.

Summary by CodeRabbit

  • Bug Fixes
    • Corrected the description of the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 license across the application. It now identifies the license as “NoDerivatives” rather than “ShareAlike,” with the international license designation accurately reflected where applicable. This aligns the displayed license information in application settings and related screens.

@sourcery-ai

sourcery-ai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This bug fix aligns the displayed and configured CC BY-NC-ND 4.0 license text with its actual NoDerivatives terms, updating the central configuration and all corresponding test expectations and fixtures without changing the license URL or asset.

File-Level Changes

Change Details Files
Correct the Creative Commons license wording for the CC BY-NC-ND 4.0 license across runtime configuration and test fixtures.
  • Replace “NonCommercial-ShareAlike” with “NonCommercial-NoDerivatives” while retaining the existing image and URL.
  • Synchronize expected license dictionaries in module fixtures, utility tests, and Tavern configuration.
modules/invenio-resourcesyncserver/tests/conftest.py
modules/weko-index-tree/tests/conftest.py
modules/weko-items-ui/tests/test_utils.py
modules/weko-records-ui/weko_records_ui/config.py
modules/weko-search-ui/tests/conftest.py
modules/weko-theme/tests/conftest.py
modules/weko-workflow/tests/conftest.py
modules/weko-workspace/tests/conftest.py
scripts/instance.cfg
test/tavern/helper/config.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b96fab05-7bee-41df-95f8-120d0c370c06
📥 Commits

Reviewing files that changed from the base of the PR and between 5f4bef4 and 4b59ec6.

📒 Files selected for processing (10)
  • modules/invenio-resourcesyncserver/tests/conftest.py
  • modules/weko-index-tree/tests/conftest.py
  • modules/weko-items-ui/tests/test_utils.py
  • modules/weko-records-ui/weko_records_ui/config.py
  • modules/weko-search-ui/tests/conftest.py
  • modules/weko-theme/tests/conftest.py
  • modules/weko-workflow/tests/conftest.py
  • modules/weko-workspace/tests/conftest.py
  • scripts/instance.cfg
  • test/tavern/helper/config.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

License descriptions and related test expectations now identify the CC BY-NC-ND 4.0 license as NoDerivatives instead of ShareAlike. One test fixture’s sample-file path expression has a formatting-only change.

Changes

CC BY-NC-ND License Text Alignment

Layer / File(s) Summary
Update license descriptions and expectations
modules/invenio-resourcesyncserver/tests/conftest.py, modules/weko-index-tree/tests/conftest.py, modules/weko-items-ui/tests/test_utils.py, modules/weko-records-ui/weko_records_ui/config.py, modules/weko-search-ui/tests/conftest.py, modules/weko-theme/tests/conftest.py, modules/weko-workflow/tests/conftest.py, modules/weko-workspace/tests/conftest.py, scripts/instance.cfg, test/tavern/helper/config.py
License descriptions and test expectations change from ShareAlike to NoDerivatives. The sample-file path expression is unchanged; its closing-parenthesis placement is reformatted.

Priority: ➖ Normal

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: wei-kuochen

Merge Risk: ⚪ Minimal · up to 4b59e

The configured CC BY-NC-ND 4.0 text now identifies the license as NoDerivatives. No actionable merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely describes the correction to the CC BY-NC-ND 4.0 wording, which is the main change.
Description check ✅ Passed The description explains the incorrect license wording and identifies the change as a bug fix. It does not provide test results, manual verification, or a related issue, and several checklist items re…
Docstring Coverage ✅ Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 8 files. (2 skipped: 1 u…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

⚠️ This pull request shows signs of AI-generated slop (ai_padded_prose). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="modules/weko-items-ui/tests/test_utils.py" line_range="7720" />
<code_context>
                 "href_pdf": "http://creativecommons.org/licenses/by-nc-nd/4.0/",
                 "txt": "This work is licensed under a Creative Commons Attribution"
-                "-NonCommercial-ShareAlike 4.0 International License.",
+                "-NonCommercial-NoDerivatives 4.0 International License.",
             },
         ],
</code_context>
<issue_to_address>
**License wording is not tested**

When the application’s default BY-NC-ND text is still the BY-NC-SA wording, `test_make_stats_file`, `test_make_stats_file_issue33432`, and `test_make_stats_file_issue36234` set this text in their own app config, then assert `make_stats_file` results. The function does not read this config key, so those assertions still pass if the application’s actual default wording is wrong.

Add an assertion that checks the application’s configured BY-NC-ND text rather than only assigning it in test setup.

Also at `modules/weko-items-ui/tests/test_utils.py:8112`, `modules/weko-items-ui/tests/test_utils.py:8311`.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: modules/weko-items-ui/tests/test_utils.py:7720


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

"href_pdf": "http://creativecommons.org/licenses/by-nc-nd/4.0/",
"txt": "This work is licensed under a Creative Commons Attribution"
"-NonCommercial-ShareAlike 4.0 International License.",
"-NonCommercial-NoDerivatives 4.0 International License.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · License wording is not tested

When the application’s default BY-NC-ND text is still the BY-NC-SA wording, test_make_stats_file, test_make_stats_file_issue33432, and test_make_stats_file_issue36234 set this text in their own app config, then assert make_stats_file results. The function does not read this config key, so those assertions still pass if the application’s actual default wording is wrong.

Add an assertion that checks the application’s configured BY-NC-ND text rather than only assigning it in test setup.

Also at modules/weko-items-ui/tests/test_utils.py:8112, modules/weko-items-ui/tests/test_utils.py:8311.

Prompt for AI agents
In `modules/weko-items-ui/tests/test_utils.py` at line 7720:

**License wording is not tested**

When the application’s default BY-NC-ND text is still the BY-NC-SA wording, `test_make_stats_file`, `test_make_stats_file_issue33432`, and `test_make_stats_file_issue36234` set this text in their own app config, then assert `make_stats_file` results. The function does not read this config key, so those assertions still pass if the application’s actual default wording is wrong.

Add an assertion that checks the application’s configured BY-NC-ND text rather than only assigning it in test setup.

Also at `modules/weko-items-ui/tests/test_utils.py:8112`, `modules/weko-items-ui/tests/test_utils.py:8311`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant