bug(website): legacyCardCodeFix corrupts Digital Benefits Deck (dbd) SCOPE (SCO*) and CORNUCOPIA (COR*) card codes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript, yaml
- 領域
- backend
調査の方向性
Read the four listed +page.server.ts route loaders and legacyCardCodeFix, then compare their lookup flow with source/dbd-cards-1.0-en.yaml and the dbd entry in cornucopia.owasp.org/application.yaml. Check how existing card IDs and legacy webapp codes are resolved. Done means the listed SCOPE and CORNUCOPIA IDs resolve correctly and regression tests cover the behavior.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
In cornucopia.owasp.org, all four card route server loaders apply legacyCardCodeFix unconditionally before looking up a card in the deck:
cornucopia.owasp.org/src/routes/cards/[card]/+page.server.ts(lines 19, 58–64)cornucopia.owasp.org/src/routes/edition/[edition]/[card]/+page.server.ts(lines 24, 59–61)cornucopia.owasp.org/src/routes/edition/[edition]/[card]/[version]/+page.server.ts(lines 28, 67–69)cornucopia.owasp.org/src/routes/edition/[edition]/[card]/[version]/[lang]/+page.server.ts(lines 28, 66–68)
function legacyCardCodeFix(card: string) {
return card
.replace("COM", "CM")
.replace("CO", "C")
.replace("DVE", "VE")
.replace("AC", "AT");
}
Because .replace("CO", "C") performs an unanchored substring replacement on every card ID across all editions, it corrupts all 26 cards in the SCOPE (SCO2–SCOA) and CORNUCOPIA (COR2–CORA) suits of the Digital Benefits Deck (dbd, configured in cornucopia.owasp.org/application.yaml and source/dbd-cards-1.0-en.yaml):
SCO2–SCOAare rewritten toSC2–SCA(e.g."SCO2".replace("CO", "C") === "SC2"), which do not exist indbdor any other deck. Visiting/cards/SCO2throws an HTTP404, and visiting/edition/dbd/SCO2,/edition/dbd/SCO2/1.0, or/edition/dbd/SCO2/1.0/enfails to find the card incards(cardisundefined, renderingCardNotFound).COR2–CORAare rewritten toCR2–CRA(e.g."COR2".replace("CO", "C") === "CR2"). Visiting/edition/dbd/COR2fails to resolve thedbdcard, and visiting/cards/COR2silently resolves to thewebappedition's CryptographyCR2card instead ofdbd'sCOR2card.
Proof / Reproduction
Running against source/dbd-cards-1.0-en.yaml (where SCOPE has IDs SCO2–SCOA and CORNUCOPIA has IDs COR2–CORA):
Input card ID: "SCO2" -> legacyCardCodeFix("SCO2") => "SC2" (cards.get("SC2") === undefined in dbd and all decks -> 404 / CardNotFound)
Input card ID: "COR2" -> legacyCardCodeFix("COR2") => "CR2" (cards.get("CR2") === undefined in dbd; resolves to webapp CR2 on /cards/COR2)
All 26 affected card IDs in source/dbd-cards-1.0-en.yaml:
SCO2, SCO3, SCO4, SCO5, SCO6, SCO7, SCO8, SCO9, SCOX, SCOJ, SCOQ, SCOK, SCOA, COR2, COR3, COR4, COR5, COR6, COR7, COR8, COR9, CORX, CORJ, CORQ, CORK, CORA.
Expected Behavior
legacyCardCodeFix should only map legacy webapp card prefixes (COM, CO, DVE, AC at the start of the code when the raw card code is not present in the target cards map, or only when ^(COM|CO|DVE|AC)(10|[2-9XJQKA])$ matches) so valid dbd card codes (SCO*, COR*) are not corrupted.
Hi @sydseter, could you please assign this issue to me? I'd be happy to submit a PR fixing this with unit tests.
- 主要言語
- Python
- スター
- 158
- フォーク
- 110
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 115
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OWASP/cornucopia のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
OWASP/cornucopia#3778 ·
メンテナーはふだん 1 日以内に返信
-
Upgrade @vitest/mocker from 4.1.10 to 5.0再び着手できるかも @Mahaboobunnisa123 が 43 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンhelp wanted javascript
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OWASP/cornucopia#3538 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 55/100
OWASP/cornucopia#3783 ·
メンテナーはふだん 1 日以内に返信
-
Add the Hindi translation for the Companion Edition対応中かも @V-2007-P が 2 日前に担当しました。 オープン
OWASP/cornucopia#3770 · コメント 6 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
bug(copi): next_round and toggle_continue_vote can be triggered on unstarted or finished games対応中かも @Abhrant-Singh が 3 日前に担当しました。 オープン
OWASP/cornucopia#3762 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
OWASP/cornucopia の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
AI bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
btclib-org/btclib-wallet#872 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme load対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
saltstack/salt#70789 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 87/100
btclib-org/btclib#3093 ·
メンテナーはふだん 1 日以内に返信