git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist

From
Christian Couder <christian.couder@gmail.com>
Date
May 27, 2026, 14:08 UTC
Message-ID
<20260527140820.1438165-1-christian.couder@gmail.com>
In-Reply-To
<20260519153808.494105-1-christian.couder@gmail.com>

Currently, the "promisor-remote" protocol capability allows a server to advertise promisor remotes (and their tokens/filters), but the client's `promisor.acceptFromServer` mechanism requires these remotes to already exist in the config.

This is a significant burden for users and administrators who have to pre-configure remotes.

This patch series improves on this by introducing a new `promisor.acceptFromServerUrl` config option, which provides an additive, URL-based security allowlist.

Multiple `promisor.acceptFromServerUrl` config options can be provided in different config files. Each one should contain a URL glob pattern which can optionally be prefixed with a remote name in the "[<name>=]<pattern>" format.

The goal is for something like a simple:
  git config set --global promisor.acceptFromServerUrl "https://my-org.com/*"
to be all that is needed for internal work in many organizations. 
With this new config option:
 - The server can update fields (like tokens) for known remotes,
   provided their URL matches the allowlist, even if
   `acceptFromServer` is set to `None`.
 - Unknown remotes advertised by the server can be automatically
   configured on the client if their URL matches the allowlist.
 - If there is no `<name>` prefix before the glob pattern matched, the
   auto-configured remote is named using the
   "promisor-auto-<sanitized-url>" format. So the same auto-configured
   remote config entry will be reused for the same URL.
 - If a `<name>` prefix is provided, it will be used for the
   auto-configured remote config entry.
 - If the chosen name (auto-generated or prefixed) already exists but
   points to a different URL, overwriting the existing config is
   prevented by appending a numeric suffix (e.g., -1, -2) to the name
   and auto-configuring using that name.
 - The server's originally advertised name is always saved in the
   `remote.<name>.advertisedAs` config variable of the auto-configured
   remote for tracing and debugging.
Security considerations:
 - Advertised URLs and glob patterns are routed through
   url_normalize() / url_normalize_pattern() before matching, to
   prevent percent-encoding, case variation, or path-traversal (..)
   bypasses.
 - URL matching is done component by component: scheme and port
   must match exactly (no wildcards), the host is matched with
   WM_PATHNAME so a '*' cannot cross the '/' boundary into the
   path, and the path is matched without WM_PATHNAME so '*' can
   still span multi-level paths.
 - Auto-generated remote names are sanitized (non-alphanumeric
   characters are replaced with '-', runs of '-' are collapsed)
   and prefixed with 'promisor-auto-'. User-supplied names (from
   the 'name=<pattern>' syntax) are validated with
   valid_remote_name(). Together, these prevent a server from
   maliciously overwriting standard remotes (like 'origin').
 - If the auto-generated or user-supplied name collides with an
   existing remote configured to a different URL, a numeric
   suffix ('-1', '-2', ...) is appended, up to a bounded limit,
   so a server cannot hijack an existing remote by name.
 - Known remotes are still subject to URL consistency checks:
   even if an advertised URL matches the allowlist, it is only
   accepted for a known remote if it matches the URL already
   configured locally for that remote.
 - The documentation explains in detail how to write secure glob
   patterns in `promisor.acceptFromServerUrl`, and highlights the
   risks of overly broad patterns on shared hosting platforms.

High level description of the patches =====================================

 - Patch 1/8 is a very small preparatory patch that simplifies some
   tests a bit.
 - Patches 2/8 and 3/8 expose and adapt a url_normalize_pattern()
   helper function in the urlmatch API.
 - Patch 4/8 adapts `struct promisor_info` by adding a new
   `local_name` member to it to prepare for the next patches.
 - Patches 5/8 to 7/8 implement the core feature. They introduce the
   parsing machinery, add the additive allowlist for known remotes
   (with url_normalize() security), and finally implement the
   auto-creation and collision resolution for unknown remotes.
 - Patch 8/8 cleans up and modernizes the existing
   `promisor.acceptFromServer` documentation.

Changes compared to v3 ======================

Thanks to Toon, Kristoffer, Patrick and Junio for reviewing the previous versions of this series and of the preparatory series.

This has been rebased onto master @ 56a4f3c3a2 (The 8th batch, 2026-05-25) to avoid a trivial conflict in "urlmatch.c".

