#json-format #redact #sensitive #replacing #data #dynamic #redaction

redact-engine

Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format

3 releases

0.1.2 Oct 17, 2022
0.1.1 Oct 17, 2022
0.1.0 Oct 17, 2022

#2176 in Parser implementations

Download history 59/week @ 2024-01-15 3/week @ 2024-01-22 81/week @ 2024-02-19 299/week @ 2024-02-26 113/week @ 2024-03-04 22/week @ 2024-03-11 139/week @ 2024-03-25 282/week @ 2024-04-01

466 downloads per month

Apache-2.0

34KB
649 lines

redact-engine

Crates.io CI

Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format API Docs

Usage

Add this to Cargo.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)

Example:

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, 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.

To all Contributors - you make this happen, thanks!

contributing guide

Copyright

Copyright (c) 2022 @kaplanelad. See LICENSE for further details.


lib.rs:

Redact text

Protect confidentiality with dynamic redaction by replacing sensitive data from string or JSON format

Usecase

  • Redact sensitive information from a text file
  • Redact JSON schema by providing
    • By key
    • Prefix path
  • Integrate with env_logger

Usage


To see all code example

Dependencies

~4–5.5MB
~107K SLoC