chore(hardening): extend private-address blocking and verify downloaded artifacts - #1
Merged
Merged
Conversation
…ed artifacts Mirror each private IPv4 range into the NAT64 well-known prefix (RFC 6052 64:ff9b::/96) so a NAT64 network cannot be used to reach a private v4 target through an IPv6 literal, and block the RFC 8215 local-use prefix wholesale. Public IPv4 addresses reached over NAT64 stay allowed. Applied to both engine copies of the fetch provider. Give the capability downloader an optional expectedSha256: the digest is computed while streaming and a mismatch removes the file before throwing, so an unverified artifact is never left on disk for a later step to run. Leave the quarantine attribute on the downloaded macOS bundle in place so Gatekeeper still evaluates it on first launch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Two defence-in-depth gaps in this fork's baseline (v0.34.0):
64:ff9b::/96. Those are ordinary IPv6 addresses, so on a NAT64 network a request to64:ff9b::<private v4>translates straight through to the embedded target.What changed
Address blocking (both engine copies —
agent-coreandagent-core-v2):96 + <v4 prefix bits>), derived from a single list rather than duplicated literals.64:ff9b:1::/48has no fixed embedding offset, so it is blocked wholesale.Artifact integrity (
agent-core-v2capability host):downloadToFiletakes an optionalexpectedSha256, computed while streaming (no re-read). On mismatch the partial file is removed before throwing, so an unverified artifact is never left where a later step could execute it. Backwards compatible: unset means today's behaviour.xattr -dr com.apple.quarantinecall on the downloaded.appis removed. The bundle is fetched over the network and is not checked against a published digest, so Gatekeeper stays the backstop.Testing
downloadToFilecases: matching digest is kept, mismatching digest throws and leaves nothing on disk.oxlintclean on changed files;tsc --noEmitclean for both packages.Checklist
patchfor both packages).