`deck gateway validate` fails with unknown field `config.client_jwk[0].false` when OIDC client_jwk contains an unquoted n key

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
go
领域
cli

调研方向

从 deck gateway validate 入口开始,使用 issue 中的最小 YAML 重现该失败,重点关注 client_jwk 键的解析和验证方式。完成标准是:未加引号的 n 被作为 JWK 字段处理,而不是被报告为 false,并且有一个回归测试覆盖该示例。

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

描述

Description

When validating a decK YAML file that contains an OpenID Connect plugin configuration with client_jwk, deck gateway validate --verbose 9 fails with the following error:

{
  "code": 3,
  "details": [
    {
      "@type": "type.googleapis.com/kong.admin.model.v1.ErrorDetail",
      "field": "config.client_jwk[0].false",
      "messages": ["unknown field"],
      "type": "ERROR_TYPE_FIELD"
    }
  ],
  "message": "validation error: unknown field"
}

The original YAML does not contain a false field.
It contains a JWK field named n, which is a standard RSA JWK parameter representing the modulus.

It looks like the YAML parser interprets the unquoted key n as the boolean value false, resulting in the field being sent or validated as:

false: <modulus value>

instead of:

n: <modulus value>

This is problematic because n is a valid JWK field and is required for RSA keys.

Minimal example

_format_version: "3.0"

plugins:
  - name: openid-connect
    config:
      client_id:
        - example-client
      client_jwk:
        - kty: RSA
          alg: RS256
          kid: example-key
          e: AQAB
          n: example-modulus-value

Actual behavior

Validation fails with:

{
  "field": "config.client_jwk[0].false",
  "messages": ["unknown field"]
}

Expected behavior

n should be treated as a string key, not as a boolean false.

The following should validate as a normal JWK field:

n: example-modulus-value

Alternatively, if decK requires quoting for YAML 1.1 compatibility, the error message should clearly indicate that the n key was interpreted as a boolean key and suggest quoting it:

"n": example-modulus-value

Workaround

Quoting the n field avoids the issue:

client_jwk:
  - kty: RSA
    alg: RS256
    kid: example-key
    e: AQAB
    "n": example-modulus-value

The y field should probably also be quoted for the same reason, since it may be interpreted as boolean true by YAML 1.1 parsers:

"y": null

It may also be safer to quote fields containing special characters, such as:

"x5t#S256": null

Why this matters

JWK uses short field names such as n, e, x, and y.
In particular, RSA JWKs commonly include n and e.

If decK accepts YAML as input for Kong configuration, JWK field names should be handled safely, or decK should provide a clearer validation error when YAML boolean key coercion occurs.

Environment

  • decK version: 1.64
  • Command: deck gateway validate kong.yaml
  • Plugin: openid-connect
  • Field: config.client_jwk
主要语言
Go
星标
507
派生
142
平均合并
1 天 15 小时
30 天内合并 PR
9

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

Kong/deck 的其他 Issue

查看 Kong/deck 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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