Skip to content

Annex: stop unpublished host paths reaching git-annex - #1683

Merged
neuromechanist merged 8 commits into
feature/issue-1671-epic-bru-upload-fixesfrom
feature/issue-1399-annex-description
Oct 9, 2026
Merged

neuromechanist merged 8 commits into
feature/issue-1671-epic-bru-upload-fixesfrom
feature/issue-1399-annex-description

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Change

This phase carries Bru's original fix into the epic branch and adds a pre-push privacy guard for #1399. New init and clone flows use fixed descriptions, resumed uploads fail closed if git-annex cannot verify or replace a default description, and a first push prunes unpublished git-annex history only when the remote has no git-annex branch. When an existing remote branch has unpublished default host/path descriptions for any UUID, the push stops before updating main and leaves published annex history intact. Every runtime annex-only push now uses the same guard, which sends only the checked annex commit and refuses ambiguous fetch/push destinations or URLs containing inline HTTP credentials. If the local branch advances during the push, the remaining changes are reported for retry. The NEMAR import-runner /tmp/nemar-import-* description remains permitted, as issue #1399 explicitly classifies it as harmless.

The already-published back catalogue remains untouched, so #1399 stays open for that separate decision. This PR is the epic-targeted continuation of Bru's PR #1654, and keeps his original commit.

Part of #1399.

Verification

  • bun test --timeout=15000 test/git-annex-remote.test.ts — 48 pass
  • bun test test/annex-init-description.unit.test.ts test/git-annex-export-surface.unit.test.ts — 19 pass
  • Targeted no-remote push regression test — 1 pass; bypassing the preflight makes the assertion fail
  • bun run typecheck
  • bun run lint
  • bunx biome check on changed files and git diff --check
  • Mutation checks confirmed the OID pin, all-UUID scan, and pre-main privacy gate are covered
  • Real local remotes cover split and multiple push URLs; a verbose-mode regression check confirms an embedded URL token is not logged

Retry-fetch and annex-merge failure diagnostics are implemented, but those rare branches are not directly tested because the repository's strict no-stubs policy disallows synthetic command failures. The separate #1642 sandbox E2E acceptance gap remains documented; the generic CI e2e-sandbox check does not close it.

bruAristimunha and others added 2 commits October 8, 2026 18:03
'git annex init' with no description writes user@host:/absolute/path into
the git-annex branch's uuid.log, which is public once a dataset is
(a cluster upload records login name, node and scratch path).

- initDataset and ensureGitAnnexInitialized pass 'nemar-deposit';
  cloneDataset passes 'nemar-clone' (admin/CI clones were adding their own
  entries, see the #1399 comment).
- The upload's init step replaces an existing default description (a repo
  initialized by an older CLI, e.g. a resumed upload) before anything is
  pushed; a description someone chose is left alone. Paths under $HOME,
  which git-annex writes as user@host:~/path, are recognised too.

The old value stays in the history of an already-pushed git-annex branch;
scrubbing that is the separate back-catalogue decision in #1399.
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR1683

Version: 0.10.16-PR1683.93de852
Commit: 93de852


🤖 Updated on each push.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review findings and resolutions for PR #1683 at d696f711:

  • The git annex init publishes the depositor's username, host and local path #1399 explanation and import-runner exception comments were clarified in 8931c128.
  • The review found raw runtime pushes of git-annex could bypass the description-history guard. Dataset update/push flows and the E2E update now use pushAnnexBranchToGitHub, which is also used by the main push path.
  • Split fetch/push URLs and multiple push destinations now fail closed. The helper uses the single verified target and refuses HTTP URLs with embedded credentials. URL-inspection subprocess output is suppressed from verbose logs; a real Git remote test verifies the token is absent.
  • Retry fetch/merge failures now report the failing operation and its diagnostic alongside the original push rejection. Retry preflight failure preserves the prior fatal result after the main branch is pushed.
  • Stub-based tests for retry-fetch and annex-merge failures were removed to comply with .rules/testing.md's no-stubs policy. Those rare retry-failure branches therefore remain without direct tests.

Independent review found no unresolved findings. Local checks passed: 48 git-annex-remote tests, 19 annex-init/export tests, typecheck, lint, and git diff --check.

The separate #1642 sandbox E2E acceptance gap remains documented and was not run for this review; the generic CI e2e-sandbox check does not close that gap.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

The CI failure on the prior head was the no-remote push test expecting the old Git error even though the new privacy preflight stops first. I updated that expectation in c885d88a, reran the targeted test successfully (1 pass), and verified the assertion fails when the preflight is temporarily bypassed. The generic e2e-sandbox job passing still does not satisfy #1642, so that acceptance gap remains documented.

@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review follow-up for final head 93de852550e522deb742fc425de3091fb95319e8:

  • After the annex push, the code fetches the actual remote tip and reconciles the tracking ref with compare-and-swap, preserving a newer or divergent ref if a concurrent fetch wins. It handles a missing ref atomically and retries up to three times when a concurrent update leaves the fetched tip as an ancestor; exhaustion reports the last Git error.
  • A real-Git integration test advances git-annex in a bare remote's post-receive hook while the original push completes, then verifies the tracking ref matches the remote tip rather than the older pushed tip. Temporarily restoring the former unconditional local-OID update makes this test fail.
  • The independent review follow-up found no actionable issue. The direct read-to-CAS-loser retry path is not forced by a deterministic test; doing so would require a test seam, synthetic failure, or flaky stress race, which conflicts with .rules/testing.md's no-stubs policy.
  • Local validation on this head: bun test test/normalize-dataset.test.ts (16/16), typecheck, lint, formatting, and git diff --check pass. Exact-head CI is still running; its status will be checked before merge.

This branch was previously deployed

1 inactive deployment
npm — 93de8525 Deployed Oct 9, 2026 by neuromechanist via publish #3269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants