audit: optional COLLIE_AUDIT_CONTENT=none, keeping the event and dropping the body - #107
Closed
shuangwangnyc wants to merge 1 commit into
Closed
audit: optional COLLIE_AUDIT_CONTENT=none, keeping the event and dropping the body#107shuangwangnyc wants to merge 1 commit into
shuangwangnyc wants to merge 1 commit into
Conversation
…ping the body The audit trail records every write-level action, which is right — sending keystrokes to a pane is arbitrary code execution and who-did-what-when is worth keeping. It also records up to 120 characters of the message itself, and up to 120 characters of the prompt binding, which is a slice of whatever happened to be on the terminal at the time. For a personal deployment that is fine. For one where the trail is wanted but the bodies are not, there is currently no way to have one without the other. This adds one config value: COLLIE_AUDIT_CONTENT=preview (default, byte-for-byte today's behaviour) COLLIE_AUDIT_CONTENT=none every string inside `detail` becomes the length The envelope is untouched either way: ts, action, paneId, session, device, and every boolean and number inside detail. So submitted, textDelivered and promptBinding.checked/passed still answer the questions the log is for. Two small decisions, in case they are worth arguing about: - It keeps the LENGTH rather than a shorter preview. A truncated secret is still a secret, and the question a reader asks of a redacted trail is usually whether anything was sent at all, which a count answers. - It recurses, so nesting is covered. The prompt binding is nested and holds the terminal fragment; a redaction reaching only the top level would have left the more sensitive half in place. sanitize and formatAuditLine take the mode as a defaulted parameter, so every existing caller and test is unaffected. Tested: the existing suite passes unchanged (590 tests), plus four new cases covering the default being untouched, the envelope surviving, nothing of the message or the terminal surviving at any depth, and the length being preserved. Happy to adjust the naming, or drop the env var and take a constructor argument only, if you would rather not add configuration for this.
Owner
|
Thanks @shuangwangnyc — this was a real gap and the shape you picked ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
audit: optional COLLIE_AUDIT_CONTENT=none, keeping the event and dropping the body
The audit trail records every write-level action, which is right — sending
keystrokes to a pane is arbitrary code execution and who-did-what-when is worth
keeping. It also records up to 120 characters of the message itself, and up to
120 characters of the prompt binding, which is a slice of whatever happened to be
on the terminal at the time.
For a personal deployment that is fine. For one where the trail is wanted but the
bodies are not, there is currently no way to have one without the other.
This adds one config value:
COLLIE_AUDIT_CONTENT=preview (default, byte-for-byte today's behaviour)
COLLIE_AUDIT_CONTENT=none every string inside
detailbecomes the lengthThe envelope is untouched either way: ts, action, paneId, session, device, and
every boolean and number inside detail. So submitted, textDelivered and
promptBinding.checked/passed still answer the questions the log is for.
Two small decisions, in case they are worth arguing about:
a secret, and the question a reader asks of a redacted trail is usually whether
anything was sent at all, which a count answers.
terminal fragment; a redaction reaching only the top level would have left the
more sensitive half in place.
sanitize and formatAuditLine take the mode as a defaulted parameter, so every
existing caller and test is unaffected.
Tested: the existing suite passes unchanged (590 tests), plus four new cases
covering the default being untouched, the envelope surviving, nothing of the
message or the terminal surviving at any depth, and the length being preserved.
Happy to adjust the naming, or drop the env var and take a constructor argument
only, if you would rather not add configuration for this.