MCPcopy Create free account
hub / github.com/apache/maka / nestedShellPayload

Function nestedShellPayload

packages/core/src/permission.ts:299–310  ·  view source on GitHub ↗
(segment: string)

Source from the content-addressed store, hash-verified

297}
298
299function nestedShellPayload(segment: string): string | undefined {
300 const head = /^\S*/.exec(segment)![0];
301 for (const shell of NESTED_SHELL_HEADS) {
302 if (!shell.head.test(head)) continue;
303 const match = shell.flag.exec(segment);
304 if (!match) return undefined;
305 const payload = match[1]!.trim();
306 const unquoted = /^(['"])([\s\S]*)\1$/.exec(payload);
307 return unquoted ? unquoted[2] : payload;
308 }
309 return undefined;
310}
311
312function isPrivilegedSegment(segment: string): boolean {
313 const lower = segment.toLowerCase();

Callers 1

scanSegmentsFunction · 0.85

Calls 3

execMethod · 0.65
testMethod · 0.65
trimMethod · 0.45

Tested by

no test coverage detected