The following is in Java: 1: import java.util.logging.Logge…
The following is in Java: 1: import java.util.logging.Logger; 2: 3: public class SecurityAuditor { 4: private static final Logger logger = Logger.getLogger(“AuditLog”); 5: 6: /* eventId is untrusted input; ensure it is cleaned before use. */ 7: public void recordEvent(String eventId) { 8: if (eventId == null || eventId.isEmpty()) { 9: return;10: }11: String clean = eventId.trim().replace(“”, “”);12: String sanitized = clean.replace(“\””, “”).replace(“‘”, “”).replace(“&”, “”);13: if (sanitized.length() > 500) {14: sanitized = sanitized.substring(0, 500) + “…”;15: }16: logger.info(“Event processed: ” + sanitized);17: }18: }