git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* Wildcard URL config matching
@ 2018-11-05 20:56 brian m. carlson
  2018-11-07 12:56 ` Patrick Steinhardt
  0 siblings, 1 reply; 2+ messages in thread
From: brian m. carlson @ 2018-11-05 20:56 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt

[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]

In a272b9e70a ("urlmatch: allow globbing for the URL host part",
2017-01-31), we added support for wildcard matching for URLs when
reading from .git/config.  Now it's possible to specify an option like
http.http://*.example.com/.cookieFile and have it match for the URL
http://foo.example.com.  However, since this option also allows
wildcards at any level, the following also matches:
http.http://*.*.*/.cookieFile.

I'm wondering if it was intentional to allow this behavior or if we
intended to allow only the leftmost label (or labels) to be a wildcard.
The tests seem to test only the leftmost label, and that is the behavior
that one has for TLS certificates, for example.  I don't really see a
situation where one would want to match hostname labels in an arbitrary
position, but perhaps I'm simply not being imaginative enough in
thinking through the use cases.

Regardless of what we decide, I'll be sending a patch, either to add
additional tests, or correct the code (or both).

I ask because we're implementing this behavior for Git LFS, where we
don't iterate over all configuration keys, instead looking up certain
values in a hash.  We'll need to make some changes in order to have
things work correctly if we want to implement the current Git behavior
to prevent combinatorial explosion.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Wildcard URL config matching
  2018-11-05 20:56 Wildcard URL config matching brian m. carlson
@ 2018-11-07 12:56 ` Patrick Steinhardt
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick Steinhardt @ 2018-11-07 12:56 UTC (permalink / raw)
  To: brian m. carlson, git

[-- Attachment #1: Type: text/plain, Size: 2283 bytes --]

Hi Brian,

On Mon, Nov 05, 2018 at 08:56:52PM +0000, brian m. carlson wrote:
> In a272b9e70a ("urlmatch: allow globbing for the URL host part",
> 2017-01-31), we added support for wildcard matching for URLs when
> reading from .git/config.  Now it's possible to specify an option like
> http.http://*.example.com/.cookieFile and have it match for the URL
> http://foo.example.com.  However, since this option also allows
> wildcards at any level, the following also matches:
> http.http://*.*.*/.cookieFile.
> 
> I'm wondering if it was intentional to allow this behavior or if we
> intended to allow only the leftmost label (or labels) to be a wildcard.
> The tests seem to test only the leftmost label, and that is the behavior
> that one has for TLS certificates, for example.  I don't really see a
> situation where one would want to match hostname labels in an arbitrary
> position, but perhaps I'm simply not being imaginative enough in
> thinking through the use cases.

The behavior is intentional. The above example of "http://*.*.*/"
obviously doesn't make a lot of sense, but e.g. the pattern
"http://*.*.example.com" should match all sub-sub domains of
"example.com" like for example "http://foo.bar.example.com". The
ability to use multiple globs is necessary as they aren't "true"
globs, but will only match the current component of the subdomain
separated by dots. So they behave similar to globs in the shell,
where they only match up to the next directory separator.

If we were to remove the ability to use globs for multiple
components, then one would have to again explicitly list patterns
for all possible combinations.

> Regardless of what we decide, I'll be sending a patch, either to add
> additional tests, or correct the code (or both).

I agree that there should've been additional tests to also verify
that multiple globs work as expected. So thanks for doing that!

> I ask because we're implementing this behavior for Git LFS, where we
> don't iterate over all configuration keys, instead looking up certain
> values in a hash.  We'll need to make some changes in order to have
> things work correctly if we want to implement the current Git behavior
> to prevent combinatorial explosion.

Regards
Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 20:56 Wildcard URL config matching brian m. carlson
2018-11-07 12:56 ` Patrick Steinhardt

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox