Skip to content

feat: integrate AWS Comprehend as a PII redaction utility (#290)#454

Open
tarai-dl wants to merge 1 commit intoarakoodev:tsfrom
tarai-dl:rn/aws-comprehend-pii-redactor
Open

feat: integrate AWS Comprehend as a PII redaction utility (#290)#454
tarai-dl wants to merge 1 commit intoarakoodev:tsfrom
tarai-dl:rn/aws-comprehend-pii-redactor

Conversation

@tarai-dl
Copy link
Copy Markdown

Summary

Integrates AWS Comprehend as a utility to redact PII (Personally Identifiable Information) from text, addressing bounty issue #290.

Changes

  • New module: @arakoodev/edgechains.js/redactor with ComprehendPiiRedactor class
  • PII detection: Uses AWS Comprehend DetectPiiEntities API to identify sensitive data
  • Multiple redaction modes: REPLACE_WITH_ENTITY_TYPE, REDACT, MASK_WITH_CHARACTER
  • Chainable API: Works as observable/middleware with existing Endpoint classes
  • 10 unit tests: Comprehensive test coverage with mocked AWS responses
  • Working example: Full demo in examples/pii-redactor/

Supported PII Types

NAME, EMAIL, PHONE, SSN, CREDIT_DEBIT_CARD_NUMBER, BANK_ACCOUNT_NUMBER, ADDRESS, DATE_OF_BIRTH, DRIVER_ID, PASSPORT_NUMBER, IP_ADDRESS

Usage

import { ComprehendPiiRedactor } from "@arakoodev/edgechains.js/redactor";

const redactor = new ComprehendPiiRedactor();

// Detect PII
const entities = await redactor.detectPiiEntities("My email is john@example.com");

// Redact PII
const result = await redactor.redact({
    text: "My name is John Smith",
    maskMode: "REPLACE_WITH_ENTITY_TYPE",
});

// Chain with LLM endpoint
const safeChat = redactor.chainWith(openai.chat.bind(openai));

Closes

Closes #290

Video Demo

A Loom video demonstrating the working example will be added once reviewed.

- Add ComprehendPiiRedactor class with PII detection and redaction
- Support multiple redaction modes (REPLACE_WITH_ENTITY_TYPE, REDACT, MASK_WITH_CHARACTER)
- Chainable with LLM endpoints as observable/middleware
- Add comprehensive test suite (10 tests)
- Add working example with multiple use cases
- Update README with documentation

Closes arakoodev#290
@github-actions
Copy link
Copy Markdown

CLA Assistant Lite bot: Thank you for your submission, we really appreciate it. Before we can accept your contribution, we ask that you sign the Arakoo Contributor License Agreement. You can sign the CLA by adding a new comment to this pull request and pasting exactly the following text.


I have read the Arakoo CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BOUNTY: integrate AWS Comprehend as a utility to redact data

1 participant