Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danbrooker/redact
Redact sensitive strings from your logs
https://github.com/danbrooker/redact
Last synced: about 1 month ago
JSON representation
Redact sensitive strings from your logs
- Host: GitHub
- URL: https://github.com/danbrooker/redact
- Owner: DanBrooker
- License: mit
- Created: 2014-03-27T10:03:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-27T10:16:03.000Z (over 10 years ago)
- Last Synced: 2024-10-18T19:29:39.822Z (2 months ago)
- Language: Objective-C
- Homepage:
- Size: 156 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Redact
[![Version](http://cocoapod-badges.herokuapp.com/v/redact/badge.png)](http://cocoadocs.org/docsets/redact)
[![Platform](http://cocoapod-badges.herokuapp.com/p/redact/badge.png)](http://cocoadocs.org/docsets/redact)Redact sensitive strings from your logs with `[obj redactedDescription]`, similar to Rails filter_parameters.
By default redacts the password property for dictionaries and basic key value styled logs.
Redact a dictionary
[@{@"password": "secret",@"username": @"user01"} redactedDescription]
-> {
password: [REDACTED];
username: "user01";
}Redact a string
[@"password = secret; username = user01" redactedDescription]
-> password = [REDACTED]; username = user01## Usage
#import "Redact.h"
Then use `[obj redactedDescription];`
or use RedactedLog() instead of NSLog() by adding one of the following macro sinto your .pch file
#define NSLog RedactedLogF // if you would like filename and function name
// or
#define NSLog RedactedLog // cleaner log and without any extra meta infoBy default `password` is a redacted key, but it's easy to add more.
[NCRedact addRedactedKey:@"secret_key"];
or use redact to trim your logs downNSString *path = [[NSBundle mainBundle] bundlePath];
[NCRedact addRedactedString:path with:@"[BUNDLE]"];## Tests
To run the test cases; clone the repo, and run `pod install` from the Example directory. Then open the workspace and run the tests.
## Installation
Redact is available through [CocoaPods](http://cocoapods.org), to install
it simply add the following line to your Podfile:pod "Redact"
## Author
Daniel Brooker, [email protected], @DraconisNZ
## License
Redact is available under the MIT license. See the LICENSE file for more info.