Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
310add9d0d Bump the dev-patch-updates group across 1 directory with 7 updates
Bumps the dev-patch-updates group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@tailwindcss/postcss](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss) | `4.3.0` | `4.3.1` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.9.1` | `25.9.3` |
| [esbuild](https://github.com/evanw/esbuild) | `0.28.0` | `0.28.1` |
| [eslint-config-next](https://github.com/vercel/next.js/tree/HEAD/packages/eslint-config-next) | `16.2.6` | `16.2.9` |
| [prettier](https://github.com/prettier/prettier) | `3.8.3` | `3.8.4` |
| [tailwindcss](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss) | `4.3.0` | `4.3.1` |
| [tsx](https://github.com/privatenumber/tsx) | `4.22.3` | `4.22.4` |



Updates `@tailwindcss/postcss` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.3.1/packages/@tailwindcss-postcss)

Updates `@types/node` from 25.9.1 to 25.9.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Updates `esbuild` from 0.28.0 to 0.28.1
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.28.0...v0.28.1)

Updates `eslint-config-next` from 16.2.6 to 16.2.9
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/commits/v16.2.9/packages/eslint-config-next)

Updates `prettier` from 3.8.3 to 3.8.4
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.8.4)

Updates `tailwindcss` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.3.1/packages/tailwindcss)

Updates `tsx` from 4.22.3 to 4.22.4
- [Release notes](https://github.com/privatenumber/tsx/releases)
- [Changelog](https://github.com/privatenumber/tsx/blob/master/release.config.cjs)
- [Commits](https://github.com/privatenumber/tsx/compare/v4.22.3...v4.22.4)

---
updated-dependencies:
- dependency-name: "@tailwindcss/postcss"
  dependency-version: 4.3.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: "@types/node"
  dependency-version: 25.9.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: esbuild
  dependency-version: 0.28.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: eslint-config-next
  dependency-version: 16.2.9
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: prettier
  dependency-version: 3.8.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: tailwindcss
  dependency-version: 4.3.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
- dependency-name: tsx
  dependency-version: 4.22.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: dev-patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-15 01:35:59 +00:00
7 changed files with 340 additions and 432 deletions

582
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -139,7 +139,7 @@
"@dotenvx/dotenvx": "1.69.1", "@dotenvx/dotenvx": "1.69.1",
"@esbuild-plugins/tsconfig-paths": "0.1.2", "@esbuild-plugins/tsconfig-paths": "0.1.2",
"@react-email/ui": "^6.5.0", "@react-email/ui": "^6.5.0",
"@tailwindcss/postcss": "4.3.0", "@tailwindcss/postcss": "4.3.1",
"@tanstack/react-query-devtools": "5.100.14", "@tanstack/react-query-devtools": "5.100.14",
"@types/better-sqlite3": "7.6.13", "@types/better-sqlite3": "7.6.13",
"@types/cookie-parser": "1.4.10", "@types/cookie-parser": "1.4.10",
@@ -151,7 +151,7 @@
"@types/jmespath": "0.15.2", "@types/jmespath": "0.15.2",
"@types/js-yaml": "4.0.9", "@types/js-yaml": "4.0.9",
"@types/jsonwebtoken": "9.0.10", "@types/jsonwebtoken": "9.0.10",
"@types/node": "25.9.1", "@types/node": "25.9.3",
"@types/nodemailer": "8.0.0", "@types/nodemailer": "8.0.0",
"@types/nprogress": "0.2.3", "@types/nprogress": "0.2.3",
"@types/pg": "8.20.0", "@types/pg": "8.20.0",
@@ -165,21 +165,21 @@
"@types/yargs": "17.0.35", "@types/yargs": "17.0.35",
"babel-plugin-react-compiler": "1.0.0", "babel-plugin-react-compiler": "1.0.0",
"drizzle-kit": "0.31.10", "drizzle-kit": "0.31.10",
"esbuild": "0.28.0", "esbuild": "0.28.1",
"esbuild-node-externals": "1.22.0", "esbuild-node-externals": "1.22.0",
"eslint": "10.4.0", "eslint": "10.4.0",
"eslint-config-next": "16.2.6", "eslint-config-next": "16.2.9",
"postcss": "8.5.15", "postcss": "8.5.15",
"prettier": "3.8.3", "prettier": "3.8.4",
"react-email": "6.5.0", "react-email": "6.5.0",
"tailwindcss": "4.3.0", "tailwindcss": "4.3.1",
"tsc-alias": "1.8.17", "tsc-alias": "1.8.17",
"tsx": "4.22.3", "tsx": "4.22.4",
"typescript": "6.0.3", "typescript": "6.0.3",
"typescript-eslint": "8.60.0" "typescript-eslint": "8.60.0"
}, },
"overrides": { "overrides": {
"esbuild": "0.28.0", "esbuild": "0.28.1",
"dompurify": "3.4.0", "dompurify": "3.4.0",
"postcss": "8.5.15" "postcss": "8.5.15"
} }

View File

@@ -154,8 +154,12 @@ export async function createResourceRule(
} }
// Create the new resource rule // Create the new resource rule
if (resource.resourcePolicyId !== null) { const isInlinePolicy =
const policyId = resource.resourcePolicyId; resource.resourcePolicyId === null &&
resource.defaultResourcePolicyId !== null;
if (isInlinePolicy) {
const policyId = resource.defaultResourcePolicyId!;
const [newRule] = await db const [newRule] = await db
.insert(resourcePolicyRules) .insert(resourcePolicyRules)
.values({ .values({

View File

@@ -2,7 +2,7 @@ import { Request, Response, NextFunction } from "express";
import { z } from "zod"; import { z } from "zod";
import { db } from "@server/db"; import { db } from "@server/db";
import { resourceRules, resourcePolicyRules, resources } from "@server/db"; import { resourceRules, resourcePolicyRules, resources } from "@server/db";
import { and, eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
import response from "@server/lib/response"; import response from "@server/lib/response";
import HttpCode from "@server/types/HttpCode"; import HttpCode from "@server/types/HttpCode";
import createHttpError from "http-errors"; import createHttpError from "http-errors";
@@ -73,18 +73,14 @@ export async function deleteResourceRule(
); );
} }
if (resource.resourcePolicyId !== null) { const isInlinePolicy =
resource.resourcePolicyId === null &&
resource.defaultResourcePolicyId !== null;
if (isInlinePolicy) {
const [deletedRule] = await db const [deletedRule] = await db
.delete(resourcePolicyRules) .delete(resourcePolicyRules)
.where( .where(eq(resourcePolicyRules.ruleId, ruleId))
and(
eq(resourcePolicyRules.ruleId, ruleId),
eq(
resourcePolicyRules.resourcePolicyId,
resource.resourcePolicyId
)
)
)
.returning(); .returning();
if (!deletedRule) { if (!deletedRule) {

View File

@@ -141,10 +141,16 @@ export async function getResource(
); );
} }
const isInlinePolicy =
resource.resourcePolicyId === null &&
resource.defaultResourcePolicyId !== null;
let returnData = resource; let returnData = resource;
if (resource.resourcePolicyId !== null) { if (isInlinePolicy) {
// get the policy // get the policy
const policy = await queryInlinePolicy(resource.resourcePolicyId); const policy = await queryInlinePolicy(
resource.defaultResourcePolicyId!
);
returnData = { returnData = {
...returnData, ...returnData,
sso: policy?.sso || null, sso: policy?.sso || null,

View File

@@ -140,11 +140,15 @@ export async function listResourceRules(
); );
} }
const isInlinePolicy =
resource.resourcePolicyId === null &&
resource.defaultResourcePolicyId !== null;
let rulesList: Awaited<ReturnType<typeof queryResourceRules>>; let rulesList: Awaited<ReturnType<typeof queryResourceRules>>;
let totalCount: number; let totalCount: number;
if (resource.resourcePolicyId !== null) { if (isInlinePolicy) {
const policyId = resource.resourcePolicyId; const policyId = resource.defaultResourcePolicyId!;
const policyRules = await queryPolicyRules(policyId) const policyRules = await queryPolicyRules(policyId)
.limit(limit) .limit(limit)
.offset(offset); .offset(offset);

View File

@@ -1,8 +1,8 @@
import { Request, Response, NextFunction } from "express"; import { Request, Response, NextFunction } from "express";
import { z } from "zod"; import { z } from "zod";
import { db } from "@server/db"; import { db } from "@server/db";
import { resourcePolicyRules, resourceRules, resources } from "@server/db"; import { resourceRules, resources } from "@server/db";
import { and, eq } from "drizzle-orm"; import { eq } from "drizzle-orm";
import response from "@server/lib/response"; import response from "@server/lib/response";
import HttpCode from "@server/types/HttpCode"; import HttpCode from "@server/types/HttpCode";
import createHttpError from "http-errors"; import createHttpError from "http-errors";
@@ -37,29 +37,6 @@ const updateResourceRuleSchema = z
error: "At least one field must be provided for update" error: "At least one field must be provided for update"
}); });
function getRuleValueValidationError(
match: "CIDR" | "IP" | "PATH" | "COUNTRY" | "ASN" | "REGION",
value: string
): string | null {
if (match === "CIDR" && !isValidCIDR(value)) {
return "Invalid CIDR provided";
}
if (match === "IP" && !isValidIP(value)) {
return "Invalid IP provided";
}
if (match === "PATH" && !isValidUrlGlobPattern(value)) {
return "Invalid URL glob pattern provided";
}
if (match === "REGION" && !isValidRegionId(value)) {
return "Invalid region ID provided";
}
return null;
}
registry.registerPath({ registry.registerPath({
method: "post", method: "post",
path: "/resource/{resourceId}/rule/{ruleId}", path: "/resource/{resourceId}/rule/{ruleId}",
@@ -151,68 +128,6 @@ export async function updateResourceRule(
); );
} }
if (resource.resourcePolicyId !== null) {
const [existingRule] = await db
.select()
.from(resourcePolicyRules)
.where(
and(
eq(resourcePolicyRules.ruleId, ruleId),
eq(
resourcePolicyRules.resourcePolicyId,
resource.resourcePolicyId
)
)
)
.limit(1);
if (!existingRule) {
return next(
createHttpError(
HttpCode.NOT_FOUND,
`Resource rule with ID ${ruleId} not found`
)
);
}
const match = updateData.match || existingRule.match;
const { value } = updateData;
if (value !== undefined) {
const validationError = getRuleValueValidationError(
match,
value
);
if (validationError) {
return next(
createHttpError(HttpCode.BAD_REQUEST, validationError)
);
}
}
const [updatedRule] = await db
.update(resourcePolicyRules)
.set(updateData)
.where(
and(
eq(resourcePolicyRules.ruleId, ruleId),
eq(
resourcePolicyRules.resourcePolicyId,
resource.resourcePolicyId
)
)
)
.returning();
return response(res, {
data: updatedRule,
success: true,
error: false,
message: "Resource rule updated successfully",
status: HttpCode.OK
});
}
// Verify that the rule exists and belongs to the specified resource // Verify that the rule exists and belongs to the specified resource
const [existingRule] = await db const [existingRule] = await db
.select() .select()
@@ -242,11 +157,42 @@ export async function updateResourceRule(
const { value } = updateData; const { value } = updateData;
if (value !== undefined) { if (value !== undefined) {
const validationError = getRuleValueValidationError(match, value); if (match === "CIDR") {
if (validationError) { if (!isValidCIDR(value)) {
return next( return next(
createHttpError(HttpCode.BAD_REQUEST, validationError) createHttpError(
); HttpCode.BAD_REQUEST,
"Invalid CIDR provided"
)
);
}
} else if (match === "IP") {
if (!isValidIP(value)) {
return next(
createHttpError(
HttpCode.BAD_REQUEST,
"Invalid IP provided"
)
);
}
} else if (match === "PATH") {
if (!isValidUrlGlobPattern(value)) {
return next(
createHttpError(
HttpCode.BAD_REQUEST,
"Invalid URL glob pattern provided"
)
);
}
} else if (match === "REGION") {
if (!isValidRegionId(value)) {
return next(
createHttpError(
HttpCode.BAD_REQUEST,
"Invalid region ID provided"
)
);
}
} }
} }