ushka.guard.errors
The error raised when an untrusted value reaches a dangerous sink.
The message is written for two readers at once: a developer reading a
traceback, and a coding agent that has to fix the code on the next try. That
is why every error carries the sink, the source, a concrete fix and a stable
code, and why to_dict() exists.
class UnsafeValueError(Exception)
An Untrusted value was about to be used somewhere it could do harm.
Attributes
code | str | Stable identifier, e.g. |
sink | str | Where the value was going, e.g. |
source | str | Where the value came from, e.g. |
risk | str | The attack this prevents, e.g. |
fix | str | A concrete line of code that makes the call safe. |
to_dict(self) -> dict[str, Any]
A JSON-ready description, for tools and coding agents.