fix(security): enforce resource isolation across API and hubs
This commit is contained in:
1 parent
21f0530b6c
commit
1cd4e2b4b5
39 files changed
+1081
-497
No files matched your search
@@ -89,13 +89,13 @@ public class SettingsController : ControllerBase
|
||||
public async Task<IActionResult> Create(
|
||||
[FromBody] CreateAppSettingRequest request, CancellationToken ct)
|
||||
{
|
||||
var command = new CreateAppSettingCommand(request.Key, request.Value, request.Category, request.Description, request.ValueType, request.AllowedValues);
|
||||
var command = new CreateAppSettingCommand(request.Key, request.Value, request.Category, request.Description, request.ValueType, request.AllowedValues, request.AgentScoped);
|
||||
var result = await _mediator.Send(command, ct);
|
||||
if (!result.IsSuccess)
|
||||
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
|
||||
|
||||
await _broadcast.NotifyGlobalSettingChanged(result.Data!.Key, result.Data.Value, ct);
|
||||
_logger.LogInformation("Created global setting {Key} = {Value}", result.Data.Key, RedactValue(result.Data.ValueType, result.Data.Value));
|
||||
_logger.LogInformation("Created global setting {Key}", result.Data!.Key);
|
||||
return Ok(result.Data);
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ public class SettingsController : ControllerBase
|
||||
public async Task<IActionResult> Update(
|
||||
string key, [FromBody] UpdateAppSettingRequest request, CancellationToken ct)
|
||||
{
|
||||
var command = new UpdateAppSettingCommand(key, request.Value, request.Description, request.Category, request.ValueType, request.AllowedValues);
|
||||
var command = new UpdateAppSettingCommand(key, request.Value, request.Description, request.Category, request.ValueType, request.AllowedValues, request.AgentScoped);
|
||||
var result = await _mediator.Send(command, ct);
|
||||
if (!result.IsSuccess)
|
||||
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
|
||||
|
||||
await _broadcast.NotifyGlobalSettingChanged(result.Data!.Key, result.Data.Value, ct);
|
||||
_logger.LogInformation("Updated global setting {Key} = {Value}", result.Data.Key, RedactValue(result.Data.ValueType, result.Data.Value));
|
||||
_logger.LogInformation("Updated global setting {Key}", result.Data!.Key);
|
||||
return Ok(result.Data);
|
||||
}
|
||||
|
||||
@@ -203,8 +203,7 @@ public class SettingsController : ControllerBase
|
||||
return StatusCode(result.StatusCode ?? 400, new { error = result.Error });
|
||||
|
||||
await _broadcast.NotifyAgentSettingChanged(agentId, result.Data!.Key, result.Data.Value, ct);
|
||||
_logger.LogInformation("Set agent override Agent={AgentId}, {Key} = {Value}",
|
||||
agentId, result.Data.Key, RedactValue(null, result.Data.Value, result.Data.Key));
|
||||
_logger.LogInformation("Set agent override Agent={AgentId}, {Key}", agentId, result.Data!.Key);
|
||||
return Ok(result.Data);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user