SafeWriter provides helper functions for use in implementations of SafeFormatter, to format mixes of safe and unsafe strings.
| 50 | // SafeWriter provides helper functions for use in implementations of |
| 51 | // SafeFormatter, to format mixes of safe and unsafe strings. |
| 52 | type SafeWriter interface { |
| 53 | // SafeString emits a safe string. |
| 54 | SafeString(SafeString) |
| 55 | |
| 56 | // SafeInt emits a safe integer. |
| 57 | SafeInt(SafeInt) |
| 58 | |
| 59 | // SafeUint emits a safe unsigned integer. |
| 60 | SafeUint(SafeUint) |
| 61 | |
| 62 | // SafeFloat emits a safe floating-point value. |
| 63 | SafeFloat(SafeFloat) |
| 64 | |
| 65 | // SafeRune emits a safe rune. |
| 66 | SafeRune(SafeRune) |
| 67 | |
| 68 | // SafeByte emits a safe byte. |
| 69 | SafeByte(SafeByte) |
| 70 | |
| 71 | // SafeBytes emits a safe byte slice. |
| 72 | SafeBytes(SafeBytes) |
| 73 | |
| 74 | // Print emits its arguments separated by spaces. |
| 75 | // For each argument it dynamically checks for the SafeFormatter or |
| 76 | // SafeValue interface and either use that, or mark the argument |
| 77 | // payload as unsafe. |
| 78 | Print(args ...interface{}) |
| 79 | |
| 80 | // For printf, a linter checks that the format string is |
| 81 | // a constant literal, so the implementation can assume it's always |
| 82 | // safe. |
| 83 | Printf(format string, arg ...interface{}) |
| 84 | |
| 85 | // UnsafeString writes an unsafe string. |
| 86 | UnsafeString(string) |
| 87 | |
| 88 | // UnsafeByte writes an unsafe byte. |
| 89 | UnsafeByte(byte) |
| 90 | |
| 91 | // UnsafeBytes writes an unsafe byte slice. |
| 92 | UnsafeBytes([]byte) |
| 93 | |
| 94 | // UnsafeRune writes an unsafe rune. |
| 95 | UnsafeRune(rune) |
| 96 | } |
| 97 | |
| 98 | // SafeString represents a string that is not a sensitive value. |
| 99 | type SafeString string |
no outgoing calls
no test coverage detected
searching dependent graphs…