| 22 | } |
| 23 | |
| 24 | static boolean shouldSkip(String line) { |
| 25 | if (line == null) { |
| 26 | return true; |
| 27 | } |
| 28 | String trimmed = line.trim(); |
| 29 | if (trimmed.isEmpty() || trimmed.length() > MAX_HISTORY_LINE_LENGTH) { |
| 30 | return true; |
| 31 | } |
| 32 | if (SECRET_ASSIGNMENT.matcher(trimmed).matches() || BASE64_IMAGE.matcher(trimmed).matches()) { |
| 33 | return true; |
| 34 | } |
| 35 | String lower = trimmed.toLowerCase(Locale.ROOT); |
| 36 | return lower.contains("bearer ") |
| 37 | || lower.contains("authorization:") |
| 38 | || lower.contains("-----begin ") |
| 39 | || lower.contains("private key"); |
| 40 | } |
| 41 | } |