-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Missing plan check and ip whitelist parsing (#2379)
* fix: Missing plan check and ip whitelist parsing * fix: adjust tests for ipwhitelist * fix: Rename error code Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: ipwhitelist via features vs enterprise plan * fix: invert condition * chore: add cache log * fix: ensure workspace is loaded (#2470) * chore: more logging and retries (#2475) * Update 7_create_a_template.md (#2471) * increase override limit * Update create-new-override.tsx * fix: Enhance API Key Detail Page: Change Permissions Visualization to Tree Format (#2238) * fix:changed the permission view * fixed issue comments * [autofix.ci] apply automated fixes * removed font --------- Co-authored-by: Andreas Thomas <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * fix: show shallow permissions followed by nested in alphabetical order (#2273) * fix: show shallow permissions followed by nested in alphabetical order * fix: correct the sorting of nested permissions top level keys * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> * Add Template to Markdown (#2362) Co-authored-by: Andreas Thomas <[email protected]> * fix: retry on any error with disabled cache --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: chronark <[email protected]> Co-authored-by: Chirag Arora <[email protected]> Co-authored-by: RajuGangitla <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Anne Deepa Prasanna <[email protected]> Co-authored-by: djnovin <[email protected]>
- Loading branch information
1 parent
83b14b8
commit c657aff
Showing
7 changed files
with
38 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -43,14 +43,27 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) | |
"We are unable to update the API whitelist. Please try again or contact [email protected]", | ||
}); | ||
}); | ||
if (!api || api.workspace.tenantId !== ctx.tenant.id) { | ||
|
||
if ( | ||
!api || | ||
api.workspace.tenantId !== ctx.tenant.id || | ||
input.workspaceId !== api.workspace.id | ||
) { | ||
throw new TRPCError({ | ||
code: "NOT_FOUND", | ||
message: | ||
"We are unable to find the correct API. Please try again or contact [email protected].", | ||
}); | ||
} | ||
|
||
if (!api.workspace.features.ipWhitelist) { | ||
throw new TRPCError({ | ||
code: "FORBIDDEN", | ||
message: | ||
"IP Whitelisting is only available for enterprise plans. Please contact [email protected].", | ||
}); | ||
} | ||
|
||
const newIpWhitelist = input.ipWhitelist === null ? null : input.ipWhitelist.join(","); | ||
|
||
await db | ||
|
@@ -68,6 +81,7 @@ export const updateApiIpWhitelist = rateLimitedProcedure(ratelimit.update) | |
"We are unable to update the API whitelist. Please try again or contact [email protected]", | ||
}); | ||
}); | ||
|
||
await insertAuditLogs(tx, { | ||
workspaceId: api.workspace.id, | ||
actor: { | ||
|