
Building DemoSafe: A Human-Controlled Privacy Gate for Screenshots on AWS
DemoSafe is a human-controlled privacy gate that helps people detect and permanently redact sensitive information before sharing screenshots. This article explains how we combined Amazon Rekognition, AWS Lambda, API Gateway, Cognito, S3, DynamoDB, Amplify, CloudWatch, and a privacy-bounded Strands and Amazon Bedrock workflow to build secure, expiring, and revocable screenshot sharing.
Built for Bharat Builds: First Commit — a WeMakeDevs × AWS hackathon
Suggested tags: AWS, Serverless, Amazon Rekognition, Amazon Bedrock, Strands Agents, Responsible AI, Privacy, React, FastAPI
Live application: https://production.dx2z6eik8hnh4.amplifyapp.com
Source code: https://github.com/athrva6/demo-safe
Cover-image idea: A split-screen illustration showing a terminal screenshot before and after sensitive details are masked, with a small human-review checkpoint between them.
The screenshot looked harmless—until I noticed the secret
Developers, students, support teams, and creators share screenshots constantly. We add them to bug reports, tutorials, documentation, chats, and social posts because an image explains a problem faster than a paragraph.
But screenshots collect more context than we intend to share. A terminal can expose an API token. An AWS Console page can reveal an account ID or resource identifier. A support conversation can contain an email address, phone number, customer name, or unrelated notification.
The difficult part is that the person sharing the screenshot must notice every sensitive detail. Traditional image editors help only after the user has found the problem. Fully automatic redaction has the opposite weakness: false positives can destroy useful context, while false negatives can create dangerous confidence.
I built DemoSafe to add a deliberate privacy checkpoint between taking a screenshot and sharing it.
Its promise is simple:
Use AWS to suggest what may be sensitive, keep the human in control, permanently redact approved areas, and share only the reviewed copy.
What DemoSafe does
The complete workflow is:
- The user signs in and selects a PNG or JPEG screenshot.
- The browser previews the image locally.
- The user explicitly chooses whether to send it to AWS for scanning.
- Amazon Rekognition detects visible text and its bounding boxes.
- Deterministic rules identify supported categories such as email addresses, IP addresses, credentials, and AWS resource identifiers.
- DemoSafe places editable mask suggestions over those areas.
- A privacy-review workflow prioritizes the detected categories without receiving the screenshot or detected values.
- The user accepts, adjusts, removes, or adds masks.
- The browser renders a new flattened PNG with the selected pixels replaced.
- The reviewed image can be downloaded or shared through an expiring, owner-revocable link.
The user remains responsible for the final decision because OCR and pattern detection can miss information.
Add screenshot: DemoSafe editor showing a fictional terminal screenshot with suggested masks.
Architecture: give every component only what it needs
DemoSafe uses a serverless AWS architecture:
React + TypeScript on AWS Amplify | Amazon Cognito | Amazon API Gateway HTTP API | AWS Lambda + FastAPI / | \Rekognition Bedrock S3 + DynamoDB | Amazon CloudWatchAWS Amplify Hosting
AWS Amplify hosts the React and TypeScript single-page application. The frontend provides authentication, image preview, mask editing, PNG export, share management, and an AWS system-status page.
Amazon Cognito
Cognito provides registration and sign-in for the private workspace. API Gateway validates the access token before allowing scanning, agent review, share creation, listing, or revocation.
Amazon API Gateway and AWS Lambda
API Gateway exposes the HTTPS routes and forwards authenticated requests to a Python FastAPI application running on Lambda through Mangum. This keeps the backend serverless and allows it to scale without maintaining a permanent server.
Amazon Rekognition
When the user consents and selects Scan with AWS, Rekognition
DetectText returns text observations and geometry. DemoSafe then applies its own conservative rules to supported patterns. Rekognition locates text; it does not decide whether the image is safe to publish.Amazon S3 and DynamoDB
Only the final reviewed PNG is eligible for publishing. It is stored in a private S3 bucket with public access blocked and encrypted transport required. DynamoDB records the share token, verified owner, expiry time, and revocation state. Public viewers receive the active reviewed image through the API rather than through a public bucket.
AWS SAM, CloudFormation, and CloudWatch
AWS SAM defines the Cognito pool, API routes, Lambda function, IAM permissions, S3 bucket, DynamoDB table, and CloudWatch log group. CloudFormation makes the stack reproducible, while CloudWatch provides runtime evidence and helps diagnose sanitized backend failures.
A privacy boundary for the AI review
The most important design decision was separating detection from reasoning.
The agent does not inspect the screenshot. Rekognition and deterministic rules run first. Before requesting a review, the backend removes the detected values, rejects unknown labels, and converts the findings into category counts.
For example, the review input can contain:
Email address: 2Possible credential: 1AWS resource identifier: 3It does not contain the actual email address, token, account number, OCR text, filename, screenshot pixels, user identity, or share URL.
The open-source Strands Agents SDK loads a privacy-review skill and requests a structured result through Amazon Bedrock. The expected output is limited to:
- Overall risk level
- Prioritized categories already supplied by the detector
- Recommended review actions
- A short final visual checklist
The agent cannot access S3 or DynamoDB, change masks, create links, revoke shares, or publish an image. It advises; the person decides.
This boundary reduces the data sent to the model and prevents the agent from becoming an autonomous publishing system.
Designing an honest fallback
During deployment, the Bedrock request was temporarily blocked while the AWS account was being verified. Rekognition, Lambda, API Gateway, Cognito, S3, and DynamoDB were operational, but a successful health endpoint could not prove that a model inference had completed.
I had two choices: make the entire workflow fail, or pretend that a deterministic result came from AI. Both would be poor product decisions.
Instead, DemoSafe returns a clearly labelled deterministic category review when Bedrock is unavailable. The interface tells the user that the fallback is not model-generated. Mask editing, export, and sharing remain available, and the user still performs the final review.
This taught me that graceful degradation is also a responsible-AI feature. A fallback should preserve useful work without hiding what failed or overstating what the model did.
Permanent redaction instead of a visual overlay
A dark rectangle placed over an image in HTML is not necessarily a redaction. If the original pixels remain underneath or the annotation layer can be removed, the secret still exists.
DemoSafe uses the browser Canvas API to create a new PNG. The approved mask regions are drawn directly into the new image pixels. Image metadata is removed during normalization, and the original upload is not placed in the sharing bucket.
Users can also add manual masks for content OCR may miss, including browser tabs, notifications, faces, or organization-specific information.
Add before/after images: Use fictional information and show the original screenshot beside the flattened result.
Controlled sharing
Redaction solves only one part of the problem. A shared file can remain accessible long after it is needed.
DemoSafe therefore lets the owner choose a one-hour, 24-hour, or seven-day expiry. The owner can also revoke the link immediately from My shares. DynamoDB enforces expiry and revocation, while an S3 lifecycle rule removes old published images.
Anyone who obtains an active link can view the reviewed image until it expires or is revoked, so DemoSafe does not claim to provide digital-rights management. It also cannot recall a copy already downloaded by a recipient. These limitations are stated explicitly because privacy products should reduce the amount of trust they demand.
What I validated
The working release was checked through both automated and manual validation:
- 27 backend tests passed.
- The React production build completed successfully.
- Cognito registration and authenticated API access worked.
- Rekognition scanning completed through the deployed Lambda role.
- Manual mask editing and flattened PNG export worked.
- Expiring share creation, public viewing, listing, and revocation worked.
- The CloudFormation stack deployed successfully in
ap-south-1.
- The API health route and CloudWatch logs provided runtime evidence.
- Direct single-page application routes were configured to open correctly through Amplify.
The public API health endpoint is:
curl -s https://a8aznijuq0.execute-api.ap-south-1.amazonaws.com/api/health \ | python3 -m json.toolA health response proves that API Gateway reached Lambda and reports configured providers. It does not, by itself, prove that every downstream AWS operation succeeded. That is why I also tested the product flow and reviewed the corresponding CloudWatch invocation.
What I learned
This project taught me more than connecting AWS services:
- Data minimization must be architectural. A promise in the interface is weaker than code that prevents unnecessary data from reaching a model.
- Automation should expose uncertainty. Detection suggestions need editable masks and a mandatory human review.
- A healthy API is not proof of a healthy dependency. Each critical service needs an end-to-end check.
- Serverless limits shape design. Account quotas, regional availability, IAM permissions, CORS, and service verification are part of the product—not deployment details to ignore.
- Fallbacks must be truthful. Keeping the workflow usable is valuable only when users can see which path produced the result.
- Privacy includes distribution. Permanent redaction, private storage, expiry, ownership, and revocation belong in one workflow.
What comes next
DemoSafe currently works best with text-heavy screenshots such as terminals, cloud consoles, logs, configuration files, dashboards, and support pages.
The next useful improvements would be:
- Local OCR for teams that cannot send screenshots to a cloud service
- Face, QR-code, and barcode detection
- Organization-specific detection policies
- A CLI for CI pipelines and documentation workflows
- Batch processing with the same mandatory review boundary
- Audit summaries that record decisions without storing detected secrets
- More languages and better support for low-resolution text
These additions should preserve the current principle: automation can assist, but the person sharing the image remains accountable for the final result.
Conclusion
DemoSafe is not another automatic blur tool. It is a privacy release gate built around explicit consent, minimized AI input, human judgment, permanent redaction, and controlled sharing.
AWS made it possible to connect authentication, OCR, serverless processing, private storage, expiring metadata, monitoring, and bounded AI review into one deployed workflow.
The final lesson is simple: sharing should be easy, but it should never be careless.
DemoSafe — Share the work. Keep the secrets.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article