Skip to content

Commit 790f753

Browse files
authored
Merge pull request #1551 from Andreybest/1541-http-basic-ntlm
feat(upstream-proxy): add HTTP Basic and NTLM auth methods
2 parents d68c99a + e705b1e commit 790f753

11 files changed

Lines changed: 1224 additions & 49 deletions

File tree

config.schema.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,43 @@
472472
"items": {
473473
"type": "string"
474474
}
475+
},
476+
"auth": {
477+
"description": "Credentials presented to the upstream proxy. Preferred over embedding credentials in `url`.",
478+
"oneOf": [
479+
{
480+
"type": "object",
481+
"name": "Basic Auth",
482+
"description": "HTTP Basic — sends base64(username:password) in the Proxy-Authorization header on every CONNECT.",
483+
"properties": {
484+
"type": { "type": "string", "const": "basic" },
485+
"username": { "type": "string" },
486+
"password": { "type": "string" }
487+
},
488+
"required": ["type", "username", "password"],
489+
"additionalProperties": false
490+
},
491+
{
492+
"type": "object",
493+
"name": "NTLM Auth",
494+
"description": "Windows NTLM — multi-round CONNECT handshake (Type1/Type2/Type3) on the same TCP connection. Use when the proxy advertises `Proxy-Authenticate: NTLM`.",
495+
"properties": {
496+
"type": { "type": "string", "const": "ntlm" },
497+
"username": { "type": "string" },
498+
"password": { "type": "string" },
499+
"domain": {
500+
"type": "string",
501+
"description": "NTLM domain / target. Optional; defaults to empty (proxy decides)."
502+
},
503+
"workstation": {
504+
"type": "string",
505+
"description": "Workstation name reported in the Type1/Type3 messages. Optional; defaults to the host's name."
506+
}
507+
},
508+
"required": ["type", "username", "password"],
509+
"additionalProperties": false
510+
}
511+
]
475512
}
476513
},
477514
"additionalProperties": false

package-lock.json

Lines changed: 57 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
"@material-ui/icons": "4.11.3",
113113
"@primer/octicons-react": "^19.21.2",
114114
"@seald-io/nedb": "^4.1.2",
115+
"agent-base": "^7.1.4",
115116
"axios": "^1.18.1",
116117
"bcryptjs": "^3.0.3",
117118
"clsx": "^2.1.1",
@@ -127,6 +128,7 @@
127128
"express-session": "^1.19.0",
128129
"font-awesome": "^4.7.0",
129130
"history": "5.3.0",
131+
"httpntlm": "^1.8.13",
130132
"https-proxy-agent": "^7.0.6",
131133
"isomorphic-git": "^1.36.3",
132134
"jsonwebtoken": "^9.0.3",
@@ -205,7 +207,8 @@
205207
"vitest": "^3.2.7"
206208
},
207209
"overrides": {
208-
"rolldown": "1.0.1"
210+
"rolldown": "1.0.1",
211+
"underscore": "^1.13.8"
209212
},
210213
"optionalDependencies": {
211214
"@esbuild/darwin-arm64": "^0.27.2",

src/config/generated/config.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,11 @@ export interface RouteAuthRule {
681681
* Configuration for routing outbound requests to upstream Git hosts via an HTTP(S) proxy.
682682
*/
683683
export interface UpstreamProxy {
684+
/**
685+
* Credentials presented to the upstream proxy. Preferred over embedding credentials in
686+
* `url`.
687+
*/
688+
auth?: Auth;
684689
/**
685690
* Whether to use an outbound HTTP(S) proxy for upstream Git hosts.
686691
*/
@@ -695,6 +700,36 @@ export interface UpstreamProxy {
695700
url?: string;
696701
}
697702

703+
/**
704+
* Credentials presented to the upstream proxy. Preferred over embedding credentials in
705+
* `url`.
706+
*
707+
* HTTP Basic — sends base64(username:password) in the Proxy-Authorization header on every
708+
* CONNECT.
709+
*
710+
* Windows NTLM — multi-round CONNECT handshake (Type1/Type2/Type3) on the same TCP
711+
* connection. Use when the proxy advertises `Proxy-Authenticate: NTLM`.
712+
*/
713+
export interface Auth {
714+
password: string;
715+
type: AuthType;
716+
username: string;
717+
/**
718+
* NTLM domain / target. Optional; defaults to empty (proxy decides).
719+
*/
720+
domain?: string;
721+
/**
722+
* Workstation name reported in the Type1/Type3 messages. Optional; defaults to the host's
723+
* name.
724+
*/
725+
workstation?: string;
726+
}
727+
728+
export enum AuthType {
729+
Basic = 'basic',
730+
NTLM = 'ntlm',
731+
}
732+
698733
// Converts JSON strings to/from your types
699734
// and asserts the results of JSON.parse at runtime
700735
export class Convert {
@@ -1147,12 +1182,24 @@ const typeMap: any = {
11471182
),
11481183
UpstreamProxy: o(
11491184
[
1185+
{ json: 'auth', js: 'auth', typ: u(undefined, r('Auth')) },
11501186
{ json: 'enabled', js: 'enabled', typ: u(undefined, true) },
11511187
{ json: 'noProxy', js: 'noProxy', typ: u(undefined, a('')) },
11521188
{ json: 'url', js: 'url', typ: u(undefined, '') },
11531189
],
11541190
false,
11551191
),
1192+
Auth: o(
1193+
[
1194+
{ json: 'password', js: 'password', typ: '' },
1195+
{ json: 'type', js: 'type', typ: r('AuthType') },
1196+
{ json: 'username', js: 'username', typ: '' },
1197+
{ json: 'domain', js: 'domain', typ: u(undefined, '') },
1198+
{ json: 'workstation', js: 'workstation', typ: u(undefined, '') },
1199+
],
1200+
false,
1201+
),
11561202
AuthenticationElementType: ['ActiveDirectory', 'jwt', 'local', 'openidconnect'],
11571203
DatabaseType: ['fs', 'mongo'],
1204+
AuthType: ['basic', 'ntlm'],
11581205
};

0 commit comments

Comments
 (0)