identity_authorized_for_scope? scans token table at RS time

オープン
#370 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
ruby

調査の方向性

Start in API::V1::ApplicationController and trace how the acting_as_program path resolves identity scopes and app grants. Then check the authorization flow that could capture or derive the scope set before this query runs. Done means this path checks the resolved scopes without scanning live tokens, while preserving delegation-specific authorization.

索引モデルが issue の本文から書いたものです。

説明

enhancement

problem

in API::V1::ApplicationController:

```ruby
def identity_authorized_for_scope?(identity, scope)
if current_identity
@current_token.scopes.include?(scope)
else
identity.access_tokens.to_a.any? { |t| t.active? && t.application_id == current_program.id && t.scopes.include?(scope) }
end
end
```

the `else` branch (program_key / acting_as_program path) loads all active tokens for an identity and scans them to check consent. the RS is reaching into the AS's token store to reconstruct authorization decisions at query time.

impact

  • with on-behalf-of, different delegation chains would be conflated
  • per-request token table scans add latency that grows with the number of active tokens

direction

the acting_as_program path should use a pre-resolved scope set per identity (captured at authorization time or derived from the app's grants), not scan live tokens.

主要言語
Ruby
スター
85
フォーク
72
平均マージ
3日 12時間
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hackclub/auth のほかの issue

hackclub/auth の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。