uniqc.gateway.redaction module

Redaction helpers for gateway API responses.

Task metadata / result payloads are free-form: callers may pass backend credentials, proxy configuration or other sensitive values at submission time, and they end up persisted on the task record. The gateway must never echo those back over the REST API, so API responses pass through redact_sensitive() before serialization. Only the response is scrubbed — the stored task record keeps the original data.

uniqc.gateway.redaction.redact_sensitive(value)[source]

Return a copy of value with sensitive dict entries redacted.

Recurses into nested dicts and lists; any dict entry whose key names a credential (token, api key, password, proxy, …) is replaced with REDACTED. Falsy values are left untouched so redaction never fabricates non-empty data.