Protect agent files from deletion and enforce abilities-first architecture#375
Merged
Merged
Conversation
…lities layer - Add PROTECTED_FILES constant to FileAbilities (SOUL.md, MEMORY.md) - Guard deleteAgentFile() against deleting protected files - Add defense-in-depth protected file check in REST delete endpoint - Create datamachine/write-agent-file ability with empty-content guard - Delegate put_agent_file() REST endpoint to abilities layer - Add deleteDaily() to DailyMemoryAbilities with settings check - Route all 4 daily memory REST endpoints through DailyMemoryAbilities - Protect MEMORY.md from deletion in AgentFileList.jsx UI - Remove direct DailyMemory/DirectoryManager/FilesystemHelper usage from Files.php Closes #366, closes #367
e73b3af to
59fc448
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two security/architecture gaps in the file operations layer:
put_agent_file()wrote directly via DirectoryManager/FilesystemHelper. All 4 daily memory endpoints instantiatedDailyMemorydirectly, skipping thedaily_memory_enabledsettings check.Changes
Issue #366 — Protected file deletion
FileAbilities::PROTECTED_FILESconstant (SOUL.md,MEMORY.md)deleteAgentFile()in abilities layer — returns error for protected filesdelete_agent_file()also checks before delegatingAgentFileList.jsxnow protects MEMORY.md alongside SOUL.md (was only SOUL.md)Issue #367 — Abilities-first enforcement
datamachine/write-agent-fileability withexecuteWriteAgentFile()methodput_agent_file()REST endpoint now delegates to abilities layerdatamachine/daily-memory-deleteability inDailyMemoryAbilitiesDailyMemoryAbilitiesput_daily_file()anddelete_daily_file()now respectdaily_memory_enabledsettingDailyMemory,DirectoryManager,FilesystemHelperimports fromFiles.phpArchitecture
Files Changed
inc/Abilities/FileAbilities.phpinc/Abilities/DailyMemoryAbilities.phpinc/Api/Files.phpAgentFileList.jsxCloses #366, closes #367