* Check if the current platform is in the enabledPlatforms list. * * This is an undocumented setting that allows restricting sandbox to specific platforms. * When enabledPlatforms is not set, all supported platforms are allowed. * * Added to unblock NVIDIA enterprise rollout: they want to enabl
()
| 503 | * setting enabledPlatforms: ["macos"] to disable sandbox (and auto-allow) on other platforms. |
| 504 | */ |
| 505 | function isPlatformInEnabledList(): boolean { |
| 506 | try { |
| 507 | const settings = getInitialSettings() |
| 508 | const enabledPlatforms = ( |
| 509 | settings?.sandbox as { enabledPlatforms?: Platform[] } | undefined |
| 510 | )?.enabledPlatforms |
| 511 | |
| 512 | if (enabledPlatforms === undefined) { |
| 513 | return true |
| 514 | } |
| 515 | |
| 516 | if (enabledPlatforms.length === 0) { |
| 517 | return false |
| 518 | } |
| 519 | |
| 520 | const currentPlatform = getPlatform() |
| 521 | return enabledPlatforms.includes(currentPlatform) |
| 522 | } catch (error) { |
| 523 | logForDebugging(`Failed to check enabledPlatforms: ${error}`) |
| 524 | return true // Default to enabled if we can't read settings |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | /** |
| 529 | * Check if sandboxing is enabled |
no test coverage detected