1- import Foundation
2-
3- // Be cautious about what information is included in crash logs in the first place, especially for apps dealing with highly sensitive data
1+ import Foundation'
42/**
5- * - Fixme: ⚠️️ add doc
3+ * Redacts sensitive information from a dictionary representing a crash log.
4+ * - Description: This function iterates over each key-value pair in the provided dictionary,
5+ * applying redaction to the value to remove sensitive information such as
6+ * emails, IP addresses, and other patterns defined in `redactionPatterns`.
7+ * It returns a new dictionary with the same keys but with redacted values.
8+ * - Note: Be cautious about what information is included in crash logs in the first place, especially for apps dealing with highly sensitive data
9+ * - Parameter crashLog: A dictionary representing the crash log, where keys are
10+ * identifiers and values are the corresponding log entries.
11+ * - Returns: A new dictionary with the same keys as the input `crashLog`, but
12+ * with each value redacted to remove sensitive information.
613 */
714public func redactSensitiveInfo( crashLog: [ String : String ] ) -> [ String : String ] {
815 return crashLog. mapValues { redactSensitiveInfo ( from: $0) }
916}
1017/**
1118 * Redacts sensitive information from a given log string.
12- *
13- * This function iterates over predefined patterns of sensitive data (like emails, IP addresses, etc.)
19+ * - Description: This function iterates over predefined patterns of sensitive data (like emails, IP addresses, etc.)
1420 * and replaces occurrences with a generic redacted message. This helps in ensuring that sensitive
1521 * information is not exposed in log outputs.
16- *
1722 * - Parameter log: The original log string containing potential sensitive information.
1823 * - Returns: A redacted version of the log string with sensitive information obscured.
1924 */
@@ -31,8 +36,7 @@ fileprivate func redactSensitiveInfo(from log: String) -> String {
3136}
3237/**
3338 * Enumerates patterns of sensitive data that need to be redacted from logs.
34- *
35- * This enum provides regular expressions for identifying sensitive information
39+ * - Description: This enum provides regular expressions for identifying sensitive information
3640 * in strings and specifies the replacement text for each type of sensitive data.
3741 * It supports redaction of emails, credit card numbers, IP addresses, authentication tokens,
3842 * private keys, public keys, seed phrases, and URLs with sensitive parameters.
@@ -72,8 +76,7 @@ public enum RedactionPattern: String, CaseIterable {
7276}
7377/**
7478 * A collection of all redaction patterns.
75- *
76- * This array contains all the cases of the `RedactionPattern` enum, which represent
79+ * - Description: This array contains all the cases of the `RedactionPattern` enum, which represent
7780 * different types of sensitive data that need to be redacted from logs.
7881 */
7982fileprivate let redactionPatterns : [ RedactionPattern ] = {
0 commit comments