[pkg firewall] wire up endor-vscode.ps1 and document the ecosystem - #31
Open
dekkagaijin wants to merge 1 commit into
Open
[pkg firewall] wire up endor-vscode.ps1 and document the ecosystem#31dekkagaijin wants to merge 1 commit into
dekkagaijin wants to merge 1 commit into
Conversation
Final chunk. Completes the Windows side and adds the top-level documentation,
which only becomes true once both platforms are in.
powershell/templates/vscode.ps1 the ecosystem template
powershell/templates/remove.ps1 watcher first, then unpatch per install
powershell/templates/script-header.ps1 -NoVSCodeWatcher
powershell/generate.ps1 gallery base, block assignment, repatch
payload builder
powershell/README.md per-script behaviour and prerequisites
package-firewall/README.md, README.md ecosystem tables, tests section
One behaviour here is worth reading closely. In repatch mode the template must
NOT recompute the attributed token: the Scheduled Task can fire at startup with
nobody logged in, so $ConsoleUser is empty there, and recomputing would mint a
token attributed to no user at all — losing the attribution that makes firewall
events traceable to a developer. The prelude reads the URL rendered at install
time out of the sidecar state instead, and the template refuses to patch if that
URL is empty rather than proceeding with a bad one.
The repatch payload is written from the base64 embedded at generation time, not
copied from $PSCommandPath: MDM tools routinely run scripts from a temp file that
is already gone by the time the task fires.
Also fixes stale documentation the VS Code work turned up, predating the
user-attribution change: both READMEs conflated generation-time and install-time
placeholders, listed NPM_AUTH_B64 / PYPI_URL / PIP_INDEX_URL / GO_PROXY_URL as
generation-time when they are install-time fills, omitted the real API_SECRET_B64
and FQDN_HOST, and bash/README.md claimed env.sh still exports ENDOR_PYPI_URL.
Tests: 43 assertions over the generated PowerShell. The installer cannot run
wholesale off-Windows — its header calls [WindowsIdentity]::GetCurrent() — so the
header is stubbed and everything after it is extracted verbatim from the generated
file and executed for real: block splitting, token construction, the patch loop,
state writes, the watcher call, the repatch counter. The stub is deliberately
narrow so what is not covered stays obvious. Among the assertions: the token is
recomputed independently from the attribution scheme, and repatch is checked to
reuse that same token rather than deriving a new one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dekkagaijin
force-pushed
the
vscode-fw-8-powershell-wiring
branch
from
August 6, 2026 16:10
67eeded to
b2d7209
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.
Merge after #30
Final chunk. Completes the Windows side and adds the top-level documentation, which only becomes true once both platforms are in.
powershell/templates/vscode.ps1 the ecosystem template
powershell/templates/remove.ps1 watcher first, then unpatch per install
powershell/templates/script-header.ps1 -NoVSCodeWatcher
powershell/generate.ps1 gallery base, block assignment, repatch
payload builder
powershell/README.md per-script behaviour and prerequisites
package-firewall/README.md, README.md ecosystem tables, tests section
One behaviour here is worth reading closely. In repatch mode the template must NOT recompute the attributed token: the Scheduled Task can fire at startup with nobody logged in, so $ConsoleUser is empty there, and recomputing would mint a token attributed to no user at all — losing the attribution that makes firewall events traceable to a developer. The prelude reads the URL rendered at install time out of the sidecar state instead, and the template refuses to patch if that URL is empty rather than proceeding with a bad one.
The repatch payload is written from the base64 embedded at generation time, not copied from $PSCommandPath: MDM tools routinely run scripts from a temp file that is already gone by the time the task fires.
Also fixes stale documentation the VS Code work turned up, predating the user-attribution change: both READMEs conflated generation-time and install-time placeholders, listed NPM_AUTH_B64 / PYPI_URL / PIP_INDEX_URL / GO_PROXY_URL as generation-time when they are install-time fills, omitted the real API_SECRET_B64 and FQDN_HOST, and bash/README.md claimed env.sh still exports ENDOR_PYPI_URL.
Tests: 43 assertions over the generated PowerShell. The installer cannot run wholesale off-Windows — its header calls [WindowsIdentity]::GetCurrent() — so the header is stubbed and everything after it is extracted verbatim from the generated file and executed for real: block splitting, token construction, the patch loop, state writes, the watcher call, the repatch counter. The stub is deliberately narrow so what is not covered stays obvious. Among the assertions: the token is recomputed independently from the attribution scheme, and repatch is checked to reuse that same token rather than deriving a new one.
https://endorlabs.atlassian.net/browse/LM-452