Add PAT authentication for git wiki sync; rebuild devcontainer on MCR node base - #57
Merged
Merged
Conversation
Switch the devcontainer image from a hand-rolled debian:bookworm-slim to mcr.microsoft.com/devcontainers/javascript-node:22-bookworm so node/npm ship in the image layers instead of being fetched from the public npm registry during the build. - Drop the node feature (base provides it) and the playwright feature (which pulled the node feature back in via dependsOn). Chromium for PDF export now comes from Debian apt and is auto-detected on PATH by chromedp. - Keep the go feature (installs from go.dev) and sshd. - Use the base image's native non-root 'node' user; update the home mount target and postCreate accordingly. - Pass NPM_CONFIG_REGISTRY through from the host via remoteEnv so machines behind a corporate npm proxy can still install webui deps at postAttach. It references npm's standard variable, not a hardcoded URL, so it is empty and harmless on public/CI machines.
Let users provide a personal access token to authenticate HTTPS git sync when the machine's own git credentials (gh, keychain, SSH) aren't usable. - config: Token on SyncConfig (global default) and SyncMapping (per-remote override); TokenForRemote resolution (mapping -> default -> none) and AddMappingFull that preserves a stored token when none is supplied. - sync: inject the token via a GIT_ASKPASS helper on fetch/push only, so it never lands in .git/config, the remote URL, or a process argument. Reset the inherited credential-helper chain so a broken helper can't shadow it, and scrub the token from surfaced errors and logs. - mcp: optional token on register_sync via a new SyncRegistrarWithToken interface, with graceful fallback; updated tool description. - httpapi: redact tokens in the settings API (never echo the raw value); re-saving the mask preserves the stored token, empty clears, new replaces. - webui: password-style token field under Default Remote, plus a live Sync Status panel that surfaces per-remote last-sync/errors/conflicts from the previously-unused /api/sync/status endpoint. Tokens fill the gap for 2FA accounts, where a PAT is the required HTTPS mechanism. Falls back to existing git credentials when no token is set.
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
Two related changes, developed together in a rebuilt devcontainer:
gh, keychain, SSH) aren't usable. This is the required mechanism for 2FA accounts, where a PAT stands in for password+2FA at push time.PAT authentication
TokenonSyncConfig(global default) andSyncMapping(per-remote override);TokenForRemoteresolution (mapping → default → none) andAddMappingFullthat preserves a stored token when none is supplied.GIT_ASKPASShelper onfetch/pushonly, so it never lands in.git/config, the remote URL, or a process argument. Resets the inherited credential-helper chain so a broken helper can't shadow it, and scrubs the token from surfaced errors and logs.tokenonregister_syncvia a newSyncRegistrarWithTokeninterface with graceful fallback; updated tool description./api/sync/statusendpoint.Falls back to existing git credentials when no token is set, so existing setups are unaffected.
Security notes
GIT_ASKPASS(env var), never written to disk orps-visible args.GET/PUTreturn********; the raw value lives only in the local~/.mind-map/config.json(0600).Devcontainer restructure
FROM mcr.microsoft.com/devcontainers/javascript-node:22-bookworm— node/npm ship in the image layers instead of being fetched from the npm registry during the build.nodefeature (base provides it) and theplaywrightfeature (which pulled the node feature back in viadependsOn). Chromium for PDF export now comes from Debian apt and is auto-detected on PATH bychromedp.gofeature (installs from go.dev) andsshd. Use the base image's native non-rootnodeuser; update the home mount target andpostCreate.NPM_CONFIG_REGISTRYthrough from the host viaremoteEnvso machines behind a corporate npm proxy can still install webui deps atpostAttach. References npm's standard variable, not a hardcoded URL, so it's empty and harmless on public/CI machines.Testing
go test ./...passes in a clean rebuild of the devcontainer, includinginternal/share(PDF export driving Chromium).GIT_ASKPASSbehavior incl. token-not-on-disk (sync), and the settings redaction round-trip (httpapi).remoteEnvchain end-to-end and the.mind-maphome mount for thenodeuser.