Implement `promisor.storeFields` and `--filter=auto`
Subsystems (3)
PATCH v4 6/8 promisor-remote: trust known remotes matching acceptFromServerUrl
In reply to Christian CouderA previous commit introduced the promisor.acceptFromServerUrl config variable along with the machinery to parse and validate the URL glob patterns and optional remote name prefixes it contains. However, these URL patterns are not yet tied into the client's acceptance logic.
When a promisor remote is already configured locally, its fields (like authentication tokens) may occasionally need to be refreshed by the server. If promisor.acceptFromServer is set to the secure default ("None"), these updates are rejected, potentially causing future fetches to fail.
To enable such targeted updates for trusted URLs, let's use the URL patterns from promisor.acceptFromServerUrl as an additional URL based allowlist.
Concretely, let's check the advertised URLs against the URL glob patterns by introducing a new small helper function called url_matches_accept_list(), which iterates over the glob patterns and returns the first matching allowed_url entry (or NULL).
The URL matching is done component by component: scheme and port are compared exactly, the host and path are matched with wildmatch(). Before matching, the advertised URL is passed through url_normalize() so that case variations in the scheme/host, percent-encoding tricks, and ".." path segments cannot bypass the allowlist.
The username and password components of the URL are intentionally ignored during matching to allow servers to rotate them, though using 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 remote whose URL matches the allowlist is accepted.
To prepare for this new logic, let's also:
- Add an 'accept_urls' parameter to should_accept_remote().
- Replace the BUG() guard in the ACCEPT_KNOWN_URL case with an explicit 'if (accept == ACCEPT_KNOWN_URL) return' and a new BUG() guard in the ACCEPT_NONE case.
- Call accept_from_server_url() from filter_promisor_remote() and relax its early return so that the function is entered when accept_urls has entries even if accept == ACCEPT_NONE.
With this, many organizations may only need something like:
git config set --global \
promisor.acceptFromServerUrl "https://my-org.com/*"to accept only their own remotes. And if they need to accept additional remotes in some specific repos, they can also set:
git config set promisor.acceptFromServer knownUrl
and configure the additional remote manually only in the repos where they are needed.
Let's then properly document promisor.acceptFromServerUrl in "promisor.adoc" as an additive security allowlist for known remotes, including the URL normalization behavior and the component-wise matching, and let's mention it in "gitprotocol-v2.adoc".
Also let's clarify in the documentation howpromisor.acceptFromServerUrl interacts withpromisor.acceptFromServer:
- Precedence: when both options are set, promisor.acceptFromServerUrl is consulted first. If a matching pattern leads to acceptance, the remote is accepted regardless of promisor.acceptFromServer. Otherwise the decision is left to promisor.acceptFromServer.
- URL-mismatch guard: even when the advertised URL matches the allowlist, an already-existing client-side remote whose configured URL differs from the advertised one is not accepted through promisor.acceptFromServerUrl. promisor.acceptFromServer=all and =knownName keep their pre-existing, looser semantics.
The precedence paragraph is intentionally scoped here to known remotes only (field updates). A following commit that introduces auto-creation of unknown remotes will extend it to cover that case as well.
--- Documentation/config/promisor.adoc | 76 +++++++++++++++++++ Documentation/gitprotocol-v2.adoc | 9 ++- promisor-remote.c | 102 +++++++++++++++++++++++--- t/t5710-promisor-remote-capability.sh | 71 ++++++++++++++++++ 4 files changed, 244 insertions(+), 14 deletions(-)
Documentation/config/promisor.adoc +76 -0
@@ -51,6 +51,82 @@ promisor.acceptFromServer:: to "fetch" and "clone" requests from the client. Name and URL comparisons are case sensitive. See linkgit:gitprotocol-v2[5]. +promisor.acceptFromServerUrl:: + A glob pattern to specify which server-advertised URLs a + client is allowed to act on. When a URL matches, the client + will accept the advertised remote as a promisor remote and may + automatically accept field updates (such as authentication + tokens) from the server, even if `promisor.acceptFromServer` + is set to `none` (the default). ++ +This option can appear multiple times in config files. An advertised +URL will be accepted if it matches _ANY_ glob pattern specified by +this option in _ANY_ config file read by Git. ++ +When both `promisor.acceptFromServer` and `promisor.acceptFromServerUrl` +are set, `promisor.acceptFromServerUrl` is consulted first and takes +precedence: if a matching pattern leads to acceptance (by accepting +field updates for a known remote whose URL matches both the local +configuration and the allowlist), the advertised remote is accepted +regardless of the `promisor.acceptFromServer` setting. If no pattern +in `promisor.acceptFromServerUrl` triggers acceptance, the decision +is left to `promisor.acceptFromServer`. ++ +Note however that, even when an advertised URL matches a pattern in +`promisor.acceptFromServerUrl`, an already-existing remote on the +client whose name matches the advertised name but whose configured URL +differs from the advertised one will _NOT_ be accepted through +`promisor.acceptFromServerUrl`. This prevents a server from silently +re-pointing an existing client-side remote at a different URL. (Such a +remote may still be accepted through `promisor.acceptFromServer=all` +or `=knownName`, which have their own, looser semantics; see the +documentation of that option.) ++ +Be _VERY_ careful with these patterns: `*` matches any sequence of +characters within the 'host' and 'path' parts of a URL (but cannot +cross part boundaries). An overly broad pattern is a major security +risk, as a matching URL allows a server to update fields (such as +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_ + the content. Be especially careful with shared hosting platforms + like `github.com` or `gitlab.com`. A broad pattern like + `https://gitlab.com/*` is dangerous because it trusts every + repository on the entire platform. Always restrict such patterns to + your specific organization or namespace (e.g., + `https://gitlab.com/your-org/*`). ++ +3. Never use globs at the end of domain names. For example, + `https://cdn.your-org.com/*` might be safe, but + `https://cdn.your-org.com*/*` is a major security risk because + the latter matches `https://cdn.your-org.com.hacker.net/repo`. ++ +4. Be careful using globs at the beginning of domain names. While the + code ensures a `*` in the host cannot cross into the path, a + pattern like `https://*.example.com/*` will still match any + 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 +characters are decoded where possible, and path segments like `..` +are resolved. The port must also match exactly (e.g., +`https://example.com:8080/*` will not match a URL advertised on +port 9999). The username and password components of the URL are +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. ++ +For the security implications of accepting a promisor remote, see the +documentation of `promisor.acceptFromServer`. For details on the +protocol, see linkgit:gitprotocol-v2[5]. + promisor.checkFields:: A comma or space separated list of additional remote related field names. A client checks if the values of these fields
Documentation/gitprotocol-v2.adoc +5 -4
@@ -866,10 +866,11 @@ the server advertised, the client shouldn't advertise the On the server side, the "promisor.advertise" and "promisor.sendFields" configuration options can be used to control what it advertises. On -the client side, the "promisor.acceptFromServer" configuration option -can be used to control what it accepts, and the "promisor.storeFields" -option, to control what it stores. See the documentation of these -configuration options in linkgit:git-config[1] for more information. +the client side, the "promisor.acceptFromServer" and +"promisor.acceptFromServerUrl" configuration options can be used to +control what it accepts, and the "promisor.storeFields" option, to +control what it stores. See the documentation of these configuration +options in linkgit:git-config[1] for more information. Note that in the future it would be nice if the "promisor-remote" protocol capability could be used by the server, when responding to
promisor-remote.c +92 -10
150 lines not on this page · raw message
t/t5710-promisor-remote-capability.sh +71 -0
77 lines not on this page · raw message
Signature · 1 line
2.54.0.275.g96c817d129.dirty
PATCH v4 7/8 promisor-remote: auto-configure unknown remotes
In reply to Christian CouderPrevious commits have introduced the promisor.acceptFromServerUrl config variable to allowlist some URLs advertised by a server through the "promisor-remote" protocol capability.
However the new promisor.acceptFromServerUrl mechanism, like the old promisor.acceptFromServer mechanism, still requires a remote to already exist in the client's local configuration before it can be accepted. This places a significant manual burden on users to pre-configure these remotes, and creates friction for administrators who have to troubleshoot or manually provision these setups for their teams.
To eliminate this burden, let's automatically create a new [remote] section in the client's config when a server advertises an unknown remote whose URL matches a promisor.acceptFromServerUrl glob pattern.
Concretely, let's add four helpers:
- sanitize_remote_name(): turn an arbitrary URL-derived string into a valid remote name by replacing non-alphanumeric characters, collapsing runs of '-', and prepending "promisor-auto-".
- promisor_remote_name_from_url(): normalize the URL and extract host+port+path to build a human-readable base name, then pass it through sanitize_remote_name().
- configure_auto_promisor_remote(): write the remote.*.url, remote.*.promisor and remote.*.advertisedAs keys to the repo config.
- handle_matching_allowed_url(): pick the final name (user-supplied alias or auto-generated), handle collisions by appending "-1", "-2", etc., then call configure_auto_promisor_remote().
Let's also add should_accept_new_remote_url() which reuses the url_matches_accept_list() helper introduced in a previous commit to find a matching pattern, then delegates to handle_matching_allowed_url() to create the remote.
And then let's call should_accept_new_remote_url() from the '!item' (unknown remote) branch of should_accept_remote(), setting reload_config so that the newly-written config is picked up.
Finally let's document all that by:
- expanding the promisor.acceptFromServerUrl entry to describe auto-creation, the optional "name=" prefix syntax, the "promisor-auto-*" generation rules, and numeric-suffix collision handling, and by
- adding a "remote.<name>.advertisedAs" entry to "remote.adoc".
Also let's extend the precedence paragraph added by a previous commit to mention this new acceptance path: until now, the only way for promisor.acceptFromServerUrl to trigger acceptance was to allow field updates for a known remote. With this commit, it can also trigger auto-creation of a previously-unknown remote whose advertised URL matches the allowlist.
--- Documentation/config/promisor.adoc | 39 +++-- Documentation/config/remote.adoc | 9 ++ promisor-remote.c | 201 +++++++++++++++++++++++++- t/t5710-promisor-remote-capability.sh | 104 +++++++++++++ 4 files changed, 340 insertions(+), 13 deletions(-)
Documentation/config/promisor.adoc +29 -10
@@ -54,7 +54,8 @@ promisor.acceptFromServer:: promisor.acceptFromServerUrl:: A glob pattern to specify which server-advertised URLs a client is allowed to act on. When a URL matches, the client - will accept the advertised remote as a promisor remote and may + will accept the advertised remote as a promisor remote, may + automatically create a new remote configuration for it and may automatically accept field updates (such as authentication tokens) from the server, even if `promisor.acceptFromServer` is set to `none` (the default).
@@ -65,12 +66,13 @@ this option in _ANY_ config file read by Git. + When both `promisor.acceptFromServer` and `promisor.acceptFromServerUrl` are set, `promisor.acceptFromServerUrl` is consulted first and takes -precedence: if a matching pattern leads to acceptance (by accepting -field updates for a known remote whose URL matches both the local -configuration and the allowlist), the advertised remote is accepted -regardless of the `promisor.acceptFromServer` setting. If no pattern -in `promisor.acceptFromServerUrl` triggers acceptance, the decision -is left to `promisor.acceptFromServer`. +precedence: if a matching pattern leads to acceptance (either by +auto-configuring an unknown remote or by accepting field updates for +a known remote whose URL matches both the local configuration and the +allowlist), the advertised remote is accepted regardless of the +`promisor.acceptFromServer` setting. If no pattern in +`promisor.acceptFromServerUrl` triggers acceptance, the decision is +left to `promisor.acceptFromServer`. + Note however that, even when an advertised URL matches a pattern in `promisor.acceptFromServerUrl`, an already-existing remote on the
@@ -85,9 +87,10 @@ documentation of that option.) Be _VERY_ careful with these patterns: `*` matches any sequence of characters within the 'host' and 'path' parts of a URL (but cannot cross part boundaries). An overly broad pattern is a major security -risk, as a matching URL allows a server to update fields (such as -authentication tokens) on known remotes without further confirmation. -To minimize security risks, follow these guidelines: +risk, as a matching URL allows a server to auto-configure new remotes +and to update fields (such as 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://`.
@@ -123,6 +126,22 @@ 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. + +The glob pattern can optionally be prefixed with a remote name and an +equals sign (e.g., `cdn=https://cdn.example.com/*`). If such a prefix +is provided, accepted remotes will be saved under that name. If no +such prefix is provided, a safe remote name will be automatically +generated by sanitizing the URL and prefixing it with +`promisor-auto-`. ++ +If a remote with the chosen name already exists but points to a +different URL, Git will append a numeric suffix (e.g., `-1`, `-2`) to +the name to prevent overwriting existing configurations. You should +make sure that this doesn't happen often though, as remotes will be +rejected if the numeric suffix increases too much. In all cases, the +original name advertised by the server is recorded in the +`remote.<name>.advertisedAs` configuration variable for tracing and +debugging purposes. ++ For the security implications of accepting a promisor remote, see the documentation of `promisor.acceptFromServer`. For details on the protocol, see linkgit:gitprotocol-v2[5].
Documentation/config/remote.adoc +9 -0
@@ -91,6 +91,15 @@ remote.<name>.promisor:: When set to true, this remote will be used to fetch promisor objects. +remote.<name>.advertisedAs:: + When a promisor remote is automatically configured using + information advertised by a server through the + `promisor-remote` protocol capability (see + `promisor.acceptFromServerUrl`), the server's originally + advertised name is saved in this variable. This is for + information, tracing and debugging purposes. Users should not + typically modify or create such configuration entries. + remote.<name>.partialclonefilter:: The filter that will be applied when fetching from this promisor remote. Changing or clearing this value will only affect fetches for new commits.
promisor-remote.c +198 -3
221 lines not on this page · raw message
t/t5710-promisor-remote-capability.sh +104 -0
116 lines not on this page · raw message
Signature · 1 line
2.54.0.275.g96c817d129.dirty
PATCH v4 8/8 doc: promisor: improve acceptFromServer entry
In reply to Christian CouderThe entry for the promisor.acceptFromServer in "Documentation/config/promisor.adoc" has a number of issues:
- it's not clear if new remotes and URLs can be created,
- it looks like a big block of text,
- it's not easy to see all the options,
- it's not easy to see which option is the default one,
- for "knownName", it says "advertised by the client" instead of "advertised by the server",
- it doesn't refer to the new related acceptFromServerUrl option.
Let's address all these issues by rewording large parts of it and using bullet points for the different options.
--- Documentation/config/promisor.adoc | 53 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-)
Documentation/config/promisor.adoc +35 -18
@@ -32,24 +32,41 @@ variable is set to "true", and the "name" and "url" fields are always advertised regardless of this setting. promisor.acceptFromServer:: - If set to "all", a client will accept all the promisor remotes - a server might advertise using the "promisor-remote" - capability. If set to "knownName" the client will accept - promisor remotes which are already configured on the client - and have the same name as those advertised by the client. This - is not very secure, but could be used in a corporate setup - where servers and clients are trusted to not switch name and - URLs. If set to "knownUrl", the client will accept promisor - remotes which have both the same name and the same URL - configured on the client as the name and URL advertised by the - server. This is more secure than "all" or "knownName", so it - should be used if possible instead of those options. Default - is "none", which means no promisor remote advertised by a - server will be accepted. By accepting a promisor remote, the - client agrees that the server might omit objects that are - lazily fetchable from this promisor remote from its responses - to "fetch" and "clone" requests from the client. Name and URL - comparisons are case sensitive. See linkgit:gitprotocol-v2[5]. + Controls which promisor remotes advertised by a server (using the + "promisor-remote" protocol capability) a client will accept. By + accepting a promisor remote, the client agrees that the server + might omit objects that are lazily fetchable from this promisor + remote from its responses to "fetch" and "clone" requests. ++ +Note that this option does not cause new remotes to be automatically +created in the client's configuration. It only allows remotes which +are somehow already configured to be trusted for the current +operation, or their fields to be updated (if `promisor.storeFields` is +set and the remote already exists locally). To allow Git to +automatically create and persist new remotes from server +advertisements, use `promisor.acceptFromServerUrl`. ++ +The available options are: ++ +* `none` (default): No promisor remote advertised by a server will be + accepted. ++ +* `knownUrl`: The client will accept promisor remotes that are already + configured on the client and have both the same name and the same URL + as advertised by the server. This is more secure than `all` or + `knownName`, and should be used if possible instead of those options. ++ +* `knownName`: The client will accept promisor remotes that are already + configured on the client and have the same name as those advertised + by the server. This is not very secure, but could be used in a corporate + setup where servers and clients are trusted to not switch names and URLs. ++ +* `all`: The client will accept all the promisor remotes a server might + advertise. This is the least secure option and should only be used in + fully trusted environments. ++ +Name and URL comparisons are case-sensitive. See linkgit:gitprotocol-v2[5] +for protocol details. promisor.acceptFromServerUrl:: A glob pattern to specify which server-advertised URLs a
Signature · 1 line
2.54.0.275.g96c817d129.dirty
Re: [PATCH v4 8/8] doc: promisor: improve acceptFromServer entry
Quoted 2 lines · Christian Couder
The entry for the
promisor.acceptFromServerin "Documentation/config/promisor.adoc" has a number of issues:
(This series is now in next so this is not a review comment)
Quoted 14 lines
[snip]
Documentation/config/promisor.adoc | 53 ++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 18 deletions(-)Documentation/config/promisor.adoc +0
-0@@ -32,24 +32,41 @@ variable is set to "true", and the "name" and "url"fields are always
advertised regardless of this setting.
[snip]
++
Documentation/config/promisor.adoc variable is set to "true", and the "name" and "url" fields are always · line 52
Quoted 4 lines
Documentation/config/promisor.adoc +4
-0+The available options are: ++ +* `none` (default): No promisor remote advertised by a server will be + accepted.
Why did you use an unordered/bullet list instead of a description list?
Quoted 22 lines
++
Documentation/config/promisor.adoc +16
-1+* `knownUrl`: The client will accept promisor remotes that are already + configured on the client and have both the same name and the same URL + as advertised by the server. This is more secure than `all` or + `knownName`, and should be used if possible instead of those options. ++ +* `knownName`: The client will accept promisor remotes that are already + configured on the client and have the same name as those advertised + by the server. This is not very secure, but could be used in a corporate + setup where servers and clients are trusted to not switch names and URLs. ++ +* `all`: The client will accept all the promisor remotes a server might + advertise. This is the least secure option and should only be used in + fully trusted environments. ++ +Name and URL comparisons are case-sensitive. See linkgit:gitprotocol-v2[5] +for protocol details. promisor.acceptFromServerUrl:: A glob pattern to specify which server-advertised URLs a --2.54.0.275.g96c817d129.dirty
Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
In reply to Christian Couder_(resend because it seems I accidentally didn't reply-all)_
Quoted 11 lines · Christian Couder
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:
Quoted 8 lines
- Patch 4/8 ("promisor-remote: add '
local_name' to 'structpromisor_info'"):- The
promisor_info_internal_name()function has been renamedpromisor_info_local_name()for clarity.- A
const char *locallocal variable has been renamedremote_namefor consistency with another similar variable.
I can really appreciate these two changes. Both make things more consistent and cleaner.
Quoted 2 lines
- Patch 6/8 ("promisor-remote: trust known remotes matching acceptFromServerUrl"):
I previously reviewed v2 and compared to that I like the changes you've made toward being clear about precedence. And this consistency carries through in PATCH 7/8.
And thanks for mentioning username and password components are ignored intentionally.
But I previously mentioned I felt the naming of 'acceptFromServer' and 'acceptFromServerUrl' are a bit confusing. So I'm wondering whether we can consider another proposal:
What if 'acceptFromServer' would configure if 'acceptFromServerUrl' should be used? I mean, imagine we put this in the config:
[promisor]
acceptFromServer = Match acceptFromServerUrl = https://my-org.com/*
(we can still argue over naming, but to get the idea)
So the value "Match" for 'acceptFromServer' would inform Git to use 'acceptFromServerUrl'. This way precedence isn't a concern no more, because every value for 'acceptFromServer' is mutually exclusive.
This has one downside though, you can no longer combine acceptFromServer=KnownUrl with a 'acceptFromServerUrl'. So URLs advertised by the server can no longer fall-through to 'acceptFromServer' if they don't match 'acceptFromServerUrl'. You can argue whether that's a good thing or not.
What do you think? If you disagree, I'm fine with the current approach and I think this version looks good.
Signature · 2 lines
Cheers, Toon
Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
Hi Toon,
Quoted 31 lines · Toon Claes
_(resend because it seems I accidentally didn't reply-all)_Quoted 11 lines · Christian Couder
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:
Quoted 8 lines
- Patch 4/8 ("promisor-remote: add '
local_name' to 'structpromisor_info'"):- The
promisor_info_internal_name()function has been renamedpromisor_info_local_name()for clarity.- A
const char *locallocal variable has been renamedremote_namefor consistency with another similar variable.I can really appreciate these two changes. Both make things more consistent and cleaner.
Quoted 2 lines
- Patch 6/8 ("promisor-remote: trust known remotes matching acceptFromServerUrl"):
Quoted 6 lines
I previously reviewed v2 and compared to that I like the changes you've made toward being clear about precedence. And this consistency carries through in PATCH 7/8.
And thanks for mentioning username and password components are ignored intentionally.
Thanks.
Quoted 11 lines
But I previously mentioned I felt the naming of 'acceptFromServer' and 'acceptFromServerUrl' are a bit confusing. So I'm wondering whether we can consider another proposal:
What if 'acceptFromServer' would configure if 'acceptFromServerUrl' should be used? I mean, imagine we put this in the config:
[promisor]
acceptFromServer = Match acceptFromServerUrl = https://my-org.com/*
Quoted 5 lines
(we can still argue over naming, but to get the idea)
So the value "Match" for 'acceptFromServer' would inform Git to use 'acceptFromServerUrl'. This way precedence isn't a concern no more, because every value for 'acceptFromServer' is mutually exclusive.
In this case I would prefer to remove 'acceptFromServerUrl' entirely and to make acceptFromServer accept values like:
match:https://my-org.com/*
By the way "match" might not be the best term. Maybe something like "auto-configure" would be better.
Quoted 5 lines
This has one downside though, you can no longer combine acceptFromServer=KnownUrl with a 'acceptFromServerUrl'. So URLs advertised by the server can no longer fall-through to 'acceptFromServer' if they don't match 'acceptFromServerUrl'. You can argue whether that's a good thing or not.
I think it's a good thing to have this fall-through. It allows setting up things like this:
In the global config:
[promisor]
acceptFromServerUrl = https://my-org.com/*
In the config of only a few repo that need it:
[promisor]
acceptFromServer = knownUrl
This way remotes from my-org.com are accepted in all the repos, while other remotes are accepted only if their name and URLs have already been configured in the repos that need them.
This allows relatively lenient security for internal repos and more strict security for external ones, and I suspect that many users will want something like that.
What you suggest doesn't allow that. It could force users to choose for each repo between either URL based allowlist or local configuration of every remote.
Also I think it's easier to explain that 'acceptFromServerUrl' is a different mechanism (that allows auto-configuration, contrary to 'acceptFromServer') if these two variables are independent.
Quoted 2 lines
What do you think? If you disagree, I'm fine with the current approach and I think this version looks good.
Thanks for your review and for being fine with the current approach if I disagree.
Best,
Christian.
Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
Quoted 17 lines · Christian Couder
Quoted 11 lines
But I previously mentioned I felt the naming of 'acceptFromServer' and 'acceptFromServerUrl' are a bit confusing. So I'm wondering whether we can consider another proposal:
What if 'acceptFromServer' would configure if 'acceptFromServerUrl' should be used? I mean, imagine we put this in the config:
[promisor]
acceptFromServer = Match acceptFromServerUrl = https://my-org.com/*Quoted 5 lines
(we can still argue over naming, but to get the idea)
So the value "Match" for 'acceptFromServer' would inform Git to use 'acceptFromServerUrl'. This way precedence isn't a concern no more, because every value for 'acceptFromServer' is mutually exclusive.
Quoted 7 lines
In this case I would prefer to remove 'acceptFromServerUrl' entirely and to make acceptFromServer accept values like:
match:https://my-org.com/*By the way "match" might not be the best term. Maybe something like "auto-configure" would be better.
I think that's too complicated. Let's not do that.
Quoted 23 lines
Quoted 5 lines
This has one downside though, you can no longer combine acceptFromServer=KnownUrl with a 'acceptFromServerUrl'. So URLs advertised by the server can no longer fall-through to 'acceptFromServer' if they don't match 'acceptFromServerUrl'. You can argue whether that's a good thing or not.
I think it's a good thing to have this fall-through. It allows setting up things like this:
In the global config:
[promisor]
acceptFromServerUrl = https://my-org.com/*In the config of only a few repo that need it:
[promisor]
acceptFromServer = knownUrlThis way remotes from my-org.com are accepted in all the repos, while other remotes are accepted only if their name and URLs have already been configured in the repos that need them.
Quoted 7 lines
This allows relatively lenient security for internal repos and more strict security for external ones, and I suspect that many users will want something like that.
What you suggest doesn't allow that. It could force users to choose for each repo between either URL based allowlist or local configuration of every remote.
Well yes, that's why I mentioned:
Quoted 1 line
You can argue whether that's a good thing or not.
If it's intentional and as you mention there's a valid use-case for this, then I agree with your approach in this series.
Quoted 3 lines
Also I think it's easier to explain that 'acceptFromServerUrl' is a different mechanism (that allows auto-configuration, contrary to 'acceptFromServer') if these two variables are independent.
True, although naming-wise it doesn't feel like that. But I no longer gonna keep picking on that, so ignore this comment please. :-)
Quoted 5 lines
Quoted 2 lines
What do you think? If you disagree, I'm fine with the current approach and I think this version looks good.
Thanks for your review and for being fine with the current approach if I disagree.
Thanks for explaining, I still agree moving on like this.
Signature · 2 lines
Cheers, Toon
Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
Quoted 7 lines · Toon Claes
Quoted 3 lines
Also I think it's easier to explain that 'acceptFromServerUrl' is a different mechanism (that allows auto-configuration, contrary to 'acceptFromServer') if these two variables are independent.
True, although naming-wise it doesn't feel like that. But I no longer gonna keep picking on that, so ignore this comment please. :-)
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
What do you think? If you disagree, I'm fine with the current approach and I think this version looks good.
Thanks for your review and for being fine with the current approach if I disagree.
Thanks for explaining, I still agree moving on like this.
Sounds good. Shall we mark the topic for 'next' then?
Thanks, all.
Re: [PATCH v4 0/8] Auto-configure advertised remotes via URL allowlist
Quoted 6 lines · Junio C Hamano
Quoted 1 line · Toon Claes
Thanks for explaining, I still agree moving on like this.
Sounds good. Shall we mark the topic for 'next' then?
Yes please. I think it's ready.
Thanks.