MCPcopy Index your code
hub / github.com/simstudioai/sim / validateSupabaseProjectId

Function validateSupabaseProjectId

apps/sim/lib/core/security/input-validation.ts:1456–1490  ·  view source on GitHub ↗
(
  value: string | null | undefined,
  paramName = 'projectId'
)

Source from the content-addressed store, hash-verified

1454 * @returns ValidationResult
1455 */
1456export function validateSupabaseProjectId(
1457 value: string | null | undefined,
1458 paramName = 'projectId'
1459): ValidationResult {
1460 if (value === null || value === undefined || value === '') {
1461 return {
1462 isValid: false,
1463 error: `${paramName} is required`,
1464 }
1465 }
1466
1467 if (!/^[a-z0-9]+$/.test(value)) {
1468 logger.warn('Invalid Supabase project ID format', {
1469 paramName,
1470 value: value.substring(0, 50),
1471 })
1472 return {
1473 isValid: false,
1474 error: `${paramName} must contain only lowercase alphanumeric characters`,
1475 }
1476 }
1477
1478 if (value.length < 10 || value.length > 40) {
1479 logger.warn('Supabase project ID length invalid', {
1480 paramName,
1481 length: value.length,
1482 })
1483 return {
1484 isValid: false,
1485 error: `${paramName} must be between 10 and 40 characters`,
1486 }
1487 }
1488
1489 return { isValid: true, sanitized: value }
1490}
1491
1492export function isMicrosoftContentUrl(url: string): boolean {
1493 let hostname: string

Callers 3

supabaseBaseUrlFunction · 0.90
route.tsFile · 0.90

Calls 2

testMethod · 0.80
warnMethod · 0.65

Tested by

no test coverage detected