https://github.com/rusty-ferris-club/redact-engine
Protect confidentiality with dynamic redaction by replacing sensitive data.
https://github.com/rusty-ferris-club/redact-engine
redact redaction security sensetive-data
Last synced: 2 months ago
JSON representation
Protect confidentiality with dynamic redaction by replacing sensitive data.
- Host: GitHub
- URL: https://github.com/rusty-ferris-club/redact-engine
- Owner: rusty-ferris-club
- License: apache-2.0
- Created: 2022-10-07T06:06:05.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-16T08:11:26.000Z (almost 3 years ago)
- Last Synced: 2025-04-29T09:16:46.832Z (6 months ago)
- Topics: redact, redaction, security, sensetive-data
- Language: Rust
- Homepage:
- Size: 85 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# redact-engine
[](https://crates.io/crates/redact-engine)
[](https://github.com/rusty-ferris-club/redact-engine/actions/workflows/ci.yaml)Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format
[API Docs](https://docs.rs/redact-engine/0.1.0/redact_engine)
## Usage
Add this to Cargo.toml:
```toml
[dependencies]
redact-engine = { version = "0.1.2" }
```## Usecase
- Redact sensitive information from a text text file
- Redact JSON schema by providing
- By key
- Prefix path
- Redact logs (supporting [env_logger](./redact-engine//examples/logger/env-logger))## Example:
```rs
use text_redaction::{Pattern, Redaction};let text = "some string message that you want to redact: foo,bar";
let redaction = Redaction::new().add_value("foo")?;
let redacted_string = redaction.redact_str(text);// println!("{}", redacted_string);
// some string message that you want to redact: [TEXT_REDACTED],bar
```To see all code [example](./redact-engine/examples), run the command `cargo run --example`
## Supported features
- `redact-json` - Redact from JSON format
- `redact-info` - Return redact capture information (position and pattern ID)# Benchmark test
Redact type | function | Times | Size | Results
--- | ---| --- | --- | ---
Text | add_patterns | 1,000 | 70 chars | 29.016 µs |
Text | add_values | 1,000 | 70 chars | 27.881s µs |
Text | redact_reader | 1,000 | 70 chars | 117.75 µs |
Text | redact_str_with_info | 1,000 | 70 chars | 36.532 µs |
JSON | add_keys | 1,000 | 15 keys | 8.5483 µs |
JSON | add_paths | 1,000 | 15 keys | 7.0353 µs |
JSON | from_value | 1,000 | 15 keys | 8.7555 µs |# Contributing
We are accepting PRs. Feel free to [submit PRs](https://github.com/rusty-ferris-club/redact-engine/pulls).
To all [Contributors](https://github.com/rusty-ferris-club/redact-engine/graphs/contributors) - you make this happen, thanks!
[contributing guide](CONTRIBUTING.md)
# Copyright
Copyright (c) 2022 [@kaplanelad](https://github.com/kaplanelad). See [LICENSE](LICENSE) for further details.