fix: redact stored webhook authorization headers and other secret fields by key name (SEC-02)
This commit is contained in:
1 parent
d5ca530db3
commit
5b622e64e2
4 files changed
+201
-2
No files matched your search
@@ -96,6 +96,14 @@ _SENSITIVE_BODY_KEYS = frozenset(
|
||||
)
|
||||
_MIN_SENSITIVE_VALUE_CHARS = 4
|
||||
|
||||
#: Response fields whose non-empty string values are replaced with ``[REDACTED]``
|
||||
#: in every result except those of credential-issuing operations (whose purpose
|
||||
#: is to return a credential). Gitea fills ``authorization_header`` on every
|
||||
#: webhook read, so a stored header would otherwise reach the model. Keep this
|
||||
#: next to :data:`_SENSITIVE_BODY_KEYS` so a new secret-bearing field is added
|
||||
#: in one place.
|
||||
SENSITIVE_RESPONSE_KEYS = _SENSITIVE_BODY_KEYS
|
||||
|
||||
|
||||
class ArgumentError(ValueError):
|
||||
"""An argument cannot be turned into a safe request (message never echoes the value)."""
|
||||
|
||||
Reference in new issue
Block a user