Skip to content

Commit cc8fac5

Browse files
authored
Merge pull request #1232 from andypols/deprecate_github_api_baseurl
chore: deprecate github api baseUrl and add gitleaks config to schema
2 parents 292ecad + 3556da4 commit cc8fac5

File tree

4 files changed

+208
-52
lines changed

4 files changed

+208
-52
lines changed

config.schema.json

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"properties": {
88
"proxyUrl": {
99
"type": "string",
10-
"description": "Used in early versions of git proxy to configure the remote host that traffic is proxied to. In later versions, the repository URL is used to determine the domain proxied, allowing multiple hosts to be proxied by one instance.",
10+
"description": "Deprecated: Used in early versions of git proxy to configure the remote host that traffic is proxied to. In later versions, the repository URL is used to determine the domain proxied, allowing multiple hosts to be proxied by one instance.",
1111
"deprecated": true
1212
},
1313
"cookieSecret": { "type": "string" },
@@ -27,19 +27,34 @@
2727
"https://somedomain.com/some/path/checkUserGroups?domain=<domain>&name=<name>&id=<id>"
2828
]
2929
}
30-
}
30+
},
31+
"additionalProperties": false
3132
},
3233
"github": {
3334
"type": "object",
35+
"description": "Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer referenced in the codebase.",
3436
"properties": {
3537
"baseUrl": {
3638
"type": "string",
3739
"format": "uri",
38-
"examples": ["https://api.github.com"]
40+
"examples": ["https://api.github.com"],
41+
"deprecated": true
3942
}
43+
},
44+
"additionalProperties": false
45+
},
46+
"gitleaks": {
47+
"type": "object",
48+
"description": "Configuration for the gitleaks (https://github.com/gitleaks/gitleaks) plugin",
49+
"properties": {
50+
"enabled": { "type": "boolean" },
51+
"ignoreGitleaksAllow": { "type": "boolean" },
52+
"noColor": { "type": "boolean" },
53+
"configPath": { "type": "string" }
4054
}
4155
}
42-
}
56+
},
57+
"additionalProperties": false
4358
},
4459
"commitConfig": {
4560
"description": "Enforce rules and patterns on commits including e-mail and message",

src/config/generated/config.ts

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ export interface GitProxyConfig {
6363
*/
6464
privateOrganizations?: any[];
6565
/**
66-
* Used in early versions of git proxy to configure the remote host that traffic is proxied
67-
* to. In later versions, the repository URL is used to determine the domain proxied,
68-
* allowing multiple hosts to be proxied by one instance.
66+
* Deprecated: Used in early versions of git proxy to configure the remote host that traffic
67+
* is proxied to. In later versions, the repository URL is used to determine the domain
68+
* proxied, allowing multiple hosts to be proxied by one instance.
6969
*/
7070
proxyUrl?: string;
7171
/**
@@ -108,18 +108,39 @@ export interface GitProxyConfig {
108108
* Third party APIs
109109
*/
110110
export interface API {
111+
/**
112+
* Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer
113+
* referenced in the codebase.
114+
*/
111115
github?: Github;
116+
/**
117+
* Configuration for the gitleaks (https://github.com/gitleaks/gitleaks) plugin
118+
*/
119+
gitleaks?: Gitleaks;
112120
/**
113121
* Configuration used in conjunction with ActiveDirectory auth, which relates to a REST API
114122
* used to check user group membership, as opposed to direct querying via LDAP.<br />If this
115123
* configuration is set direct querying of group membership via LDAP will be disabled.
116124
*/
117125
ls?: Ls;
118-
[property: string]: any;
119126
}
120127

128+
/**
129+
* Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer
130+
* referenced in the codebase.
131+
*/
121132
export interface Github {
122133
baseUrl?: string;
134+
}
135+
136+
/**
137+
* Configuration for the gitleaks (https://github.com/gitleaks/gitleaks) plugin
138+
*/
139+
export interface Gitleaks {
140+
configPath?: string;
141+
enabled?: boolean;
142+
ignoreGitleaksAllow?: boolean;
143+
noColor?: boolean;
123144
[property: string]: any;
124145
}
125146

@@ -139,7 +160,6 @@ export interface Ls {
139160
* membership of.</li><li>"&lt;id&gt;": The username to check group membership for.</li></ul>
140161
*/
141162
userInADGroup?: string;
142-
[property: string]: any;
143163
}
144164

145165
/**
@@ -534,12 +554,22 @@ const typeMap: any = {
534554
API: o(
535555
[
536556
{ json: 'github', js: 'github', typ: u(undefined, r('Github')) },
557+
{ json: 'gitleaks', js: 'gitleaks', typ: u(undefined, r('Gitleaks')) },
537558
{ json: 'ls', js: 'ls', typ: u(undefined, r('Ls')) },
538559
],
560+
false,
561+
),
562+
Github: o([{ json: 'baseUrl', js: 'baseUrl', typ: u(undefined, '') }], false),
563+
Gitleaks: o(
564+
[
565+
{ json: 'configPath', js: 'configPath', typ: u(undefined, '') },
566+
{ json: 'enabled', js: 'enabled', typ: u(undefined, true) },
567+
{ json: 'ignoreGitleaksAllow', js: 'ignoreGitleaksAllow', typ: u(undefined, true) },
568+
{ json: 'noColor', js: 'noColor', typ: u(undefined, true) },
569+
],
539570
'any',
540571
),
541-
Github: o([{ json: 'baseUrl', js: 'baseUrl', typ: u(undefined, '') }], 'any'),
542-
Ls: o([{ json: 'userInADGroup', js: 'userInADGroup', typ: u(undefined, '') }], 'any'),
572+
Ls: o([{ json: 'userInADGroup', js: 'userInADGroup', typ: u(undefined, '') }], false),
543573
AuthenticationElement: o(
544574
[
545575
{ json: 'enabled', js: 'enabled', typ: true },

test/generated-config.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const chai = require('chai');
22
const { Convert } = require('../src/config/generated/config');
33
const defaultSettings = require('../proxy.config.json');
4+
const { isUserInAdGroup } = require('../src/service/passport/ldaphelper');
45

56
const { expect } = chai;
67

@@ -207,11 +208,12 @@ describe('Generated Config (QuickType)', () => {
207208
sink: [{ type: 'fs', params: { filepath: './.' }, enabled: true }],
208209

209210
api: {
211+
ls: {
212+
userInADGroup:
213+
'https://somedomain.com/some/path/checkUserGroups?domain=<domain>&name=<name>&id=<id>',
214+
},
210215
github: {
211216
baseUrl: 'https://api.github.com',
212-
token: 'secret-token',
213-
rateLimit: 100,
214-
enabled: true,
215217
},
216218
},
217219

0 commit comments

Comments
 (0)