Skip to content

Commit 1afaebd

Browse files
committed
keep track of http related configuration keys.
We also select the most important few for implementation. The most time-consuming part would be to implement overrides correctly and validate it against the baseline of git, it's unclear how git can be queried or made to leak certain information. Maybe by overriding DNS mappings to let it go against an unknown local IP/port?
1 parent cf04218 commit 1afaebd

File tree

2 files changed

+184
-12
lines changed

2 files changed

+184
-12
lines changed

Diff for: git-repository/src/discover.rs

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ impl ThreadSafeRepository {
5858
///
5959
/// Finally, use the `trust_map` to determine which of our own repository options to use
6060
/// based on the trust level of the effective repository directory.
61+
// TODO: GIT_HTTP_PROXY_AUTHMETHOD, GIT_PROXY_SSL_CERT, GIT_PROXY_SSL_KEY, GIT_PROXY_SSL_CERT_PASSWORD_PROTECTED.
62+
// GIT_PROXY_SSL_CAINFO, GIT_SSL_VERSION, GIT_SSL_CIPHER_LIST, GIT_HTTP_MAX_REQUESTS, GIT_CURL_FTP_NO_EPSV,
63+
// GIT_HTTP_LOW_SPEED_LIMIT, GIT_HTTP_LOW_SPEED_TIME, GIT_HTTP_USER_AGENT
64+
// The vars above should end up as overrides of the respective configuration values (see git-config).
6165
pub fn discover_with_environment_overrides_opts(
6266
directory: impl AsRef<Path>,
6367
mut options: upwards::Options,

Diff for: src/plumbing/progress.rs

+180-12
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@ use tabled::{Style, TableIteratorExt, Tabled};
66

77
#[derive(Clone)]
88
enum Usage {
9-
NotApplicable {
10-
reason: &'static str,
11-
},
12-
NotPlanned {
13-
reason: &'static str,
14-
},
15-
Planned {
16-
note: Option<&'static str>,
17-
},
9+
/// It's not reasonable to implement it as the prerequisites don't apply.
10+
NotApplicable { reason: &'static str },
11+
/// We have no intention to implement it, but that can change if there is demand.
12+
NotPlanned { reason: &'static str },
13+
/// We definitely want to implement this configuration value.
14+
Planned { note: Option<&'static str> },
15+
/// The configuration is already effective and used (at least) in the given module `name`.
1816
InModule {
1917
name: &'static str,
2018
deviation: Option<&'static str>,
2119
},
22-
/// Needs analysis
20+
/// Needs analysis, unclear how it works or what it does.
2321
Puzzled,
2422
}
2523
use Usage::*;
@@ -544,6 +542,154 @@ static GIT_CONFIG: &[Record] = &[
544542
config: "index.version",
545543
usage: Planned { note: Some("once V4 indices can be written, we need to be able to set a desired version. For now we write the smallest possible index version only.") },
546544
},
545+
Record {
546+
config: "http.proxy",
547+
usage: Planned { note: None },
548+
},
549+
Record {
550+
config: "http.extraHeader",
551+
usage: Planned { note: Some("multi-value, and resettable with empty value") },
552+
},
553+
Record {
554+
config: "http.proxyAuthMethod",
555+
usage: Planned { note: None },
556+
},
557+
Record {
558+
config: "http.proxySSLCert",
559+
usage: NotPlanned { reason: "on demand" }
560+
},
561+
Record {
562+
config: "http.proxySSLKey",
563+
usage: NotPlanned { reason: "on demand" }
564+
},
565+
Record {
566+
config: "http.proxySSLCertPasswordProtected",
567+
usage: NotPlanned { reason: "on demand" }
568+
},
569+
Record {
570+
config: "http.proxySSLCAInfo",
571+
usage: NotPlanned { reason: "on demand" }
572+
},
573+
Record {
574+
config: "http.emptyAuth",
575+
usage: NotPlanned { reason: "on demand" }
576+
},
577+
Record {
578+
config: "http.delegation",
579+
usage: NotPlanned { reason: "on demand" }
580+
},
581+
Record {
582+
config: "http.cookieFile",
583+
usage: NotPlanned { reason: "on demand" }
584+
},
585+
Record {
586+
config: "http.saveCookies",
587+
usage: NotPlanned { reason: "on demand" }
588+
},
589+
Record {
590+
config: "http.version",
591+
usage: NotPlanned { reason: "on demand" }
592+
},
593+
Record {
594+
config: "http.curloptResolve",
595+
usage: NotPlanned { reason: "on demand" }
596+
},
597+
Record {
598+
config: "http.sslVersion",
599+
usage: NotPlanned { reason: "on demand" }
600+
},
601+
Record {
602+
config: "http.sslCipherList",
603+
usage: NotPlanned { reason: "on demand" }
604+
},
605+
Record {
606+
config: "http.sslCipherList",
607+
usage: NotPlanned { reason: "on demand" }
608+
},
609+
Record {
610+
config: "http.sslVerify",
611+
usage: NotPlanned { reason: "on demand" }
612+
},
613+
Record {
614+
config: "http.sslCert",
615+
usage: NotPlanned { reason: "on demand" }
616+
},
617+
Record {
618+
config: "http.sslKey",
619+
usage: NotPlanned { reason: "on demand" }
620+
},
621+
Record {
622+
config: "http.sslCertPasswordProtected",
623+
usage: NotPlanned { reason: "on demand" }
624+
},
625+
Record {
626+
config: "http.sslCertPasswordProtected",
627+
usage: NotPlanned { reason: "on demand" }
628+
},
629+
Record {
630+
config: "http.sslCAInfo",
631+
usage: NotPlanned { reason: "on demand" }
632+
},
633+
Record {
634+
config: "http.sslCAPath",
635+
usage: NotPlanned { reason: "on demand" }
636+
},
637+
Record {
638+
config: "http.sslBackend",
639+
usage: NotPlanned { reason: "on demand" }
640+
},
641+
Record {
642+
config: "http.schannelCheckRevoke",
643+
usage: NotPlanned { reason: "on demand" }
644+
},
645+
Record {
646+
config: "http.schannelUseSSLCAInfo",
647+
usage: NotPlanned { reason: "on demand" }
648+
},
649+
Record {
650+
config: "http.pinnedPubkey",
651+
usage: NotPlanned { reason: "on demand" }
652+
},
653+
Record {
654+
config: "http.sslTry",
655+
usage: NotPlanned { reason: "on demand" }
656+
},
657+
Record {
658+
config: "http.maxRequests",
659+
usage: NotPlanned { reason: "on demand" }
660+
},
661+
Record {
662+
config: "http.minSessions",
663+
usage: NotPlanned { reason: "on demand" }
664+
},
665+
Record {
666+
config: "http.postBuffer",
667+
usage: Planned { note: Some("relevant when implementing push, we should understand how memory allocation works when streaming") }
668+
},
669+
Record {
670+
config: "http.lowSpeedLimit",
671+
usage: Planned { note: Some("important for client-safety when facing bad networks or bad players") }
672+
},
673+
Record {
674+
config: "http.lowSpeedTime",
675+
usage: Planned { note: Some("important for client-safety when facing bad networks or bad players") }
676+
},
677+
Record {
678+
config: "http.userAgent",
679+
usage: Planned { note: None }
680+
},
681+
Record {
682+
config: "http.noEPSV",
683+
usage: NotPlanned { reason: "on demand" }
684+
},
685+
Record {
686+
config: "http.followRedirects",
687+
usage: Planned { note: None }
688+
},
689+
Record {
690+
config: "http.<url>.*",
691+
usage: Planned { note: Some("it's a vital part of git configuration. It's unclear how to get a baseline from git for this one.") }
692+
},
547693
Record {
548694
config: "sparse.expectFilesOutsideOfPatterns",
549695
usage: NotPlanned { reason: "todo" },
@@ -559,7 +705,19 @@ static GIT_CONFIG: &[Record] = &[
559705
usage: Planned {
560706
note: Some("required for big monorepos, and typically used in conjunction with sparse indices")
561707
}
562-
}
708+
},
709+
Record {
710+
config: "remote.<name>.proxy",
711+
usage: Planned {
712+
note: None
713+
}
714+
},
715+
Record {
716+
config: "remote.<name>.proxyAuthMethod",
717+
usage: Planned {
718+
note: None
719+
}
720+
},
563721
];
564722

565723
/// A programmatic way to record and display progress.
@@ -572,7 +730,7 @@ pub fn show_progress() -> anyhow::Result<()> {
572730

573731
println!("{}", sorted.table().with(Style::blank()));
574732
println!(
575-
"\nTotal records: {} ({perfect_icon} = {perfect}, {deviation_icon} = {deviation}, {planned_icon} = {planned})",
733+
"\nTotal records: {} ({perfect_icon} = {perfect}, {deviation_icon} = {deviation}, {planned_icon} = {planned}, {ondemand_icon} = {ondemand}, {not_applicable_icon} = {not_applicable})",
576734
GIT_CONFIG.len(),
577735
perfect_icon = InModule {
578736
name: "",
@@ -586,13 +744,23 @@ pub fn show_progress() -> anyhow::Result<()> {
586744
.icon(),
587745
planned_icon = Planned { note: None }.icon(),
588746
planned = GIT_CONFIG.iter().filter(|e| matches!(e.usage, Planned { .. })).count(),
747+
ondemand_icon = NotPlanned { reason: "" }.icon(),
748+
not_applicable_icon = NotApplicable { reason: "" }.icon(),
589749
perfect = GIT_CONFIG
590750
.iter()
591751
.filter(|e| matches!(e.usage, InModule { deviation, .. } if deviation.is_none()))
592752
.count(),
593753
deviation = GIT_CONFIG
594754
.iter()
595755
.filter(|e| matches!(e.usage, InModule { deviation, .. } if deviation.is_some()))
756+
.count(),
757+
ondemand = GIT_CONFIG
758+
.iter()
759+
.filter(|e| matches!(e.usage, NotPlanned { .. }))
760+
.count(),
761+
not_applicable = GIT_CONFIG
762+
.iter()
763+
.filter(|e| matches!(e.usage, NotApplicable { .. }))
596764
.count()
597765
);
598766
Ok(())

0 commit comments

Comments
 (0)