identity_authorized_for_scope? scans token table at RS time

Abierto
#370 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
ruby

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Ruby
Estrellas
85
Forks
72
Merge medio
3 d 12 h
PR fusionados (30 d)
22

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hackclub/auth

Todos los issues de hackclub/auth

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.