From 853a7cdcf10b357406f1125fd95a4bb4a99a594b Mon Sep 17 00:00:00 2001 From: xuans Date: Tue, 29 Sep 2026 22:41:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9D=83=E9=99=90=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E6=B5=8B=E8=AF=95=E4=BC=9A=E8=AF=9D=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将续期和阿里云 DNS 安全报告测试切换为超级管理员会话,匹配接口收紧后的权限边界。 --- backend/internal/httpapi/aliyun_scope_api_test.go | 2 +- backend/internal/httpapi/report_safety_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/internal/httpapi/aliyun_scope_api_test.go b/backend/internal/httpapi/aliyun_scope_api_test.go index 61e965b..173ea80 100644 --- a/backend/internal/httpapi/aliyun_scope_api_test.go +++ b/backend/internal/httpapi/aliyun_scope_api_test.go @@ -113,7 +113,7 @@ func TestAliyunDomainCheckUsesOnlyCurrentTargetAndProtectsPCUX(t *testing.T) { w := httptest.NewRecorder() body := strings.NewReader(`{"domain":"solit.cn"}`) req := httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", body) - serveAdminHTTP(server, w, req) + serveSuperAdminHTTP(server, w, req) if w.Code != http.StatusOK { t.Fatalf("POST check solit.cn status = %d; body=%s", w.Code, w.Body.String()) } diff --git a/backend/internal/httpapi/report_safety_test.go b/backend/internal/httpapi/report_safety_test.go index 4509cad..91295a8 100644 --- a/backend/internal/httpapi/report_safety_test.go +++ b/backend/internal/httpapi/report_safety_test.go @@ -20,7 +20,7 @@ func TestRenewalReportHidesNestedWorkflowErrors(t *testing.T) { }, }) response := httptest.NewRecorder() - serveAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/renewal/run", nil)) + serveSuperAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/renewal/run", nil)) if response.Code != http.StatusOK || strings.Contains(response.Body.String(), "internal-secret-sentinel") { t.Fatalf("续期报告不得返回底层敏感错误:%d", response.Code) } @@ -50,7 +50,7 @@ func TestAliyunReportHidesSDKErrorAndPreservesCleanupFailure(t *testing.T) { Secrets: &fakeSecretReaderStore{data: map[string]map[string]string{cfg.DNS.CredentialRef: {"access_key_id": "test-id", "access_key_secret": "test-secret", "managed_zones": "example.test", "allowed_domains": "example.test"}}}, }) response := httptest.NewRecorder() - serveAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", strings.NewReader(`{"domain":"example.test"}`))) + serveSuperAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", strings.NewReader(`{"domain":"example.test"}`))) body := response.Body.String() if response.Code != http.StatusOK || strings.Contains(body, "internal-secret-sentinel") { t.Fatalf("阿里云验证报告不得返回 SDK 敏感错误:%d", response.Code)