nodeSolidServer / nodeSolidServer/node-solid-server

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

未关闭
#1,565 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
1.8k
派生
308
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 @solid/oidc-op 中的 AuthenticationRequest.loadCnfKey 开始,跟踪经过 @solid/jose/src/jose/JWK.js 和 JWA.js 的 importKey 调用。将其行为与 WebID-OIDC authorization-request 指南和 RFC 7517 进行比较;完成标准是缺少 alg 的情况对 authorize 端点有明确且适当的结果。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, nodejs
领域
authentication, backend
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。