Refuse a non-loopback NEMAR_TEST_S3_ENDPOINT in production readers

Open Beginner friendly
#2,786 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
77/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
aws, typescript
Domain
cli, security

Research direction

Read src/lib/git-annex/s3-remote.ts around readBucketAnnexUuid and src/lib/git-annex/remote-verify.ts around s3Endpoint. Check how both readers obtain NEMAR_TEST_S3_ENDPOINT, then add tests for loopback URLs and rejected non-loopback URLs. Done means both readers accept only 127.0.0.1, ::1, or localhost and return a clear error for other hosts.

Written by the indexing model from the issue text.

Description

bug

Found in the review of #2783 (epic #2713). Two production paths read NEMAR_TEST_S3_ENDPOINT from the environment (added in #2675): src/lib/git-annex/s3-remote.ts readBucketAnnexUuid (:870) and src/lib/git-annex/remote-verify.ts s3Endpoint (:186). If a real finalize ran with the variable set, the bucket marker read would go to that host signed with the real AWS credentials: the access key id and a one-GET replayable signature are exposed (not the secret), and the host can answer any uuid. Setting it needs control of the process environment, no workflow sets it, and content still goes where the git-annex record points. Fix: both readers accept only a loopback URL (127.0.0.1, ::1, localhost) and refuse anything else with a clear error; test both.

Dominant language
TypeScript
Stars
0
Forks
1
Avg merge
4h 48m
Merged PRs (30d)
468

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nemarOrg/nemar-cli

All issues in nemarOrg/nemar-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.