Skip to content

all: add support for tracking last-accessed timestamps#163

Open
creachadair wants to merge 9 commits intomainfrom
mjf/audit-read
Open

all: add support for tracking last-accessed timestamps#163
creachadair wants to merge 9 commits intomainfrom
mjf/audit-read

Conversation

@creachadair
Copy link
Copy Markdown
Member

@creachadair creachadair commented Apr 17, 2026

The commits in this branch are independent, and can be reviewed separately.

Add a new field to the SecretInfo type, recording a last-accessed timestamp.
This reflects the last time at which the server authorized any access to a
secret other than "info" (acl.ActionInfo).

Rather than adding new data to the encrypted payload, we use the audit log to
initialize an index at startup, then maintain it in memory while the server
runs. We use the audit log timestamps as the source-of-truth, so the results
will be consistent even if the server stops/crashes and restarts.

Updates tailscale/corp#40218

This is preparation for adding a Reader type in the next commit.
Update usage throughout.
This allows a caller to read back through the contents of an audit log.
The Reader exposes a basic iterator interface.
This field can be used to report the last time the server recorded a use of
each secret, where "use" is defined as any authorized query that is not the
"info" operation.
This is in preparation for adding a new option for the access index.
Wire in an initial access index, and ensure it gets updated whenever we
successfully authorize an operation besides "info". Note that we will update
the index even if the operation reports an error, because we are using the
audit log as the source of truth, and we did in fact allow the operation even
if it did not wind up doing anything.
Surface the last accessed information in list and info responses.
Comment thread db/db_test.go
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best reviewed with whitespace off.

@creachadair creachadair marked this pull request as ready for review April 20, 2026 23:55
@creachadair creachadair requested a review from danderson April 20, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant