🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { describe, expect, it } from 'vitest';
import { assertPackageRelativePath } from './pathSafety';
describe('assertPackageRelativePath', () => {
it('accepts package-relative paths', () => {
expect(assertPackageRelativePath('SKILL.md')).toBe('SKILL.md');
expect(assertPackageRelativePath('references/checklist.md')).toBe('references/checklist.md');
});
it('rejects unsafe paths', () => {
expect(() => assertPackageRelativePath('/etc/passwd')).toThrow(
'absolute paths are not allowed',
);
expect(() => assertPackageRelativePath('../SKILL.md')).toThrow('path traversal is not allowed');
expect(() => assertPackageRelativePath('references/../../SKILL.md')).toThrow(
'path traversal is not allowed',
);
});
it('rejects paths that name object built-ins', () => {
expect(() => assertPackageRelativePath('__proto__/x.md')).toThrow(
'object built-in names are not allowed',
);
expect(() => assertPackageRelativePath('references/constructor')).toThrow(
'object built-in names are not allowed',
);
});
});