Skip to content

bug(secrets): the secret audit log reads fields the API does not send, so dates and names look wrong #20173

Open

Description

@mrveiss

Problem

autobot-backend/services/audit_logger.py:103 AuditEntry.timestamp is a float of epoch seconds, and to_response_dict (:117) returns the fields as they are. Secrets details are in details; there is no metadata field.

autobot-frontend/src/composables/useSecretsAuditApi.ts:21 types timestamp as a string and has metadata. autobot-frontend/src/components/secrets/SecretAuditLog.vue then:

  • :117 does new Date(entry.timestamp), which treats seconds as milliseconds, so dates land in January 1970;
  • :104 reads entry.metadata?.secret_name, so every row reads "Unknown Secret" (the id falls back to resource).

Not known

Found by reading the code; not run against a live backend. Whether /audit/logs post-processes these entries further was checked only as far as autobot-backend/api/audit.py:123.

Fix

Type the row from the backend's fields, multiply the timestamp, and read details. This also lets the last two duplicate type names on #19910 (AuditLogEntry, AuditQueryResponse) become one declaration.

Acceptance criteria

Activity

  1. added
    bugSomething isn't working
    phase:M3.9Chat, Agents, Analytics and Settings screens
    on Oct 31, 2026
  2. github-actions commented on Oct 31, 2026

    @github-actions
    Contributor

    Landed via the merge train (#20184, merge 4e5b97957f) via #20178

  3. mrveiss commented on Oct 31, 2026

    @mrveiss
    OwnerAuthor

    Landed via the merge train (PR #20184), main 4e5b979 (member #20178). 1 of 3 ACs ticked; stays open.

    • Met: test with a real-shaped entry: autobot-frontend/src/components/secrets/__tests__/SecretAuditLog.test.ts asserts the secret name, the user, '5m ago' and no '1970'.
    • Not met: one declaration each. AuditQueryResponse is still declared in autobot-frontend/src/types/audit.ts:84 and autobot-slm-frontend/src/composables/useAutobotApi.ts:248, and repo_tests/duplicate_names_ratchet_14908_test.py still lists it in TYPE_EXCEPTIONS. AuditLogEntry is declared once (SLM only).
    • Host AC: untouched, needs a finished update.
  4. mrveiss commented on Nov 7, 2026

    @mrveiss
    OwnerAuthor

    Referenced from #21011, which does not change this issue. The remaining AC (one declaration each for AuditLogEntry and AuditQueryResponse, exceptions removed) needs the shared kit's libs/autobot-ui/index.ts, which open PR #20986 holds, so it is left for after that lands. The host AC still needs a finished update.

  5. mrveiss commented on Nov 8, 2026

    @mrveiss
    OwnerAuthor

    Refs update: the PRs carrying this landed via train #21125 (merge commit 77eaa31). Delivered: see #20665 and #20640; this PR landed those parts. This issue stays open; no criteria were ticked here.

  6. mrveiss commented on Nov 12, 2026

    @mrveiss
    OwnerAuthor

    Merged via #21262 in train #21390 (merge commit 1b412de, 2026-11-12 ~18:40 Riga). Verified against merged main.

    AC Status Evidence
    1. Real-shaped entry test shows date, name, user Ticked (already) autobot-frontend/src/components/secrets/__tests__/SecretAuditLog.test.ts ("shows the real date, secret name and user of a backend row", fixture details: { name: 'prod-db-credential' }, asserts no 1970); SecretAuditLog.vue:118-130 reads details.name and auditTimestampToDate(entry.timestamp)
    2. One declaration each, #19910 guard exceptions removed Ticked AuditQueryResponse declared once, in libs/autobot-ui/src/types/audit.ts:10, imported by both apps; AuditLogEntry declared once (autobot-slm-frontend/src/composables/useAutobotApi.ts:224), the main app uses AuditApiEntry; repo_tests/duplicate_names_ratchet_14908_test.py:53 TYPE_EXCEPTIONS = {}, :50 type_names_in_both_apps: 0
    3. Host: real dates and names on the local install after a finished update Unchecked Host evidence needed. The install's user frontend still serves a pre-update bundle (#21343), so nothing about today's landing has been seen on a host

    Boxes: 2 of 3 ticked. Issue stays open for AC3 only. Remaining: finish the update on the install (#21343), then look at the secret audit log and record the dates and names seen.

  7. github-actions commented on Nov 12, 2026

    @github-actions
    Contributor

    Landed via the merge train (#21390, merge 1b412de635) via #21262

  8. github-actions commented on Nov 17, 2026

    @github-actions
    Contributor

    Landed in #21732, merge df23644add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingfrontendphase:M3.9Chat, Agents, Analytics and Settings screens

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions