已关闭
[Bug]: gs_guc 无法设置包含 & 或 ; 的 KMS URL #8484
Wwwing301创建于  12 天前关闭于  5 天前
Wwwing301
12 天前 创建

测试类型

工具功能,安全

测试版本

6.0.0

问题描述

服务端允许 transparent_encrypt_kms_url 使用 RFC3986 URL 中的 &;,但gs_guc 会把这两个字符当成 shell 特殊字符并拒绝。

因此,包含多个查询参数的 KMS URL,例如 ?x=1&y=2,无法通过 gs_guc 写入配置;工具端和服务端对同一参数的校验规则不一致。

操作系统和硬件信息

官方 CentOS 7 x86_64 工具包;测试宿主机为 Ubuntu 22.04.5 LTS x86_64。

测试环境

企业版单机

被测功能

使用 gs_guc set 设置 transparent_encrypt_kms_url

预置条件

  1. 解压官方 openGauss-Server-6.0.6-CentOS7-x86_64.tar.bz2
  2. 确认 gs_guc --version 输出 openGauss 6.0.6 build abb18fca
  3. 创建临时目录 /tmp/og22-data,其中包含一个空的 postgresql.conf

操作步骤

实际测试为官方 openGauss 6.0.6,build abb18fca
本次只运行官方 6.0.6 gs_guc,使用临时 postgresql.conf,没有启动数据库,也没有连接真实 KMS。

mkdir -p /tmp/og22-data

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c \
  "transparent_encrypt_kms_url='https://kms.example.test/v1/key?x=1'"

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c \
  "transparent_encrypt_kms_url='https://kms.example.test/v1/key?x=1&y=2'"

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c \
  "transparent_encrypt_kms_url='https://kms.example.test/v1/key;mode=test'"

示例使用保留域名 example.test,不需要真实 KMS。

预期输出

三个 URL 都应通过校验并写入配置;或者 gs_guc 应与服务端使用相同的 URL 校验规则。

实际输出

简单 URL 设置成功。包含 & 的 URL 返回 1:

ERROR: Invalid character '&' found in parameter value. Shell metacharacters are not allowed.

包含 ; 的 URL 也返回 1:

ERROR: Invalid character ';' found in parameter value. Shell metacharacters are not allowed.

两个失败用例都没有修改配置文件。

日志信息

没有服务端日志,因为没有启动数据库。测试结果 SHA-256:
64abe0757b64d6c8ec86130619a2ef899e43308c8e71ac1efd76ff06f55b776f

相关代码:

  • src/bin/gs_guc/cluster_guc.conf:610
  • src/bin/gs_guc/cluster_guc.cpp:4806-4891
  • src/common/backend/utils/misc/guc.cpp:4465-4477,15186-15204

提单组织

社区用户

测试代码

likedislike
opengauss_bot
opengauss_bot成员
12 天前 评论:

This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.

likedislike
opengauss_botopengauss_bot成员
12 天前 将 TestManager 设为负责人
opengauss_bot
opengauss_bot成员
12 天前 评论:

Welcome To openGauss Community

Hey @Wwwing301 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.

Contact Guide

If you have any questions, please contact the SIG: StorageEngine, AI, CM, CloudNative, SecurityTechnology, SQLEngine ,
and any of the maintainers: @CarrotGo, @chendong76, @chenxiaobin19, @congzhou2603, @dodders, @hwworkholic, @jemappellehc, @libiao2024, @muyulinzhong, @quemingjian, @shenzheng4, @shirley_zhengx, @superlchf, @totaj, @wlff234, @wofanzheng, @ywzq1161327784 ,
and any of the committers: @Igali, @bihua111, @cailei19, @h_ray, @levy53071, @libiao2024, @lihaixiao, @mrzack, @wangfeihuo, @wuyuechuan, @xiong_xjun, @zhangfengzhi123, @zhangxubo, @zhangzq131, @zjh_hw .

likedislike
opengauss_botopengauss_bot成员
12 天前 添加了label:sig/Tools
liuzhen001liuzhen001成员
12 天前 关联了看板:openGauss 7.0.0-LTS
shenzheng4shenzheng4成员
9 天前 关联了pull request:fix kms url check
shenzheng4shenzheng4成员
9 天前 移除了负责人 TestManager
opengauss_bot
opengauss_bot成员
9 天前 评论:

This issue requires an assignee. Since you haven't specified one, we've assigned TestManager as the default assignee for this issue.

likedislike
opengauss_botopengauss_bot成员
9 天前 将 TestManager 设为负责人
shenzheng4shenzheng4成员
9 天前 将 shenzheng4 设为负责人,移除负责人 TestManager
shenzheng4
shenzheng4成员
7 天前 评论:

B023版本自验证:三种设置方式都通过。
image.png

likedislike
shenzheng4shenzheng4成员
7 天前 issue状态由 待办的 改变为 待回归
sungang14
sungang14成员
5 天前 评论:

【回归人员】sungang14
【回归日期】2026.9.14
【回归版本】openGauss 7.0.0B023
【回归结论】通过
【回归步骤】

mkdir -p /tmp/og22-data

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c
"transparent_encrypt_kms_url='https://kms.example.test/v1/key?x=1'"

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c
"transparent_encrypt_kms_url='https://kms.example.test/v1/key?x=1&y=2'"

printf '# test\n' > /tmp/og22-data/postgresql.conf
gs_guc set -D /tmp/og22-data -c
"transparent_encrypt_kms_url='https://kms.example.test/v1/key;mode=test'"
image.png

likedislike
sungang14sungang14成员
5 天前 issue状态由 待回归 改变为 已验收
sungang14sungang14成员
5 天前 关闭了 issue