Package com.scroogexhtml.converter
Class LogSafe
java.lang.Object
com.scroogexhtml.converter.LogSafe
Makes a value from the RTF input safe to put into a log message.
A value with CR / LF would split the log line, so that the rest of it
shows up as a separate, attacker-chosen entry on line-oriented log sinks
(log forging); other control characters can carry terminal escape
sequences. escape(String) writes them as visible escapes, escapes
the backslash itself so the result stays unambiguous, and truncates long
values.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intMaximum number of characters of the value that are logged. -
Method Summary
-
Field Details
-
MAX_LOGGED
public static final int MAX_LOGGEDMaximum number of characters of the value that are logged.- See Also:
-
-
Method Details
-
escape
- Parameters:
value- a value from the RTF input, or null- Returns:
- the value, truncated to
MAX_LOGGEDcharacters, with\as\\, CR / LF / TAB as\r/\n/\t, and every other control character (C0, DEL, C1) and the Unicode line / paragraph separators as\uXXXX
-