nodeSolidServer / nodeSolidServer/node-solid-server

authorize endpoint fails if public jwk doesn't include .alg

Aperta
#1,565 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
JavaScript
Stelle
1.8k
Fork
308
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

In the guide for the webid-oidc spec, the "Authorization Request" step describes the encoding of the request paramater.

This includes the public key of a JWK in the key field. I'm using a python tool to generate keys (jwcrypto), but when it generates a public key it doesn't include the "alg" field:

{
  "kty": "RSA",
  "n": "sezpNr99QA7xMqkNvpZamVDdkiAn_xvuH2H5nTFKYDKILny3a1hp2ULV2nvumiCt9IsxEuvPjAGRQsPMKwDkCjhzO70EoFyb2k2PzwBk_Fd37xNbl4Nrb4W9zK7Vff5vXmtBOFSSzsUdUf52zZMii7RZBcDQSLcmv63qV_NDpvGNOTadth1nbJhzMtQDQWBlWbClI8Z4R0fGgx7yhQvMqOl6vIlFfricBcoe2nopS51uUbsZSNSkTrGHCsBM_ggvVcWzFAvipkSsplEPhvdT1K7oC4Q6yNG6koPPajpxNnEw05Nh5YHIUcmhFKj76rqaCNtwBejYBxeQp2rwnLekKQ",
  "e": "AQAB"
}

According to the JWK spec, this parameter is optional: https://tools.ietf.org/html/rfc7517#section-4.4

When generating an authorization request, if the key doesn't include alg, node-solid server returns an error. The exception that causes this is:

normalizedAlgorithm = Error: undefined is not a supported algorithm
at SupportedAlgorithms.normalize (node_modules/@solid/jose/src/algorithms/SupportedAlgorithms.js:75:14)
at Function.importKey (node_modules/@solid/jose/src/jose/JWA.js:89:51)
at Function.importKey (node_modules/@solid/jose/src/jose/JWK.js:31:16)
at AuthenticationRequest.loadCnfKey (node_modules/@solid/oidc-op/src/handlers/AuthenticationRequest.js:212:16)
at node_modules/@solid/oidc-op/src/handlers/AuthenticationRequest.js:176:26

It seems that jose.JWA expects that the alg field exists: https://github.com/solid/jose/blob/71ebf31761002bcb18ce88e739a30a8a6459936f/src/jose/JWA.js#L89

I couldn't find any specific webid-oidc documentation that says that alg is required in this case. It might be nice for node-solid-server to return an explicit error message if a submitted key doesn't include it.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia da AuthenticationRequest.loadCnfKey in @solid/oidc-op e segui le chiamate a importKey attraverso @solid/jose/src/jose/JWK.js e JWA.js. Confronta il comportamento con la guida WebID-OIDC authorization-request e RFC 7517; il lavoro è completo quando il caso in cui alg è mancante ha un esito esplicito e appropriato per l'endpoint authorize.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, nodejs
Ambito
authentication, backend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.