Skip to content

revert: roll back issue #850 pg-plugin deploy copy and audit fail-open#640

Merged
Seechi-Yolo merged 2 commits into
mainfrom
revert/issue-850-partial
Jun 12, 2026
Merged

revert: roll back issue #850 pg-plugin deploy copy and audit fail-open#640
Seechi-Yolo merged 2 commits into
mainfrom
revert/issue-850-partial

Conversation

@LordofAvernus

@LordofAvernus LordofAvernus commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Revert 0a2a8cad — sql_workbench AuditMiddleware fail-open on auxiliary errors
  • Revert 34562a20 — copy sqle-pg-plugin binary into deploy artifact (compat-RISK-4)

Related: actiontech/dms-ee#850

Test plan

  • Verify SQL workbench streamExecute audit middleware behavior matches pre-#850
  • Verify RPM/build no longer copies sqle-pg-plugin into plugins directory
  • Regression smoke on ODC SQL console and PG datasource paths

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

错误处理变更

审计中间件在获取用户 ID、缓存映射、DBService 以及调用 SQLE 审核时,将原本容错放行(fail open)的逻辑修改为直接返回错误(fail closed)。这会在辅助路径遇到暂时性错误时阻断 SQL 执行,需要确认这种严格错误处理是否符合预期的业务场景,避免因偶发错误影响正常操作。

if err != nil {
	sqlWorkbenchService.log.Errorf("failed to get DMS user ID: %v", err)
	return errors.New(locale.Bundle.LocalizeMsgByCtx(c.Request().Context(), locale.SqlWorkbenchAuditGetDMSUserErr))
}

// 从缓存表获取 dms_db_service_id
dmsDBServiceID, err := sqlWorkbenchService.getDMSDBServiceIDFromCache(c.Request().Context(), datasourceID, dmsUserId)
if err != nil {
	sqlWorkbenchService.log.Errorf("failed to get dms_db_service_id from cache: %v", err)
	return errors.New(locale.Bundle.LocalizeMsgByCtx(c.Request().Context(), locale.SqlWorkbenchAuditGetDBServiceMappingErr))
}

if dmsDBServiceID == "" {
	sqlWorkbenchService.log.Debugf("dms_db_service_id not found in cache for datasource: %s", datasourceID)
	return errors.New(locale.Bundle.LocalizeMsgByCtx(c.Request().Context(), locale.SqlWorkbenchAuditDBServiceMappingNotFoundErr))
}

// 获取 DBService 信息
dbService, err := sqlWorkbenchService.dbServiceUsecase.GetDBService(c.Request().Context(), dmsDBServiceID)
if err != nil {
	sqlWorkbenchService.log.Errorf("failed to get DBService: %v", err)
	return errors.New(locale.Bundle.LocalizeMsgByCtx(c.Request().Context(), locale.SqlWorkbenchAuditGetDBServiceErr))
}

@github-actions

Copy link
Copy Markdown

PR Code Suggestions ✨

No code suggestions found for the PR.

@Seechi-Yolo Seechi-Yolo merged commit 309506e into main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants