Skip to content

Add AWS Comprehend prompt redaction utility#482

Open
josemariano-hub wants to merge 1 commit into
arakoodev:tsfrom
josemariano-hub:aws-comprehend-redaction
Open

Add AWS Comprehend prompt redaction utility#482
josemariano-hub wants to merge 1 commit into
arakoodev:tsfrom
josemariano-hub:aws-comprehend-redaction

Conversation

@josemariano-hub
Copy link
Copy Markdown

@josemariano-hub josemariano-hub commented May 11, 2026

Summary

  • add AwsComprehendRedactor for AWS Comprehend DetectPiiEntities without adding AWS SDK dependencies
  • expose helpers to redact raw prompts and chat options before chaining into existing AI endpoint calls
  • add unit coverage with mocked Comprehend responses
  • add a Jsonnet-based example showing PII redaction before an OpenAI call

/claim #290

Closes #290

Verification

  • npx vitest run awsComprehendRedactor.test.ts
  • npm run build

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38a49ee7d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +144 to +145
const canonicalHeaders = `content-type:application/x-amz-json-1.1\nhost:${host}\nx-amz-date:${amzDate}\nx-amz-target:${target}\n`;
const signedHeaders = "content-type;host;x-amz-date;x-amz-target";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include session token in SigV4 signed headers

When temporary AWS credentials are used (AWS_SESSION_TOKEN/sessionToken), this signer adds X-Amz-Security-Token to the outbound headers later but does not include it in canonicalHeaders/signedHeaders, so the computed signature no longer matches the actual request headers. In IAM role-based environments (Lambda/ECS/EKS/SSO), Comprehend calls can fail with signature/auth errors, which breaks redaction entirely for those deployments.

Useful? React with 👍 / 👎.

@josemariano-hub josemariano-hub force-pushed the aws-comprehend-redaction branch from 38a49ee to 672198b Compare May 11, 2026 20:10
@josemariano77
Copy link
Copy Markdown

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

@josemariano-hub josemariano-hub force-pushed the aws-comprehend-redaction branch from 672198b to 6d78117 Compare May 11, 2026 20:16
@josemariano-hub
Copy link
Copy Markdown
Author

recheck

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BOUNTY: integrate AWS Comprehend as a utility to redact data

2 participants