OAuth (bearer) quota check denies every user when the allowed-user list is empty
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 66/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c
- 領域
- authorization, backend
調査の方向性
scheduler/ipp.c の add_job() を開き、早期リターンと 3876〜3915 行付近の bearer 分岐を確認してから、3916 行のガード付き非 bearer 分岐と比較してください。バグは、許可ユーザーのリストが空のときにも bearer の比較が実行されるため、ジョブ数の上限が設定されたプリンターがすべての OAuth ユーザーを拒否してしまうことです。許可リストが空のとき、OAuth ユーザーが非 bearer の経路と同じように許可されれば完了です。確認方法として、ユーザーリストのないプリンターにジョブ上限を設定し、bearer 認証のジョブを送信してください。
索引モデルが issue の本文から書いたものです。
説明
Summary
Before checking the allowed-user list, add_job() returns early only when the list is empty and both quotas are zero. A printer that has a quota set therefore proceeds with an empty list. The non-bearer path then guards the comparison with cupsArrayCount(p->users), so an empty list means "no restriction". The bearer path does not guard it: the loop over the empty list leaves name as NULL, and the comparison at 3910 evaluates (name != NULL) == p->deny_users, which is true for the default allow-list, so every OAuth user is refused.
Affected code: scheduler/ipp.c:3876–3915, specifically the early-out at 3876–3877, the bearer branch at 3879, the unguarded comparison at 3910, and the guarded non-bearer branch at 3916. Unchanged in current master 3949d140567cf7b6cede1ea48e4ca6db92066c91.
Reachable rejection sequence
- A printer is configured with a quota, for example
lpadmin -p printer1 -o job-k-limit=100, and its allowed-user list is left empty — the ordinary way to mean "anyone may print". - The early-out at 3876 does not apply, because the quota is non-zero even though the list is empty.
cupsdDefaultAuthType()isCUPSD_AUTH_BEARER, so execution enters the branch at 3879.- The loop at 3885 does not execute, since
p->usersis empty;namekeeps itsNULLvalue. - Line 3910 evaluates
(0) == p->deny_users. With the list used as an allow-list,deny_usersis false, so the comparison is true and line 3913 refuses the job. - The same printer accepts the identical request over any non-bearer authentication path, because that branch is only entered when the list is non-empty (3916).
The result is that a quota-limited printer is unusable for OAuth users, and the log line reads "Denying user ... access to printer ...", which suggests an access-control decision rather than a missing empty-list case. Nothing is granted that should not be, so this is functional rather than a bypass.
Suggested fix
Guard the comparison the same way the non-bearer branch does.
- if ((name != NULL) == p->deny_users)
+ if (cupsArrayCount(p->users) > 0 && (name != NULL) == p->deny_users)
Two neighbouring issues in the same function, not worth separate reports but visible in the same code: at 4009–4021 a failed mbr_user_name_to_uuid() is logged and the loop continues to uuid_compare() with usr2_uuid unset on the first pass, where a continue is expected; and at 3967–3994 a failed group-name conversion does not clear grp_uuid before mbr_check_membership(), unlike the @# branch above it. Both compile only in HAVE_MBR_UID_TO_UUID builds.
- 主要言語
- C
- スター
- 1.8k
- フォーク
- 353
- 平均マージ
- 20時間 6分
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenPrinting/cups のほかの issue
-
Don't use xgettext sort option (-s) when generating POT file対応中かも @michaelrsweet が 16 日前に担当しました。 オープンinvestigating
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
OpenPrinting/cups#1721 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 15/100
OpenPrinting/cups#1804 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 20/100
OpenPrinting/cups#1802 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
OpenPrinting/cups#1796 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
OpenPrinting/cups#1786 ·
メンテナーはふだん 1 日以内に返信
OpenPrinting/cups の issue をすべて見る
似ている issue
-
luaebpf: the by-example page's intro names two outcomes of a lowering and omits the stop with the default verdict対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdocumentation severity: low
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
luainkernel/lunatik#2231 ·
メンテナーはふだん 1 日以内に返信
-
aspect ratio 16:10オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Revivedx/SavageWindRecomp#402 ·
メンテナーはふだん 1 日以内に返信
-
cleanup help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ESPresense/ESPresense#2602 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/arrow-swift#209 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
libretiny-eu/libretiny#435 ·
メンテナーはふだん 4 日以内に返信