HackBlue

Tools · AWS detection and investigation · 20 / 24

CloudTrail Lake: the error message is not the code

errorCode is the code on the row. errorMessage is the service’s string. Write the one you have, and do not invent a code from the wording or a sentence from a code you did not read.

12 min read · practice only with authorization

Two fields, when both exist

A CloudTrail row can include an error code and an error message. The code is the short status the service logged. The message is the string that went with it. They can both be present. Quoting the message does not replace the code, and quoting the code does not let you rewrite the message in your own words and call it the field.

An empty code, when you have looked at the field, is a different fact from a missing message. Say which field you looked at.

A missing field stays missing

If the SELECT list did not include errorMessage, the result has no message. Do not compose one from the code. If the list did not include errorCode, do not reduce the message to a code you remember from another row. The statement decides which field you have.

A friendly sentence in the message is still the service’s string. It is not a conclusion that the call was harmless, and it is not a conclusion that it succeeded, if the code says otherwise. Cite the code for the status and the message for the wording.

What to file

File eventID, and errorCode and errorMessage only when they were selected and present, each labeled. If a field was not selected, say that. Do not file a paraphrase as if it were errorMessage.

Worked case: a sentence written for a code

A lab row’s errorCode is AccessDenied. The query did not select errorMessage. A draft adds “The sandbox user is not allowed to read this bucket” and labels it the error message. Those words are not on the row.

The note quotes errorCode AccessDenied and says errorMessage was not selected. The drafted sentence is removed. A follow-up query can select the message if the wording is needed, and that query gets its own id. This row does not gain a sentence.

Snippet
eventID: <id>
errorCode: AccessDenied
errorMessage: not selected
draft sentence: removed
write: the code only
not: a message the query did not return

Diagram

The code and the message

Each is its own field.

errorCode

Is. The status string the service logged

Cite when. The query selected it

Does not. Authorize a sentence you wrote

errorMessage

Is. The service’s wording, when selected

Cite when. It is on the row

Does not. Replace the code, or prove the call succeeded

Check yourself

1. The query selected errorCode and not errorMessage. What can you quote as the message?

2. Both fields are present and they seem to disagree. What do you do?

3. errorCode is empty and you confirmed the field was selected. What do you write?