MCPcopy Create free account
hub / github.com/Noumena-Network/code / isSessionPlanFile

Function isSessionPlanFile

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

Source from the content-addressed store, hash-verified

253
254// Check if file is the plan file for the current session
255function isSessionPlanFile(absolutePath: string): boolean {
256 // Check if path is a plan file for this session (main or agent-specific)
257 // Main plan file: {plansDir}/{planSlug}.md
258 // Agent plan file: {plansDir}/{planSlug}-agent-{agentId}.md
259 const expectedPrefix = join(getPlansDirectory(), getPlanSlug())
260 // SECURITY: Normalize to prevent path traversal bypasses via .. segments
261 const normalizedPath = normalize(absolutePath)
262 return (
263 normalizedPath.startsWith(expectedPrefix) && normalizedPath.endsWith('.md')
264 )
265}
266
267/**
268 * Returns the session memory directory path for the current session with trailing separator.

Callers 2

Calls 3

getPlansDirectoryFunction · 0.85
getPlanSlugFunction · 0.85
normalizeFunction · 0.50

Tested by

no test coverage detected