Skip to content

feat: add audit logging and strengthen intelligence - #572

Merged
izadoesdev merged 49 commits into
mainfrom
feat/voice-mode
Jul 30, 2026
Merged

feat: add audit logging and strengthen intelligence#572
izadoesdev merged 49 commits into
mainfrom
feat/voice-mode

Conversation

@izadoesdev

@izadoesdev izadoesdev commented Jul 28, 2026

Copy link
Copy Markdown
Member

What changed

  • Adds an append-only, organization-scoped audit ledger with authenticated access and audit events for organization, API key, and website changes.
  • Tightens Insight evidence boundaries so runtime errors do not become invented root causes, downstream harm, or speculative code recommendations.
  • Limits the tracking setup banner to the website overview.

Why

Organization changes need a durable tenant-scoped history, while Insight briefs should make evidence-backed next moves without overstating what analytics can prove.

Validation

  • Full workspace typecheck
  • Full workspace test suite
  • Insight schema tests and frozen production-shadow replays

Notes

Database-backed audit integration coverage will run in CI.


Summary by cubic

Adds an organization-scoped audit log with outbox replay and a read API, strengthens Insights with safer, executable outcomes and rechecks, and adds voice input for the agent. Also reduces noisy 4xx logs and skips email alerts when unset.

  • New Features

    • Audit logging: append-only ledger via @databuddy/services/audit and @databuddy/shared/audit; audits org membership, API keys, and website lifecycle; new audit-logs RPC with cursor pagination; Better Auth and ORPC capture actor, IP, UA, and request id; outbox replay retries failed writes.
    • Insights: tighter evidence and verification; actions require exact recheckAt; manual runs can force rechecks; rechecks trigger on goal/funnel changes; executable goal edits/deletes validated; inbox hides cases during verification; feed foregrounds outcomes and links evidence; caches invalidate on goal/funnel updates.
    • Agent voice input: dialog with live Web Speech transcription and mic-level visual; respects reduced motion; Permissions-Policy allows microphone on same origin.
  • Bug Fixes

    • Logging: downgrade expected 4xx to warnings in basket and the ORPC interceptor; avoid double-capturing known client errors.
    • Alerts: skip email delivery when RESEND_API_KEY is missing and warn once; blocked-traffic alerts pull key from app config.
    • Dashboard: show tracking setup banner only on the website overview; stabilize core e2e selectors.
    • CI: release workflow only runs on .changeset/**; GitHub Actions dependencies bumped.

Written for commit 941dc13. Summary will update on new commits.

Review in cubic

dependabot Bot and others added 30 commits July 8, 2026 04:11
Bumps [docker/login-action](https://github.com/docker/login-action) from 4.1.0 to 4.4.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](docker/login-action@4907a6d...af1e73f)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-version: 4.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](sigstore/cosign-installer@cad07c2...6f9f177)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 4.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
- Voice dialog with live Web Speech API transcription and fluid orb visual
- MicrophoneIcon added to nucleo icon set
- Allow same-origin microphone in Permissions-Policy

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 6.0.0 to 6.2.0.
- [Release notes](https://github.com/docker/metadata-action/releases)
- [Commits](docker/metadata-action@030e881...dc80280)

---
updated-dependencies:
- dependency-name: docker/metadata-action
  dependency-version: 6.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
* fix(ci): only run releases for changesets

* fix(dashboard): align core e2e checks with current UI
…tions/staging/docker/metadata-action-6.2.0

chore(deps): bump docker/metadata-action from 6.0.0 to 6.2.0
…tions/staging/sigstore/cosign-installer-4.1.2

chore(deps): bump sigstore/cosign-installer from 4.1.1 to 4.1.2
…tions/staging/docker/login-action-4.4.0

chore(deps): bump docker/login-action from 4.1.0 to 4.4.0
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
databuddy-status Ready Ready Preview Jul 30, 2026 8:12am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
dashboard Skipped Skipped Jul 30, 2026 8:12am
documentation Skipped Skipped Jul 30, 2026 8:12am

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b5e94d61-34a5-4485-be3f-2af5933cbc31

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/voice-mode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@unkey-deploy

unkey-deploy Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Unkey Deploy

Name Status Preview Inspect Updated (UTC)
api (preview) Ready Visit Preview Inspect Jul 30, 2026 8:13am

Comment thread apps/dashboard/components/agent/agent-voice-dialog.tsx Fixed
Comment thread packages/rpc/src/routers/apikeys.ts
Comment thread packages/rpc/src/lib/audit.ts
Comment thread packages/auth/src/auth.ts
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds an organization-scoped audit ledger and tightens Insight evidence handling.

  • Adds audit schema, persistence services, permissions, authenticated read APIs, and events for organization, API-key, and website changes.
  • Refines Insight generation, observations, resume behavior, schemas, tests, and dashboard presentation.
  • Restricts the tracking setup banner to website overview and updates supporting workflow and dependency configuration.

Confidence Score: 2/5

This PR should not merge until audit writes cannot leave committed mutations behind an error or silently omit security-sensitive events, and request-origin attribution uses a trusted proxy boundary.

API-key and website writes can commit before a failing audit append changes the response outcome, Better Auth deliberately drops failed audit writes, and both audit entry paths persist unverified forwarding-header values as origin IPs.

Files Needing Attention: packages/rpc/src/routers/apikeys.ts, packages/rpc/src/routers/websites.ts, packages/auth/src/auth.ts, packages/rpc/src/lib/audit.ts, apps/dashboard/app/api/auth/[...all]/route.ts

Security Review

The new audit request context accepts unverified forwarding headers, allowing authenticated callers to place a forged origin IP into durable audit records. How this was verified: The selected forwarding-header value flows directly through appendAuditEvent into audit_events.ip and is returned by the authenticated audit-log APIs.

Important Files Changed

Filename Overview
packages/auth/src/auth.ts Adds Better Auth organization audit hooks, but suppresses post-commit audit failures and can leave the ledger incomplete.
packages/rpc/src/lib/audit.ts Centralizes RPC audit attribution, but persists unverified forwarding-header values as origin IPs.
packages/rpc/src/routers/apikeys.ts Audits API-key mutations after committing them, allowing error responses and retries against already-changed state.
packages/rpc/src/routers/websites.ts Adds comprehensive website audit events, but post-write append failures can report failed operations after committed changes.
packages/rpc/src/routers/audit-logs.ts Adds tenant-authorized cursor-based audit reads and records audit-log access.
packages/services/src/audit.ts Implements audit persistence and querying, but offers no durable retry mechanism for callers that cannot make writes atomic.
packages/db/src/drizzle/schema/audit.ts Adds the organization-scoped audit_events schema and indexes without target foreign keys so history survives deletion.
apps/insights/src/generation.ts Tightens investigation evidence and action-generation boundaries with accompanying replay and schema coverage.
apps/dashboard/app/api/auth/[...all]/route.ts Adds request context around audited Better Auth routes but trusts caller-controlled proxy headers for IP attribution.

Sequence Diagram

sequenceDiagram
  participant C as Authenticated client
  participant R as Auth/RPC handler
  participant D as Primary database state
  participant A as Audit ledger
  C->>R: Organization, API-key, or website mutation
  R->>D: Commit primary mutation
  D-->>R: Success
  R->>A: Append audit event
  alt Audit append succeeds
    A-->>R: Recorded
    R-->>C: Success
  else Audit append fails
    A-->>R: Error
    R-->>C: Error or success with missing audit
  end
Loading

Reviews (1): Last reviewed commit: "feat(audit): add organization audit logg..." | Re-trigger Greptile

@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel
vercel Bot temporarily deployed to Preview – dashboard July 30, 2026 08:12 Inactive
@vercel
vercel Bot temporarily deployed to Preview – documentation July 30, 2026 08:12 Inactive
@izadoesdev
izadoesdev merged commit 4e77d35 into main Jul 30, 2026
19 checks passed
@dosubot

dosubot Bot commented Jul 30, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-08-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about Databuddy Add Dosu to your team

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