Category: ScannerGoMITv0.1.1

repojack

Finds dependencies that point at a deleted or renamed GitHub account, so someone else could register the name and serve that code. It reads go.mod, GitHub Actions, npm, pip, Cargo and git submodules, and it does not need a token.

go install github.com/ucsurf/repojack/cmd/repojack@latest

View on GitHubRelease v0.1.1

What it does

When a GitHub user or organization is renamed or deleted, the old name can be registered again. Dependencies that still say github.com/<old-name>/<repo> then fetch from whoever takes the name. The README calls this repojacking, and it notes that GitHub’s retired-namespace protection covers repositories with more than 100 clones in the week before the rename.

repojack reads your manifests and asks github.com whether each owner still exists. For each owner it sends one HEAD https://github.com/<owner>. A 404 means the account does not exist. Only then does it request github.com/<owner>/<repo>. A redirect means the account was renamed: the dependency still resolves today, and the old name can still be registered. It talks to the github.com website, not the REST API, so there is no token and no API rate limit to configure. Results are cached per owner.

Files it reads, from the README:

  • go.mod require and replace lines on github.com/... (the module’s own path is ignored)
  • .github/workflows/*.yml and action.yml uses: owner/repo@ref (local ./ and docker:// are ignored)
  • package.json GitHub dependencies, overrides and resolutions
  • requirements*.txt, pyproject.toml and Pipfile lines with git+https://github.com/...
  • Cargo.toml git = "https://github.com/..."
  • .gitmodules URLs on github.com

node_modules, vendor, testdata, .git and virtualenvs are skipped.

The README also shows a run on a local Grafana checkout: 3792 GitHub references checked, 0 hijackable. That figure is the README’s example.

Limits

An owner that exists because someone else re-registered the name looks fine. Pin by commit SHA or checksum (go.sum, lockfiles) if you need to notice a content change. The tool cannot tell whether GitHub has retired a popular namespace. It only checks github.com. A manifest stops being read at the first line longer than 1 MiB, and package.json is read only for its dependency sections, not scripts. Very large repositories can hit rate limits; the README says to lower -concurrency if you see errors.

Usage

  1. Scan a local project

    The README’s example against its testdata/proj fixture reports missing owners such as ghost-owner-rj404. Exit 1 means something is hijackable, 2 is a usage error, and 0 is otherwise.

    repojack testdata/proj
  2. List references without using the network

    repojack -list .
  3. JSON output, with owners to skip

    Formats in the README are text (the default), json and sarif. The default concurrency is 4.

    repojack -format json -ignore a,b/c -concurrency 4 .
  4. GitHub Action

    The README says the action downloads the prebuilt release binary and checks it against checksums.txt. Inputs are path (default .), ignore, sarif and version.

    name: repojack
    on:
      push:
      pull_request:
      schedule:
        - cron: "0 6 * * 1"   # owners can disappear at any time, so re-check weekly
    permissions:
      contents: read
    jobs:
      repojack:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
            with:
              persist-credentials: false
          - uses: ucsurf/repojack@v0.1.1
  5. pre-commit

    repos:
      - repo: https://github.com/ucsurf/repojack
        rev: v0.1.1
        hooks:
          - id: repojack

Machine-readable: JSON · Markdown · ID repojack

More tools

  • lockreview

    Reviews GitHub Actions lockfile (actions.lock) diffs and flags repository identity changes, impostor commits, ref rollbacks, new transitive actions, and runs/dist changes.

    ucsurf/lockreview
  • hookjack

    Static scanner for commands that AI assistants and IDEs run on their own when you open a repository.

    ucsurf/hookjack
  • disclose

    Finds where to report a vulnerability.

    ucsurf/disclose
  • vuln-patterns

    Semgrep rules taken from vulnerabilities that are already public.

    ucsurf/vuln-patterns
  • pwnreq

    Finds GitHub Actions workflows where someone without write access can run code that sees repository secrets: pwn requests and script injection.

    ucsurf/pwnreq