authorisedList entries with * never match repository URLs

オープン
#1,589 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
git, github, nodejs, typescript

調査の方向性

getRepoByUrl エントリポイントから開始し、authorisedList の検索と db.getRepos へのアクセスを追跡します。GitHub 組織のワイルドカードケースをプロキシ経由で再現し、ワイルドカード URL エントリと完全一致 URL エントリの両方が、.git 付きと .git なしのリポジトリ URL を含めて正しく解決されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

enhancement

Describe the bug

getRepoByUrl performs an exact URL lookup on authorisedList. Entries intended as org-level wildcards, e.g. https://github.com/example-org/*, do not match concrete repo URLs such as https://github.com/example-org/some-repo.git. There is no way to allowlist all repos under an org without enumerating every URL.

To Reproduce

Steps to reproduce the behavior:

  1. Run @finos/[email protected].
  2. Add an authorised list entry: { "url": "https://github.com/example-org/*" }
  3. Clone or pull https://github.com/example-org/some-repo through the proxy.
  4. See error: repo not found on authorised list / request rejected as unauthorised.

Expected behavior

https://github.com/example-org/* should match any repo under that org, e.g. https://github.com/example-org/foo and https://github.com/example-org/foo.git. For github.com, repo URLs are always owner/repo. Exact URL entries should continue to work as today.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: Linux; macOS
  • Browser: N/A (HTTP client / git CLI)
  • Version: Node 20+; @finos/git-proxy 2.0.0

Smartphone (please complete the following information):

  • Device: N/A
  • OS: N/A
  • Browser: N/A
  • Version: N/A

Additional context

Suggested fallback when exact lookup misses:

function wildcardToRegExp(pattern) {
  const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
  return new RegExp('^' + escaped.replace(/\*/g, '[^/]+') + '$');
}

const originalGetRepoByUrl = db.getRepoByUrl;
db.getRepoByUrl = async function (url) {
  const exact = await originalGetRepoByUrl(url);
  if (exact) return exact;
  for (const repo of await db.getRepos()) {
    if (repo.url?.includes('*') && wildcardToRegExp(repo.url).test(url)) {
      return repo;
    }
  }
  return null;
};

Happy to open a PR if useful.

主要言語
TypeScript
スター
263
フォーク
185
平均マージ
2日 15時間
マージ済み PR(30日)
39

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

finos/git-proxy のほかの issue

finos/git-proxy の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。