fix: redact identity secrets through a public hook and mask issued agm_ tokens
ci / gitleaks (push) Successful in 8s
ci / docs-check (push) Failing after 30s
ci / lint (push) Successful in 42s
ci / test-integration (push) Successful in 46s
ci / security (push) Failing after 27s
ci / test-mcp (push) Successful in 1m16s
ci / test-unit (push) Successful in 2m17s
ci / build-and-push (push) Successful in 17s

Identity gains a redact field that the executor honours, so the OAuth
resolver no longer needs an executor subclass overriding private
internals. Opaque agm_ tokens issued by our authorization server are now
masked by the secret patterns wherever they appear in content.
This commit is contained in:
Latte committed 2026-10-14 16:45:36 +02:00
1 parent e02cede9f2
commit ce5ae6caa5
8 files changed
+37 -38

No files matched your search

+4
View File
@@ -23,11 +23,15 @@ class Identity:
mode: ``admin-token`` or ``oauth``.
token: Gitea token for this identity. Excluded from ``repr`` and never
part of :meth:`metadata`.
redact: Further secrets of this identity (for example the OAuth user's
Gitea refresh token) that the executor replaces in every result.
Excluded from ``repr`` and comparisons.
"""
login: str | None
mode: IdentityMode
token: str = field(repr=False)
redact: tuple[str, ...] = field(default=(), repr=False, compare=False)
def metadata(self, sudo: str | None = None) -> dict[str, Any]:
"""Return result and audit metadata: ``{"login", "mode", "sudo"}``, never the token."""