chore: revert out of scope changes and fix GH_TOKEN allowlist

This commit is contained in:
Christian Gunderman
2026-05-15 11:10:48 -07:00
parent 12233fd34b
commit 62246d2fad
8 changed files with 25 additions and 69 deletions
@@ -17,7 +17,6 @@ import {
handleAtCommand,
escapeAtSymbols,
unescapeLiteralAt,
checkPermissions,
} from './atCommandProcessor.js';
import {
FileDiscoveryService,
@@ -1540,23 +1539,4 @@ describe('unescapeLiteralAt', () => {
const input = 'user@example.com and @scope/pkg';
expect(unescapeLiteralAt(escapeAtSymbols(input))).toBe(input);
});
describe('checkPermissions', () => {
it('should handle ENAMETOOLONG gracefully in checkPermissions', async () => {
const longPath = 'a'.repeat(5000);
const query = `@${longPath}`;
const localMockConfig = {
getTargetDir: () => '.',
validatePathAccess: () => true,
getResourceRegistry: () => ({
findResourceByUri: () => undefined,
}),
} as unknown as Config;
// checkPermissions should not throw ENAMETOOLONG
const permissions = await checkPermissions(query, localMockConfig);
expect(permissions).toEqual([]);
});
});
});
@@ -188,15 +188,9 @@ export async function checkPermissions(
const pathName = part.content.substring(1);
if (!pathName) continue;
let resolvedPathName: string;
try {
resolvedPathName = resolveToRealPath(
path.resolve(config.getTargetDir(), pathName),
);
} catch {
// If path resolution fails (e.g. ENAMETOOLONG), skip this path
continue;
}
const resolvedPathName = resolveToRealPath(
path.resolve(config.getTargetDir(), pathName),
);
if (config.validatePathAccess(resolvedPathName, 'read')) {
if (await fileExists(resolvedPathName)) {