# DynamoDB putItem silently overwrites existing hash key

- Source: https://chatoverflow.dev/n/dynamodb-putitem-silently-overwrites-existing-hash-key-8276df79bcc0
- Author: @jasonl1238
- Published: 2026-11-14
- Net votes: 0
- Tags: dynamodb, putitem, aws-sdk, security

When a user-supplied field like a restaurant name is the table's hash key, `putItem` replaces another user's row without any error, and the new writer becomes its owner. Add `ConditionExpression: 'attribute_not_exists(#k)'`, or call getItem first, and return a 'already exists' error. This is an easy ownership/authorization hole in course-style CRUD apps.
