Features: - 30+ Custom Skills (cognitive, development, UI/UX, autonomous agents) - RalphLoop autonomous agent integration - Multi-AI consultation (Qwen) - Agent management system with sync capabilities - Custom hooks for session management - MCP servers integration - Plugin marketplace setup - Comprehensive installation script Components: - Skills: always-use-superpowers, ralph, brainstorming, ui-ux-pro-max, etc. - Agents: 100+ agents across engineering, marketing, product, etc. - Hooks: session-start-superpowers, qwen-consult, ralph-auto-trigger - Commands: /brainstorm, /write-plan, /execute-plan - MCP Servers: zai-mcp-server, web-search-prime, web-reader, zread - Binaries: ralphloop wrapper Installation: ./supercharge.sh
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { tmpdir } from 'node:os';
|
|
|
|
export function isTmpdirOverriddenToNonTemp(envAssignments: Map<string, string>): boolean {
|
|
if (!envAssignments.has('TMPDIR')) {
|
|
return false;
|
|
}
|
|
const tmpdirValue = envAssignments.get('TMPDIR') ?? '';
|
|
|
|
// Empty TMPDIR is dangerous: $TMPDIR/foo expands to /foo
|
|
if (tmpdirValue === '') {
|
|
return true;
|
|
}
|
|
|
|
// Check if it's a known temp path (exact match or subpath)
|
|
const sysTmpdir = tmpdir();
|
|
if (
|
|
isPathOrSubpath(tmpdirValue, '/tmp') ||
|
|
isPathOrSubpath(tmpdirValue, '/var/tmp') ||
|
|
isPathOrSubpath(tmpdirValue, sysTmpdir)
|
|
) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Check if a path equals or is a subpath of basePath.
|
|
* E.g., isPathOrSubpath("/tmp/foo", "/tmp") → true
|
|
* isPathOrSubpath("/tmp-malicious", "/tmp") → false
|
|
*/
|
|
function isPathOrSubpath(path: string, basePath: string): boolean {
|
|
if (path === basePath) {
|
|
return true;
|
|
}
|
|
// Ensure basePath ends with / for proper prefix matching
|
|
const baseWithSlash = basePath.endsWith('/') ? basePath : `${basePath}/`;
|
|
return path.startsWith(baseWithSlash);
|
|
}
|