feat(audit-log): add audit events for templates, billing, credentials, env, deployments, passwords#3246
Merged
waleedlatif1 merged 7 commits intostagingfrom Feb 18, 2026
Merged
Conversation
…, env, deployments, passwords
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis PR expands the audit logging system across 10 API routes by adding new audit events for templates (CRUD), billing (credit purchases), credentials (invitation accept/resend, member self-leave), password resets, global environment variable updates, and deployment version activation. It also enriches existing audit calls across 18+ routes with
Confidence Score: 4/5
Important Files Changed
Flowchartflowchart TD
subgraph Auth["Auth Layer"]
Session["Session Auth"]
APIKey["API Key Auth"]
JWT["Internal JWT"]
end
subgraph AuthResult["AuthResult / McpAuthContext"]
UID["userId"]
UNAME["userName (new)"]
UEMAIL["userEmail (new)"]
end
Session -->|populates| UID
Session -->|populates| UNAME
Session -->|populates| UEMAIL
APIKey -->|populates| UID
APIKey -.->|undefined| UNAME
APIKey -.->|undefined| UEMAIL
JWT -->|populates| UID
JWT -.->|undefined| UNAME
JWT -.->|undefined| UEMAIL
subgraph NewAuditEvents["New Audit Events"]
CP["CREDIT_PURCHASED"]
CSL["CREDENTIAL_SET_MEMBER_LEFT"]
CSIA["CREDENTIAL_SET_INVITATION_ACCEPTED"]
CSIR["CREDENTIAL_SET_INVITATION_RESENT"]
PR["PASSWORD_RESET"]
TC["TEMPLATE_CREATED"]
TU["TEMPLATE_UPDATED"]
TD2["TEMPLATE_DELETED"]
WDA["WORKFLOW_DEPLOYMENT_ACTIVATED"]
EU["ENVIRONMENT_UPDATED"]
end
subgraph Routes["Instrumented Routes"]
R1["/api/billing/credits"]
R2["/api/credential-sets/memberships"]
R3["/api/credential-sets/invite/token"]
R4["/api/credential-sets/id/invite/invId"]
R5["/auth (onPasswordReset)"]
R6["/api/templates"]
R7["/api/templates/id"]
R8["/api/workflows/id/deployments/ver"]
R9["/api/environment"]
end
R1 --> CP
R2 --> CSL
R3 --> CSIA
R4 --> CSIR
R5 --> PR
R6 --> TC
R7 --> TU
R7 --> TD2
R8 --> WDA
R9 --> EU
AuthResult --> NewAuditEvents
NewAuditEvents -->|recordAudit| AuditDB[(Audit Log DB)]
Last reviewed commit: aeeead0 |
apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts
Outdated
Show resolved
Hide resolved
apps/sim/app/api/credential-sets/[id]/invite/[invitationId]/route.ts
Outdated
Show resolved
Hide resolved
…NVITATION_RESENT action
Collaborator
Author
|
@cursor review |
Collaborator
Author
|
@greptile |
…udit, remove cast - Move password reset audit to onPasswordReset callback in auth config instead of coupling to better-auth's verification table internals - Remove ugly double-cast on workflowData.workspaceId in deployment activation
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@cursor review |
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.
Summary
CREDIT_PURCHASED,CREDENTIAL_SET_MEMBER_LEFT,CREDENTIAL_SET_INVITATION_ACCEPTED,PASSWORD_RESET,TEMPLATE_CREATED/UPDATED/DELETED,WORKFLOW_DEPLOYMENT_ACTIVATEDBILLING,PASSWORD,TEMPLATEType of Change
Testing
Tested manually, type check passes, audit mock sync tests pass (17/17)
Checklist