Repository navigation
APPSEC-1297: Expose notification channel audit timestamps - #381
Open
sanketkar24 wants to merge 1 commit into
Open
sanketkar24 wants to merge 1 commit into
sanketkar24 wants to merge 1 commit into
Conversation
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>
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.
Why
NotificationChannelresponses 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_timestampon every config document, andDocumentConfigStorecarriescreation_timestampforward on update, so the creation time survives edits. The values were simply dropped on the way out, whereIdentifiedObjectStoremapsConfigObjectdown 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:
NotificationChannelStoregainsgetAllChannelDetails/getChannelDetails, which read the metadata offConfigObjectinstead of discarding it.This follows the existing in-build precedent of
ExcludeSpanRuleDetails/ExcludeSpanRuleMetadatain the span processing config service, rather than introducing a new pattern.Backward compatibility
The new
notification_channel_detailsfield is added as field 2 on each response; the existing flatnotification_channel/notification_channelsfield 1 is left untouched and still populated. Existing clients are unaffected, andbuf breakingpasses (exit 0).Design notes
NotificationChannelmessage. 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.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.ContextualConfigObjectImplbuilds timestamps withInstant.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 injectableClock— 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 spotlessApplyclean; full module build green;buf breakingexit 0.