fix(security): harden secret redaction follow-ups for PR #1884
Restore PreserveIfRedacted merge on tenant KV PUT so Admin settings saves no longer overwrite stored secrets with placeholder values. Redact cross- tenant tenant listings, tighten Viewer MCP/model responses, and align init config frontend types with credentials metadata.
This commit is contained in:
+14
-12
@@ -890,7 +890,7 @@ func (h *TenantHandler) ListAllTenants(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"items": tenants,
|
||||
"items": dto.NewTenantResponsesCrossTenant(tenants),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -960,7 +960,7 @@ func (h *TenantHandler) SearchTenants(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"success": true,
|
||||
"data": gin.H{
|
||||
"items": tenants,
|
||||
"items": dto.NewTenantResponsesCrossTenant(tenants),
|
||||
"total": total,
|
||||
"page": page,
|
||||
"page_size": pageSize,
|
||||
@@ -1070,14 +1070,6 @@ func (h *TenantHandler) updateTenantWebSearchConfigInternal(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
cfg = *types.EffectiveWebSearchConfig(&cfg)
|
||||
|
||||
// Validate configuration
|
||||
if cfg.MaxResults < 1 || cfg.MaxResults > 50 {
|
||||
c.Error(errors.NewBadRequestError("max_results must be between 1 and 50"))
|
||||
return
|
||||
}
|
||||
|
||||
tenant, _ := types.TenantInfoFromContext(ctx)
|
||||
if tenant == nil {
|
||||
logger.Error(ctx, "Tenant is empty")
|
||||
@@ -1085,6 +1077,14 @@ func (h *TenantHandler) updateTenantWebSearchConfigInternal(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
cfg = *types.MergeWebSearchConfigForUpdate(&cfg, tenant.WebSearchConfig)
|
||||
|
||||
// Validate configuration
|
||||
if cfg.MaxResults < 1 || cfg.MaxResults > 50 {
|
||||
c.Error(errors.NewBadRequestError("max_results must be between 1 and 50"))
|
||||
return
|
||||
}
|
||||
|
||||
tenant.WebSearchConfig = &cfg
|
||||
updatedTenant, err := h.service.UpdateTenant(ctx, tenant)
|
||||
if err != nil {
|
||||
@@ -1167,7 +1167,8 @@ func (h *TenantHandler) updateTenantParserEngineConfigInternal(c *gin.Context) {
|
||||
c.Error(errors.NewBadRequestError("Tenant is empty"))
|
||||
return
|
||||
}
|
||||
tenant.ParserEngineConfig = &cfg
|
||||
merged := types.MergeParserEngineConfigForUpdate(&cfg, tenant.ParserEngineConfig)
|
||||
tenant.ParserEngineConfig = merged
|
||||
updatedTenant, err := h.service.UpdateTenant(ctx, tenant)
|
||||
if err != nil {
|
||||
if appErr, ok := errors.IsAppError(err); ok {
|
||||
@@ -1232,7 +1233,8 @@ func (h *TenantHandler) updateTenantStorageEngineConfigInternal(c *gin.Context)
|
||||
c.Error(errors.NewBadRequestError("Tenant is empty"))
|
||||
return
|
||||
}
|
||||
tenant.StorageEngineConfig = &cfg
|
||||
merged := types.MergeStorageEngineConfigForUpdate(&cfg, tenant.StorageEngineConfig)
|
||||
tenant.StorageEngineConfig = merged
|
||||
updatedTenant, err := h.service.UpdateTenant(ctx, tenant)
|
||||
if err != nil {
|
||||
if appErr, ok := errors.IsAppError(err); ok {
|
||||
|
||||
Reference in New Issue
Block a user