Repository navigation
M1 slice 2: amicode service — vault family (vaults, warrants, vault-browser, file-resolve) #465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // AMICODE SERVICE (#451): the loopback gate shared by the vault-browser and | ||
| // credentials surfaces. isLoopbackHostname is ported VERBATIM from the fork's | ||
| // connections.ts @ v1.18.10-amicode.11 (same 127/8 + v4-mapped families); the | ||
| // bind hostname is stamped by the service at listen time (the extension-host | ||
| // service binds 127.0.0.1 by construction — the seam exists so a future | ||
| // non-loopback bind keeps the fail-closed law honest). | ||
|
|
||
| let bindHostname: string | undefined; | ||
|
|
||
| /** Stamp the bind hostname (call once, at listen). */ | ||
| export function setBindHostname(host: string | undefined): void { | ||
| bindHostname = host; | ||
| } | ||
|
|
||
| /** The current bind hostname — shared with the vault-browser routes, whose | ||
| * loopback gate rides the same signal as the credential-mutation guard. */ | ||
| export function getBindHostname(): string | undefined { | ||
| return bindHostname; | ||
| } | ||
|
|
||
| /** Same loopback family the mdns gate recognizes (server.ts), widened to the | ||
| * whole 127/8 block and the v4-mapped form. undefined = in-process handler. */ | ||
| export function isLoopbackHostname(hostname: string | undefined): boolean { | ||
| if (hostname === undefined) return true; | ||
| const host = hostname.toLowerCase(); | ||
| if (host === "localhost" || host === "::1") return true; | ||
| if (/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(host)) return true; | ||
| if (host.startsWith("::ffff:127.")) return true; | ||
| return false; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Add parity coverage for tier-2 home-expanded file references.
resolveFileRefsupports~/..., but the recorded contract does not exercise it. The PR objective states that all resolve-file tiers are covered.packages/extension/scripts/record_amicode_fixtures.mjs#L92-L116: add a/amicode/resolve-file?path=~%2F.amico%2Fprofile.jsonrequest.packages/extension/test/amicode_service_contract.test.ts#L58-L62: save, set, and restoreHOMEassandboxso the port uses the same home directory as the recorded fork.packages/extension/test/fixtures/amicode/golden.json#L152-L195: regenerate the fixture after recording the new request.📍 Affects 3 files
packages/extension/scripts/record_amicode_fixtures.mjs#L92-L116(this comment)packages/extension/test/amicode_service_contract.test.ts#L58-L62packages/extension/test/fixtures/amicode/golden.json#L152-L195🤖 Prompt for AI Agents