fix(wave2): security hardening — atomic writes, dry-run, scripts gate, checksum (#142–#146) - #176
Closed
matheusmlopess wants to merge 1 commit into
Closed
fix(wave2): security hardening — atomic writes, dry-run, scripts gate, checksum (#142–#146)#176matheusmlopess wants to merge 1 commit into
matheusmlopess wants to merge 1 commit into
Conversation
…, checksum (#142–#146) #146 Atomic manifest writes: _atomic_write_json() uses temp-file + os.replace() (POSIX atomic rename) everywhere JSON manifests are written — _save_manifest, deregister_from_project, sync_to_global, register_in_project. Mid-write interrupt no longer corrupts state. #146 import --dry-run: prints agent name, version, target path, file count, scripts list, and conflict status then exits without writing anything. Works with local ZIP, --from-git, and --from-registry. #141 Pre-unpack inspection: _inspect_zip() scans ZIP member list before extraction to detect missing agent-manifest.json and enumerate scripts/ entries — no bytes are written to disk during inspection. #142 Scripts review gate: if scripts/ files are present the operator is shown a list and prompted to confirm. --allow-scripts bypasses the prompt for CI/automation use. #144 SHA-256 sidecar: wrap emits <name>-v<ver>.zip.sha256 alongside the archive (BSD sha256sum format). import --checksum <file> verifies the ZIP before any extraction and aborts on mismatch. #143 --project-root validation: when an explicit non-default value is passed, the CLI asserts the path contains a .ai/ directory before proceeding, preventing silent imports into unrelated directories. Tests: 11 new regression tests in TestWave2Security; 110 tests pass. Co-Authored-By: 🤖Factory <noreply@agentfactory.dev>
Owner
Author
|
Superseded by #177 (feature/wave2-gap-mitigations), which contains all security hardening commits from this branch plus gap mitigations and Gemini open-standard alignment. |
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
_atomic_write_json()replaces all in-place JSON writes; usestmp+os.replace()so a mid-write interrupt never corruptsagent-manifest.jsonor the global registryimport --dry-runpreviews agent name/version/target/files/scripts and conflict status, exits without writing anything; works for all three sources (ZIP,--from-git,--from-registry)_inspect_zip()reads ZIP member list before extraction to verifyagent-manifest.jsonpresence and enumeratescripts/entries; absorbed into enhancement(cli): import atomicity + safety overhaul — dry-run, pre-unpack audit, atomic write, rollback #146 scopescripts/files prompt the operator to confirm;--allow-scriptsbypasses for CIwrapemits a.sha256sidecar (BSD format);import --checksum <file>verifies SHA-256 before extraction and aborts on mismatch--project-rootvalues are validated to contain.ai/before any import proceedsTest plan
TestWave2Security— 11 new regression tests (atomic, dry-run, scripts gate, checksum, project-root)🤖 Generated with Claude Code