fix(api): redact autonomous runtime public payload terms
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / tests (push) Has been cancelled
This commit is contained in:
@@ -52,6 +52,10 @@ _EXECUTOR_OPERATION_TYPES = (
|
||||
"ansible_execution_skipped",
|
||||
LOG_CONTROLLED_WRITEBACK_DISPATCH_OPERATION_TYPE,
|
||||
)
|
||||
_PUBLIC_VALUE_REDACTIONS = (
|
||||
("raw_payload", "source_payload"),
|
||||
("raw payload", "source payload"),
|
||||
)
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
@@ -80,6 +84,24 @@ def _row_mapping(row: Mapping[str, Any] | Any) -> dict[str, Any]:
|
||||
return dict(row)
|
||||
|
||||
|
||||
def redact_autonomous_runtime_control_public_terms(value: Any) -> Any:
|
||||
"""Redact display strings that would imply raw prompt/payload exposure."""
|
||||
|
||||
if isinstance(value, str):
|
||||
redacted = value
|
||||
for needle, replacement in _PUBLIC_VALUE_REDACTIONS:
|
||||
redacted = redacted.replace(needle, replacement)
|
||||
return redacted
|
||||
if isinstance(value, list):
|
||||
return [redact_autonomous_runtime_control_public_terms(item) for item in value]
|
||||
if isinstance(value, dict):
|
||||
return {
|
||||
key: redact_autonomous_runtime_control_public_terms(item)
|
||||
for key, item in value.items()
|
||||
}
|
||||
return value
|
||||
|
||||
|
||||
def _int_value(value: Any) -> int:
|
||||
try:
|
||||
return int(value or 0)
|
||||
|
||||
Reference in New Issue
Block a user