MCPcopy
hub / github.com/codeaashu/claude-code / isSessionPlanFile

Function isSessionPlanFile

src/utils/permissions/filesystem.ts:245–255  ·  view source on GitHub ↗
(absolutePath: string)

Source from the content-addressed store, hash-verified

243
244// Check if file is the plan file for the current session
245function isSessionPlanFile(absolutePath: string): boolean {
246 // Check if path is a plan file for this session (main or agent-specific)
247 // Main plan file: {plansDir}/{planSlug}.md
248 // Agent plan file: {plansDir}/{planSlug}-agent-{agentId}.md
249 const expectedPrefix = join(getPlansDirectory(), getPlanSlug())
250 // SECURITY: Normalize to prevent path traversal bypasses via .. segments
251 const normalizedPath = normalize(absolutePath)
252 return (
253 normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith('.md')
254 )
255}
256
257/**
258 * Returns the session memory directory path for the current session with trailing separator.

Callers 2

Calls 2

getPlanSlugFunction · 0.85
normalizeFunction · 0.50

Tested by

no test coverage detected