## State stores did not enforce ETags and first-write consistently
### Problem
Several state store components accepted a write or a delete that its ETag or its `first-write` concurrency option should have rejected, or rejected one that should have succeeded.
The behavior differed from one component to the next:
- **Expired keys.** A key whose TTL had passed, but that the store had not removed yet, still matched an ETag. A set or a delete with that ETag succeeded on a key that a read no longer returned. On some stores a `first-write` set on such a key was rejected as if the key still existed.
- **Transactions.** On Redis, a transaction with a failed ETag check still applied its other operations. On AWS DynamoDB and RavenDB, a delete inside a transaction ignored its ETag. On MongoDB, a transaction that failed to commit reported success.
- **Concurrent writes.** etcd read the key to check the ETag or `first-write` and then wrote in a separate request. When another write landed in between, a set, a delete or one operation of a transaction was skipped and the request still reported success.
- **Stale ETags.** On CockroachDB, every set without an ETag on an existing key left the ETag at the same value, so an ETag read before the write still matched after it.
- **Error type.** On SQL Server, a rejected `first-write` set returned a generic error. On Azure Cosmos DB and AWS DynamoDB, an ETag mismatch inside a transaction returned a generic error.
### Impact
You were affected if you use ETags or `first-write` concurrency with one of these state stores: AWS DynamoDB, Azure Cosmos DB, CockroachDB, etcd, in-memory, MongoDB, MySQL, Oracle Database, PostgreSQL (v1 and v2), RavenDB, Redis, SQLite or SQL Server (v1 and v2).
Depending on the store, a concurrent update could be lost without an error, a transaction could be applied in part, or a caller could not tell an ETag mismatch from another failure.
After the upgrade, requests that these stores accepted by mistake fail with an ETag mismatch: HTTP status `409`, or gRPC code `Aborted`.
Requests that do not set an ETag and do not use `first-write` behave as before.
### Root Cause
The components checked the ETag against the stored row without checking whether the row had expired.
Some components checked the ETag in one request and wrote in another, or sent each operation of a transaction with its own condition, so a failed condition did not stop the other operations.
### Solution
Dapr now uses components-contrib v1.19.2, in which an ETag does not match a key that has expired, a `first-write` set succeeds on a key that is missing or expired and fails otherwise, and a failed check returns an ETag mismatch.
- [State stores did not enforce ETags and first-write consistently](#state-stores-did-not-enforce-etags-and-first-write-consistently)
github.com/dapr/dapr/releases/tag/v1.19.2