MCPcopy Create free account
hub / github.com/Noumena-Network/code / getLinuxGlobPatternWarnings

Function getLinuxGlobPatternWarnings

src/utils/sandbox/sandbox-adapter.ts:612–657  ·  view source on GitHub ↗

* Get glob patterns that won't work fully on Linux/WSL

()

Source from the content-addressed store, hash-verified

610 * Get glob patterns that won't work fully on Linux/WSL
611 */
612function getLinuxGlobPatternWarnings(): string[] {
613 // Only return warnings on Linux/WSL (bubblewrap doesn't support globs)
614 const platform = getPlatform()
615 if (platform !== 'linux' && platform !== 'wsl') {
616 return []
617 }
618
619 try {
620 const settings = getSettings_DEPRECATED()
621
622 // Only return warnings when sandboxing is enabled (check settings directly, not cached value)
623 if (!settings?.sandbox?.enabled) {
624 return []
625 }
626
627 const permissions = settings?.permissions || {}
628 const warnings: string[] = []
629
630 // Helper to check if a path has glob characters (excluding trailing /**)
631 const hasGlobs = (path: string): boolean => {
632 const stripped = path.replace(/\/\*\*$/, '')
633 return /[*?[\]]/.test(stripped)
634 }
635
636 // Check all permission rules
637 for (const ruleString of [
638 ...(permissions.allow || []),
639 ...(permissions.deny || []),
640 ]) {
641 const rule = permissionRuleValueFromString(ruleString)
642 if (
643 (rule.toolName === FILE_EDIT_TOOL_NAME ||
644 rule.toolName === FILE_READ_TOOL_NAME) &&
645 rule.ruleContent &&
646 hasGlobs(rule.ruleContent)
647 ) {
648 warnings.push(ruleString)
649 }
650 }
651
652 return warnings
653 } catch (error) {
654 logForDebugging(`Failed to get Linux glob pattern warnings: ${error}`)
655 return []
656 }
657}
658
659/**
660 * Check if sandbox settings are locked by policy

Callers

nothing calls this directly

Calls 4

getPlatformFunction · 0.85
hasGlobsFunction · 0.85
logForDebuggingFunction · 0.50

Tested by

no test coverage detected