org.llm4s.security
Members list
Type members
Classlikes
Safety wrapper for user-supplied regex compilation and matching.
Safety wrapper for user-supplied regex compilation and matching.
ReDoS is mitigated by two complementary defences:
- A cheap pre-screen (safeCompile) rejects null/empty/oversized patterns and a set of well-known catastrophic-backtracking shapes before they are ever compiled.
- A hard execution bound (safeFind/safeMatches) caps the number of character accesses the backtracking engine may perform for a single match. Catastrophic backtracking explores an exponential number of paths, each of which reads characters, so a step ceiling deterministically bounds worst-case runtime - even for dangerous patterns the pre-screen misses - without relying on thread interruption or wall-clock timeouts.
The step bound is the real security boundary: any pattern that reaches the matching helpers is safe regardless of how it was constructed. The shape blocklist is only a fast early-reject and must not be relied on for safety.
NOTE: kept intentionally in sync with org.llm4s.runner.WorkspaceRegexSafetyManager, which duplicates this logic because the workspace runner module cannot depend on core. Changes to the heuristics or bounds here should be mirrored there.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
RegexSafetyManager.type
A credential. Its toString is ***, and its value is read only through reveal. Creating one registers the value with llm4s, which then removes it, by exact match, from the error messages, exchange logs and other diagnostic text llm4s builds (traces follow in a later release). Values under 8 characters are not registered (they would mask ordinary words). A null value is read as "": never registered, and revealed as "".
A credential. Its toString is ***, and its value is read only through reveal. Creating one registers the value with llm4s, which then removes it, by exact match, from the error messages, exchange logs and other diagnostic text llm4s builds (traces follow in a later release). Values under 8 characters are not registered (they would mask ordinary words). A null value is read as "": never registered, and revealed as "".
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any