更新权限回归测试会话角色
将续期和阿里云 DNS 安全报告测试切换为超级管理员会话,匹配接口收紧后的权限边界。
This commit is contained in:
parent
5a1c3dc678
commit
853a7cdcf1
@ -113,7 +113,7 @@ func TestAliyunDomainCheckUsesOnlyCurrentTargetAndProtectsPCUX(t *testing.T) {
|
|||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
body := strings.NewReader(`{"domain":"solit.cn"}`)
|
body := strings.NewReader(`{"domain":"solit.cn"}`)
|
||||||
req := httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", body)
|
req := httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", body)
|
||||||
serveAdminHTTP(server, w, req)
|
serveSuperAdminHTTP(server, w, req)
|
||||||
if w.Code != http.StatusOK {
|
if w.Code != http.StatusOK {
|
||||||
t.Fatalf("POST check solit.cn status = %d; body=%s", w.Code, w.Body.String())
|
t.Fatalf("POST check solit.cn status = %d; body=%s", w.Code, w.Body.String())
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,7 @@ func TestRenewalReportHidesNestedWorkflowErrors(t *testing.T) {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
response := httptest.NewRecorder()
|
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") {
|
if response.Code != http.StatusOK || strings.Contains(response.Body.String(), "internal-secret-sentinel") {
|
||||||
t.Fatalf("续期报告不得返回底层敏感错误:%d", response.Code)
|
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"}}},
|
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()
|
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()
|
body := response.Body.String()
|
||||||
if response.Code != http.StatusOK || strings.Contains(body, "internal-secret-sentinel") {
|
if response.Code != http.StatusOK || strings.Contains(body, "internal-secret-sentinel") {
|
||||||
t.Fatalf("阿里云验证报告不得返回 SDK 敏感错误:%d", response.Code)
|
t.Fatalf("阿里云验证报告不得返回 SDK 敏感错误:%d", response.Code)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user