Course menuDVA-C03

Exams / DVA-C03 / Secrets and sensitive data / Question 3

DVA-C03 practice question: Secrets and sensitive data (3 of 3)

Security A free question from our original DVA-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.

Last verified against current AWS documentation ·How we write our questions

A note-taking app gives signed-in users temporary AWS credentials through an Amazon Cognito identity pool.

Notes are kept in a DynamoDB table named Notes whose partition key is the user's Cognito identity ID.

The role for signed-in users allows GetItem, Query, PutItem and UpdateItem on the table, with this condition:

"Condition": { "ForAllValues:StringEquals": { "dynamodb:LeadingKeys": ["${cognito-identity.amazonaws.com:sub}"] } }

A user edits the app so that it calls GetItem for a note stored under another user's partition key.

What is the result, and why?

Choose one answer.

  1. A. The request succeeds for reads but is denied for writes, because the condition applies only to PutItem and UpdateItem.
  2. B. The request is denied, because the condition limits each caller to items whose partition key equals the caller's own identity ID.
  3. C. The request succeeds, because DynamoDB applies the condition only to attributes named in a projection expression.
  4. D. The request is denied, because the condition restricts which attributes of an item the caller may read or write.
Show the answer and explanation

Answer: B

Explanation

dynamodb:LeadingKeys matches the partition key values in a request, and ${cognito-identity.amazonaws.com:sub} becomes the caller's own identity ID when the policy is evaluated. A request for another user's partition key therefore falls outside what the statement allows and is denied, whichever of the four actions is used. Attribute limits are a separate condition key.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Secrets and sensitive data? The 5 full-length practice sets have 15 more Secrets and sensitive data questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets