How to Configure OpenHands DynamoDB Audit Log
You set up an openhands dynamodb audit log by turning on AWS CloudTrail data events. Then you assign a scoped IAM role to the agent container for table operations. Teams often give coding agents broad cloud keys to get a prototype working fast. When a role is too wide, an agent can read or delete production tables by mistake. A clear trail of every table read and write helps security teams spot bad runs. How the native openhands dynamodb audit log workflow operates OpenHands runs tasks inside
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up an openhands dynamodb audit log by turning on AWS CloudTrail data events. Then you assign a scoped IAM role to the agent container for table operations. Teams often give coding agents broad cloud keys to get a prototype working fast. When a role is too wide, an agent can read or delete production tables by mistake. A clear trail of every table read and write helps security teams spot bad runs.
How the native openhands dynamodb audit log workflow operates
OpenHands runs tasks inside an isolated container or local workspace on your host machine. When the agent needs to query DynamoDB, it uses standard AWS keys or an IAM role. You should never put long-lived personal keys into the agent workspace settings. Instead, you attach a narrow IAM role to the host or container task definition.
By default, AWS CloudTrail only records control actions like creating or deleting a table. It does not record item reads, writes, or scans inside the database itself. To capture an openhands dynamodb audit log, you must enable data events in CloudTrail. You select the specific tables that the coding agent uses during its work. CloudTrail then writes a log record to an S3 bucket for every item request. Each record shows the IAM role, the time, the action, and the table name.
You can also route these CloudTrail events to CloudWatch Logs for faster searching. Security teams set up alerts on high scan counts or unexpected delete requests. Giving the OpenHands container its own unique IAM role makes filtering these logs simple. You can separate agent actions from human engineer actions in every report.
What native logging solves and what gaps remain
Native cloud logging gives you a solid record of which role touched which table. It proves whether the agent container made a read or write call at a given time. IAM roles also stop the agent from touching tables outside its allowed list. This setup forms a strong first line of defense for cloud storage.
Still, native IAM and CloudTrail rules only check who logs in and which API runs. They do not inspect the payload content or stop risky batch actions in flight. Once an IAM role allows a table read, the agent pulls back every field. If a table holds emails, phone numbers, card numbers, or national IDs, the agent gets them. Those raw values can then flow straight into external language model prompts. Also, CloudTrail logs the event after it happens, not before it runs. It cannot pause a bad write command to ask a human for approval first.
Audit Log Integrity + DynamoDB Fine-Grained Access: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Scoping permissions and masking sensitive fields
To reduce risk, teams break database permissions into small, task-specific roles. Read-only roles work best for debugging and code review tasks. Write permissions should stay off unless a specific test requires table changes. Even then, the agent should only use test tables with fake data when possible.
When an agent must query real tables, data masking becomes critical. Masking rewrites matched fields in results before the agent runtime processes the output. For example, masking replaces emails, phone numbers, and card numbers with safe placeholders. This step keeps sensitive values out of agent memory and external model logs. Combining tight role rules with live payload checks keeps agent runs safe and clear.
Add runtime guardrails and masking beside your databases and APIs
Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.
Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.
Frequently asked questions
Does AWS CloudTrail log item reads by default?
No, CloudTrail only logs management events like table creation by default. You must turn on data events for your specific tables to record item reads and writes.
How should an OpenHands agent authenticate to AWS?
Assign a dedicated IAM role to the container task or host instance. Avoid passing static user keys into the agent workspace settings.
Can CloudTrail logs show the exact data returned to the agent?
No, CloudTrail records the API call metadata, the caller identity, and the item keys. It does not log the full returned item payload or rewrite sensitive fields like phone numbers.
Related guides
In this post