Only minor changes have been made since v3, in the following patches:
 - Patch 4/8 ("promisor-remote: add 'local_name' to 'struct
   promisor_info'"):
   - The promisor_info_internal_name() function has been renamed
     promisor_info_local_name() for clarity.
   - A `const char *local` local variable has been renamed
     `remote_name` for consistency with another similar variable.
 - Patch 6/8 ("promisor-remote: trust known remotes matching
   acceptFromServerUrl"):
   - A spurious comma in the commit message has been deleted.
   - The `promisor.acceptFromServerUrl` documentation in
     "Documentation/config/promisor.adoc" now uses `--` to separate a
     numbered list from the surrounding paragraphs.

CI tests ========

They all pass, see:
https://github.com/chriscool/git/actions/runs/26514308470

Range diff since v3 ===================

1:  ab231c0896 = 1:  9fcc7d9d5e t5710: simplify 'mkdir X' followed by 'git -C X init'
2:  b3e66f329f ! 2:  ec558c2b9c urlmatch: change 'allow_globs' arg to bool
    @@ urlmatch.c: static char *url_normalize_1(const char *url, struct url_info *out_i
     +	return url_normalize_1(url, out_info, false);
      }
      
    - static size_t url_match_prefix(const char *url,
    + char *url_parse(const char *url_orig, struct url_info *out_info)
     @@ urlmatch.c: int urlmatch_config_entry(const char *var, const char *value,
      		struct url_info norm_info;
      
3:  813d748dd6 ! 3:  79ee353449 urlmatch: add url_normalize_pattern() helper
    @@ urlmatch.c: char *url_normalize(const char *url, struct url_info *out_info)
     +	return url_normalize_1(url, out_info, true);
     +}
     +
    - static size_t url_match_prefix(const char *url,
    - 			       const char *url_prefix,
    - 			       size_t url_prefix_len)
    + char *url_parse(const char *url_orig, struct url_info *out_info)
    + {
    + 	struct strbuf url;
     
      ## urlmatch.h ##
     @@ urlmatch.h: struct url_info {
    - 
      char *url_normalize(const char *, struct url_info *);
    + char *url_parse(const char *, struct url_info *);
      
     +/*
     + * Like url_normalize(), but also allows '*' glob characters in the host
4:  e92863bee8 ! 4:  037fd46ac7 promisor-remote: add 'local_name' to 'struct promisor_info'
    @@ Commit message
         To prepare for this change, let's add a new 'char *local_name' member
         to 'struct promisor_info', and let's update the related functions.
     
    -    While at it, let's also add a small promisor_info_internal_name()
    -    helper that returns `local_name` when set, `name` otherwise, and let's
    -    use this small helper in promisor_store_advertised_fields() and in the
    +    While at it, let's also add a small promisor_info_local_name() helper
    +    that returns `local_name` when set, `name` otherwise, and let's use
    +    this small helper in promisor_store_advertised_fields() and in the
         post-loop of filter_promisor_remote() so that lookups against the local
         repo configuration use the right name.
     
    @@ promisor-remote.c: static void promisor_info_list_clear(struct string_list *list
      	string_list_clear(list, 0);
      }
      
    -+static const char *promisor_info_internal_name(struct promisor_info *p)
    ++static const char *promisor_info_local_name(struct promisor_info *p)
     +{
     +	return p->local_name ? p->local_name : p->name;
     +}
    @@ promisor-remote.c: static bool promisor_store_advertised_fields(struct promisor_
      	struct promisor_info *p;
      	struct string_list_item *item;
     -	const char *remote_name = advertised->name;
    -+	const char *remote_name = promisor_info_internal_name(advertised);
    ++	const char *remote_name = promisor_info_local_name(advertised);
      	bool reload_config = false;
      
      	if (!(store_info->store_filter || store_info->store_token))
    @@ promisor-remote.c: static void filter_promisor_remote(struct repository *repo,
      	for_each_string_list_item(item, accepted_remotes) {
      		struct promisor_info *info = item->util;
     -		struct promisor_remote *r = repo_promisor_remote_find(repo, info->name);
    -+		const char *local = promisor_info_internal_name(info);
    -+		struct promisor_remote *r = repo_promisor_remote_find(repo, local);
    ++		const char *remote_name = promisor_info_local_name(info);
    ++		struct promisor_remote *r = repo_promisor_remote_find(repo, remote_name);
      
      		if (r) {
      			r->accepted = 1;
5:  7e1b106404 = 5:  532adb7ca9 promisor-remote: introduce promisor.acceptFromServerUrl
6:  f00eed4bf2 ! 6:  b970f5647c promisor-remote: trust known remotes matching acceptFromServerUrl
    @@ Commit message
         the 'token' field of the capability is preferred over embedding
         credentials in the URL.
     
    -    Let's then use this helper in should_accept_remote() so that, a known
    +    Let's then use this helper in should_accept_remote() so that a known
         remote whose URL matches the allowlist is accepted.
     
         To prepare for this new logic, let's also:
    @@ Documentation/config/promisor.adoc: promisor.acceptFromServer::
     +authentication tokens) on known remotes without further confirmation.
     +To minimize security risks, follow these guidelines:
     ++
    ++--
     +1. Start with a secure protocol scheme, like `https://` or `ssh://`.
     ++
     +2. Only allow domain names or paths where you control and trust _ALL_
    @@ Documentation/config/promisor.adoc: promisor.acceptFromServer::
     +   subdomain. This is extremely dangerous on shared hosting platforms
     +   (e.g., `https://*.github.io/*` trusts every user's site on the
     +   entire platform).
    ++--
     ++
     +Before matching, both the advertised URL and the pattern are
     +normalized: the scheme and host are lowercased, percent-encoded
7:  af06fb31db ! 7:  1875228a7b promisor-remote: auto-configure unknown remotes
    @@ Documentation/config/promisor.adoc: documentation of that option.)
     +without further confirmation. To minimize security risks, follow these
     +guidelines:
      +
    + --
      1. Start with a secure protocol scheme, like `https://` or `ssh://`.
    - +
     @@ Documentation/config/promisor.adoc: ignored during matching. Note that embedding credentials in URLs is
      discouraged. Passing authentication tokens via the `token` field of
      the `promisor-remote` capability is strongly preferred.
8:  92075d88d8 = 8:  351ece0b90 doc: promisor: improve acceptFromServer entry
Christian Couder (8):
  t5710: simplify 'mkdir X' followed by 'git -C X init'
  urlmatch: change 'allow_globs' arg to bool
  urlmatch: add url_normalize_pattern() helper
  promisor-remote: add 'local_name' to 'struct promisor_info'
  promisor-remote: introduce promisor.acceptFromServerUrl
  promisor-remote: trust known remotes matching acceptFromServerUrl
  promisor-remote: auto-configure unknown remotes
  doc: promisor: improve acceptFromServer entry
 Documentation/config/promisor.adoc    | 148 +++++++--
 Documentation/config/remote.adoc      |   9 +
 Documentation/gitprotocol-v2.adoc     |   9 +-
 promisor-remote.c                     | 413 ++++++++++++++++++++++++--
 t/t5710-promisor-remote-capability.sh | 202 ++++++++++++-
 urlmatch.c                            |  11 +-
 urlmatch.h                            |  12 +
 7 files changed, 756 insertions(+), 48 deletions(-)
-- 
2.54.0.275.g96c817d129.dirty
Previous: Christian CouderNext: Christian Couder
Message 97 of 111 in “Implement `promisor.storeFields` and `--filter=auto`”
  1. 0/9 Implement `promisor.storeFields` and `--filter=auto`Christian Couder, Dec 23, 2025
  2. 1/9 promisor-remote: refactor initialising field listsChristian Couder, Dec 23, 2025
  3. 2/9 promisor-remote: allow a client to store fieldsChristian Couder, Dec 23, 2025
  4. Patrick SteinhardtJan 7, 2026
  5. Christian CouderFeb 4, 2026
  6. 3/9 clone: make filter_options local to cmd_clone()Christian Couder, Dec 23, 2025
  7. 4/9 fetch: make filter_options local to cmd_fetch()Christian Couder, Dec 23, 2025
  8. Patrick SteinhardtJan 7, 2026
  9. 5/9 doc: fetch: document `--filter=<filter-spec>` optionChristian Couder, Dec 23, 2025
  10. Jean-Noël AVILADec 26, 2025
  11. Christian CouderFeb 4, 2026
  12. 6/9 list-objects-filter-options: support 'auto' mode for --filterChristian Couder, Dec 23, 2025
  13. Patrick SteinhardtJan 7, 2026
  14. Christian CouderFeb 4, 2026
  15. 7/9 list-objects-filter-options: implement auto filter resolutionChristian Couder, Dec 23, 2025
  16. Patrick SteinhardtJan 7, 2026
  17. Christian CouderFeb 4, 2026
  18. Patrick SteinhardtFeb 11, 2026
  19. Christian CouderFeb 12, 2026
  20. 8/9 promisor-remote: keep advertised filter in memoryChristian Couder, Dec 23, 2025
  21. Patrick SteinhardtJan 7, 2026
  22. Christian CouderFeb 4, 2026
  23. Patrick SteinhardtFeb 11, 2026
  24. Junio C HamanoFeb 11, 2026
  25. Christian CouderFeb 12, 2026
  26. 9/9 fetch-pack: wire up and enable auto filter logicChristian Couder, Dec 23, 2025
  27. Patrick SteinhardtJan 7, 2026
  28. Christian CouderFeb 4, 2026
  29. 0/8 Implement `promisor.storeFields` and `--filter=auto`Christian Couder, Feb 4, 2026
  30. 1/8 promisor-remote: refactor initialising field listsChristian Couder, Feb 4, 2026
  31. 2/8 promisor-remote: allow a client to store fieldsChristian Couder, Feb 4, 2026
  32. 3/8 clone: make filter_options local to cmd_clone()Christian Couder, Feb 4, 2026
  33. 4/8 fetch: make filter_options local to cmd_fetch()Christian Couder, Feb 4, 2026
  34. 5/8 doc: fetch: document `--filter=<filter-spec>` optionChristian Couder, Feb 4, 2026
  35. Patrick SteinhardtFeb 11, 2026
  36. Christian CouderFeb 12, 2026
  37. 6/8 list-objects-filter-options: support 'auto' mode for --filterChristian Couder, Feb 4, 2026
  38. 7/8 promisor-remote: keep advertised filters in memoryChristian Couder, Feb 4, 2026
  39. 8/8 fetch-pack: wire up and enable auto filter logicChristian Couder, Feb 4, 2026
  40. Patrick SteinhardtFeb 11, 2026
  41. Christian CouderFeb 12, 2026
  42. 0/9 Implement `promisor.storeFields` and `--filter=auto`Christian Couder, Feb 12, 2026
  43. 1/9 promisor-remote: refactor initialising field listsChristian Couder, Feb 12, 2026
  44. 2/9 promisor-remote: allow a client to store fieldsChristian Couder, Feb 12, 2026
  45. 3/9 clone: make filter_options local to cmd_clone()Christian Couder, Feb 12, 2026
  46. 4/9 fetch: make filter_options local to cmd_fetch()Christian Couder, Feb 12, 2026
  47. 5/9 doc: fetch: document `--filter=<filter-spec>` optionChristian Couder, Feb 12, 2026
  48. 6/9 list-objects-filter-options: support 'auto' mode for --filterChristian Couder, Feb 12, 2026
  49. Jeff KingFeb 14, 2026
  50. Christian CouderFeb 16, 2026
  51. 7/9 promisor-remote: keep advertised filters in memoryChristian Couder, Feb 12, 2026
  52. 8/9 promisor-remote: change promisor_remote_reply()'s signatureChristian Couder, Feb 12, 2026
  53. Patrick SteinhardtFeb 13, 2026
  54. 9/9 fetch-pack: wire up and enable auto filter logicChristian Couder, Feb 12, 2026
  55. Patrick SteinhardtFeb 13, 2026
  56. Patrick SteinhardtFeb 13, 2026
  57. 0/9 Implement `promisor.storeFields` and `--filter=auto`Christian Couder, Feb 16, 2026
  58. 1/9 promisor-remote: refactor initialising field listsChristian Couder, Feb 16, 2026
  59. 2/9 promisor-remote: allow a client to store fieldsChristian Couder, Feb 16, 2026
  60. 3/9 clone: make filter_options local to cmd_clone()Christian Couder, Feb 16, 2026
  61. 4/9 fetch: make filter_options local to cmd_fetch()Christian Couder, Feb 16, 2026
  62. 5/9 doc: fetch: document `--filter=<filter-spec>` optionChristian Couder, Feb 16, 2026
  63. 6/9 list-objects-filter-options: support 'auto' mode for --filterChristian Couder, Feb 16, 2026
  64. 7/9 promisor-remote: keep advertised filters in memoryChristian Couder, Feb 16, 2026
  65. 8/9 promisor-remote: change promisor_remote_reply()'s signatureChristian Couder, Feb 16, 2026
  66. 9/9 fetch-pack: wire up and enable auto filter logicChristian Couder, Feb 16, 2026
  67. 0/8 Auto-configure advertised remotes via URL allowlistChristian Couder, Apr 27, 2026
  68. 1/8 t5710: simplify 'mkdir X' followed by 'git -C X init'Christian Couder, Apr 27, 2026
  69. 2/8 urlmatch: change 'allow_globs' arg to boolChristian Couder, Apr 27, 2026
  70. 3/8 urlmatch: add url_normalize_pattern() helperChristian Couder, Apr 27, 2026
  71. 4/8 promisor-remote: add 'local_name' to 'struct promisor_info'Christian Couder, Apr 27, 2026
  72. Toon ClaesMay 4, 2026
  73. 5/8 promisor-remote: introduce promisor.acceptFromServerUrlChristian Couder, Apr 27, 2026
  74. 6/8 promisor-remote: trust known remotes matching acceptFromServerUrlChristian Couder, Apr 27, 2026
  75. Toon ClaesMay 8, 2026
  76. Christian CouderMay 19, 2026
  77. Toon ClaesMay 11, 2026
  78. Christian CouderMay 19, 2026
  79. 7/8 promisor-remote: auto-configure unknown remotesChristian Couder, Apr 27, 2026
  80. Toon ClaesMay 11, 2026
  81. Christian CouderMay 19, 2026
  82. 8/8 doc: promisor: improve acceptFromServer entryChristian Couder, Apr 27, 2026
  83. Christian CouderApr 27, 2026
  84. 0/8 Auto-configure advertised remotes via URL allowlistChristian Couder, May 19, 2026
  85. 1/8 t5710: simplify 'mkdir X' followed by 'git -C X init'Christian Couder, May 19, 2026
  86. 2/8 urlmatch: change 'allow_globs' arg to boolChristian Couder, May 19, 2026
  87. 3/8 urlmatch: add url_normalize_pattern() helperChristian Couder, May 19, 2026
  88. 4/8 promisor-remote: add 'local_name' to 'struct promisor_info'Christian Couder, May 19, 2026
  89. Junio C HamanoMay 20, 2026
  90. Christian CouderMay 27, 2026
  91. 5/8 promisor-remote: introduce promisor.acceptFromServerUrlChristian Couder, May 19, 2026
  92. 6/8 promisor-remote: trust known remotes matching acceptFromServerUrlChristian Couder, May 19, 2026
  93. Kristoffer HaugsbakkMay 23, 2026
  94. Christian CouderMay 27, 2026
  95. 7/8 promisor-remote: auto-configure unknown remotesChristian Couder, May 19, 2026
  96. 8/8 doc: promisor: improve acceptFromServer entryChristian Couder, May 19, 2026
  97. 0/8 Auto-configure advertised remotes via URL allowlistChristian Couder, May 27, 2026
  98. 1/8 t5710: simplify 'mkdir X' followed by 'git -C X init'Christian Couder, May 27, 2026
  99. 2/8 urlmatch: change 'allow_globs' arg to boolChristian Couder, May 27, 2026
  100. 3/8 urlmatch: add url_normalize_pattern() helperChristian Couder, May 27, 2026
  101. 4/8 promisor-remote: add 'local_name' to 'struct promisor_info'Christian Couder, May 27, 2026
  102. 5/8 promisor-remote: introduce promisor.acceptFromServerUrlChristian Couder, May 27, 2026
  103. 6/8 promisor-remote: trust known remotes matching acceptFromServerUrlChristian Couder, May 27, 2026
  104. 7/8 promisor-remote: auto-configure unknown remotesChristian Couder, May 27, 2026
  105. 8/8 doc: promisor: improve acceptFromServer entryChristian Couder, May 27, 2026
  106. Kristoffer HaugsbakkJul 4, 2026
  107. Toon ClaesJun 9, 2026
  108. Christian CouderJun 9, 2026
  109. Toon ClaesJun 9, 2026
  110. Junio C HamanoJun 10, 2026
  111. Christian CouderJun 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.