feat(integration-connector): 绑定参数映射与凭据 DB 加密落库模式
- 绑定新增 param_mapping_json:域参数→接口参数声明式映射(map_response 规范),空对象同名直通 - 凭据引用新增 db 维护模式:secret_ciphertext Fernet 加密落库,主密钥 INTEGRATION_CREDENTIAL_KEY 仅环境注入,与 env 引用模式并存 - 新增 credential_types 凭据形态注册表:代码注册各类型字段清单,UI 动态渲染与 API 组装校验的唯一事实来源 - 移除绑定 context_source_code 独立列,路由条件统一 context_selector_json - 管理端表单 Modal 重构为 Drawer,新增 JSON 编辑字段组件与页面级测试 - 迁移 rd1/re1 重挂当前唯一 head dd22ee33ff44,维持单 head 链 - settings 移除 IN_TRANSIT_TRANSFER_ERP_* 配置,外部端点/凭据移交连接器客户端实例管理
This commit is contained in:
1 parent
5df204fdea
commit
31591e663e
35 files changed
+4345
-750
No files matched your search
@@ -22,6 +22,7 @@ from sqlalchemy import (
|
||||
Integer,
|
||||
JSON,
|
||||
String,
|
||||
Text,
|
||||
UniqueConstraint,
|
||||
text,
|
||||
)
|
||||
@@ -41,7 +42,7 @@ CONTEXT_SELECTOR_JSON = JSON().with_variant(JSONB(), 'postgresql')
|
||||
|
||||
|
||||
class IntegrationCredentialReference(Base):
|
||||
"""凭据引用:只存 secret_ref 键 + 元数据,真实凭据由 Secret 服务注入,绝不落库明文。"""
|
||||
"""凭据引用:真实凭据加密落库(db 模式)或引用环境注入键(env 模式),绝不落库明文。"""
|
||||
|
||||
__tablename__ = 'integration_credential_references'
|
||||
__table_args__ = (
|
||||
@@ -55,6 +56,9 @@ class IntegrationCredentialReference(Base):
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
code: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
secret_ref: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
# db 模式:凭据 JSON(如 {"username","password"})的 Fernet 密文;主密钥由
|
||||
# INTEGRATION_CREDENTIAL_KEY 环境注入。env 模式为空。绝不回显、绝不写日志。
|
||||
secret_ciphertext: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
||||
secret_provider: Mapped[str] = mapped_column(String(32), nullable=False, default='env', server_default='env')
|
||||
credential_type: Mapped[str] = mapped_column(String(32), nullable=False, default='password', server_default='password')
|
||||
version: Mapped[int] = mapped_column(Integer, nullable=False, default=1, server_default=text('1'))
|
||||
@@ -159,9 +163,12 @@ class IntegrationBinding(Base):
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
capability: Mapped[str] = mapped_column(String(128), nullable=False)
|
||||
# 路由条件(来源/组织/租户等键值对;空对象 = 默认绑定):须为调用 context 的子集才命中。
|
||||
context_selector_json: Mapped[dict[str, Any]] = mapped_column(CONTEXT_SELECTOR_JSON, nullable=False, default=dict)
|
||||
# 最常用的 context 匹配键独立列(JSON 保留作兜底)。
|
||||
context_source_code: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
|
||||
# 域参数 → 接口参数的声明式映射(map_response 规范:{接口参数: {expr/template/transform/args}});
|
||||
# 空对象 = 域参数同名直通。结构属绑定(capability↔接口的翻译契约),不属接口定义。
|
||||
# 与 context_selector_json 同用 JSONB variant(PostgreSQL)保持表内 JSON 列类型一致。
|
||||
param_mapping_json: Mapped[dict[str, Any]] = mapped_column(CONTEXT_SELECTOR_JSON, nullable=False, default=dict)
|
||||
client_instance_code: Mapped[str] = mapped_column(
|
||||
ForeignKey('integration_client_instances.code'), nullable=False,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user