-
Notifications
You must be signed in to change notification settings - Fork 3.5k
v0.6.37: audit logs page, isolated-vm worker rotation, permission groups ui #4114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+3,638
−2,508
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
20cc018
fix(execution): fix isolated-vm memory leak and add worker recycling …
waleedlatif1 c852585
chore(triggers): deprecate trigger-save subblock (#4107)
waleedlatif1 74d0a47
fix(trigger): fix Google Sheets trigger header detection and row inde…
waleedlatif1 6a4f5f2
fix(trigger): handle Drive rate limits, 410 page token expiry, and cl…
waleedlatif1 30c5e82
feat(ee): add enterprise audit logs settings page (#4111)
waleedlatif1 bc31710
improvement(landing): rebrand to AI workspace, add auth modal, harden…
emir-karabeg 85f1d96
feat(ee): enterprise feature flags, permission group platform control…
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { createLogger } from '@sim/logger' | ||
| import { NextResponse } from 'next/server' | ||
| import { getSession } from '@/lib/auth' | ||
| import { validateEnterpriseAuditAccess } from '@/app/api/v1/audit-logs/auth' | ||
| import { formatAuditLogEntry } from '@/app/api/v1/audit-logs/format' | ||
| import { | ||
| buildFilterConditions, | ||
| buildOrgScopeCondition, | ||
| queryAuditLogs, | ||
| } from '@/app/api/v1/audit-logs/query' | ||
|
|
||
| const logger = createLogger('AuditLogsAPI') | ||
|
|
||
| export const dynamic = 'force-dynamic' | ||
|
|
||
| export async function GET(request: Request) { | ||
| try { | ||
| const session = await getSession() | ||
| if (!session?.user?.id) { | ||
| return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) | ||
| } | ||
|
|
||
| const authResult = await validateEnterpriseAuditAccess(session.user.id) | ||
| if (!authResult.success) { | ||
| return authResult.response | ||
| } | ||
|
|
||
| const { orgMemberIds } = authResult.context | ||
|
|
||
| const { searchParams } = new URL(request.url) | ||
| const search = searchParams.get('search')?.trim() || undefined | ||
| const startDate = searchParams.get('startDate') || undefined | ||
| const endDate = searchParams.get('endDate') || undefined | ||
| const includeDeparted = searchParams.get('includeDeparted') === 'true' | ||
| const limit = Math.min(Math.max(Number(searchParams.get('limit')) || 50, 1), 100) | ||
| const cursor = searchParams.get('cursor') || undefined | ||
|
|
||
| if (startDate && Number.isNaN(Date.parse(startDate))) { | ||
| return NextResponse.json({ error: 'Invalid startDate format' }, { status: 400 }) | ||
| } | ||
| if (endDate && Number.isNaN(Date.parse(endDate))) { | ||
| return NextResponse.json({ error: 'Invalid endDate format' }, { status: 400 }) | ||
| } | ||
|
|
||
| const scopeCondition = await buildOrgScopeCondition(orgMemberIds, includeDeparted) | ||
| const filterConditions = buildFilterConditions({ | ||
| action: searchParams.get('action') || undefined, | ||
| resourceType: searchParams.get('resourceType') || undefined, | ||
| actorId: searchParams.get('actorId') || undefined, | ||
| search, | ||
| startDate, | ||
| endDate, | ||
| }) | ||
|
|
||
| const { data, nextCursor } = await queryAuditLogs( | ||
| [scopeCondition, ...filterConditions], | ||
| limit, | ||
| cursor | ||
| ) | ||
|
|
||
| return NextResponse.json({ | ||
| success: true, | ||
| data: data.map(formatAuditLogEntry), | ||
| nextCursor, | ||
| }) | ||
| } catch (error: unknown) { | ||
| const message = error instanceof Error ? error.message : 'Unknown error' | ||
| logger.error('Audit logs fetch error', { error: message }) | ||
| return NextResponse.json({ error: 'Internal server error' }, { status: 500 }) | ||
| } | ||
| } | ||
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.