Skip to content

APPSEC-1297: Expose notification channel audit timestamps - #381

Open
sanketkar24 wants to merge 1 commit into
hypertrace:mainfrom
sanketkar24:APPSEC-1297-notification-channel-audit-timestamps
Open

sanketkar24 wants to merge 1 commit into
hypertrace:mainfrom
sanketkar24:APPSEC-1297-notification-channel-audit-timestamps

Conversation

@sanketkar24

Copy link
Copy Markdown

Why

NotificationChannel responses carry no indication of when a channel was created or last modified, so callers have nothing to sort or display a created/modified date from.

The data is already there. The generic config service persists creation_timestamp / update_timestamp on every config document, and DocumentConfigStore carries creation_timestamp forward on update, so the creation time survives edits. The values were simply dropped on the way out, where IdentifiedObjectStore maps ConfigObject down to its data payload. No migration or backfill is needed — existing documents already hold both values.

What

Adds two response-only messages and populates them on all four notification channel RPCs:

message NotificationChannelDetails {
  NotificationChannel notification_channel = 1;
  NotificationChannelMetadata metadata = 2;
}

message NotificationChannelMetadata {
  google.protobuf.Timestamp creation_timestamp = 1;
  google.protobuf.Timestamp last_updated_timestamp = 2;
}

NotificationChannelStore gains getAllChannelDetails / getChannelDetails, which read the metadata off ConfigObject instead of discarding it.

This follows the existing in-build precedent of ExcludeSpanRuleDetails / ExcludeSpanRuleMetadata in the span processing config service, rather than introducing a new pattern.

Backward compatibility

The new notification_channel_details field is added as field 2 on each response; the existing flat notification_channel / notification_channels field 1 is left untouched and still populated. Existing clients are unaffected, and buf breaking passes (exit 0).

Design notes

  • Metadata is deliberately kept out of the NotificationChannel message. That message is the unit that gets persisted as the stored config value, so server-derived metadata placed there would be written into the document and go stale. A comment on the message records this, to stop the fields migrating there later.
  • No created_by / updated_by. Only timestamps are exposed. The email fields would require the masking behaviour that lives outside this build, so they are left for a follow-up rather than exposed unmasked.
  • A missing timestamp is reported as unset, not as the epoch. ContextualConfigObjectImpl builds timestamps with Instant.ofEpochMilli(...), so an absent value surfaces as epoch 0 rather than null. The store treats any non-positive instant as absent and leaves the proto field unset, so consumers see "unknown" rather than a 1970 date.

Testing

  • NotificationChannelConfigServiceImplTest: 14/14 pass, including 3 new tests driven by an injectable Clock — create/update exposing timestamps (asserting the creation timestamp is preserved across an update while last-updated advances), getAll exposing timestamps while keeping the legacy channel list populated, and metadata fields left unset when the store reports no timestamps.
  • ./gradlew spotlessApply clean; full module build green; buf breaking exit 0.

Notification channels are persisted through the generic config store,
which already tracks creation and last-update timestamps for every
config document and preserves the creation timestamp across updates.
None of that reached callers: the service layer fetched the full
ContextualConfigObject and then discarded everything except getData(),
so the UI had no field to sort channels by created/modified date.

Add a NotificationChannelDetails wrapper carrying a
NotificationChannelMetadata alongside the channel, and populate it on
the create, update, get and get-all responses. The metadata is kept out
of NotificationChannel itself because that message is the unit written
to the config store, so embedding server-derived values there would
persist them and let them go stale.

The pre-existing notification_channel/notification_channels fields are
left in place and still populated, so existing clients are unaffected.
Timestamps are left unset rather than reported as epoch 0 when the
stored config predates timestamp tracking.

Created-by/updated-by emails are deliberately not exposed here: the
helper that masks internal and system actor emails lives in the
Traceable build, which is not reachable from this module, so surfacing
raw emails would bypass that masking.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sanketkar24
sanketkar24 requested a review from a team as a code owner November 30, 2026 05:39

@Kunal-8789 Kunal-8789 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

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.

2 participants