Skip to content

Commit 331bf10

Browse files
committed
remove poc bits
1 parent 3d9411b commit 331bf10

File tree

8 files changed

+44
-214
lines changed

8 files changed

+44
-214
lines changed

src/controllers/sdx/v1/OrgKeysController.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

src/controllers/sdx/v1/OrgRuntimeGroupController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { CreateNamespaceForRuntimeGroup } from '../../../services/workflow/creat
2626
import { assertEqual } from '../../ioc/assert';
2727
import { KeystoneService } from '../../ioc/keystoneInjector';
2828
import { RuntimeGroupInput } from './types';
29-
import { context } from 'msw';
3029

3130
/**
3231
* Runtime Group Controller

src/lists/ServiceConnection.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ for (const _list of [
148148
'Product',
149149
'RuntimeGroup',
150150
'ServiceAccess',
151-
'ServiceConnection',
152151
'Subsystem',
153152
'TemporaryIdentity',
154153
'User',

src/services/batch/runtime-group.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const logger = Logger('batch.runtime-group');
1919

2020
class RuntimeGroupService {
2121
validateRuntimeGroup = (name: string): void => {
22-
logger.debug(
23-
'[validateRuntimeGroup] validating runtime group name: %s',
24-
name
25-
);
26-
2722
regExprValidation(
2823
'^[a-z0-9]{3,8}$',
2924
name,

src/services/gateway-patterns/patterns/sdx-p2p-consumer.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import {
88
ServiceClient,
99
} from '../catalog';
1010

11-
export interface SDXP2PConsumerPatternConfig extends Record<string, string> {
11+
interface ConsumerUpgrades {
12+
sign: {};
13+
verify: {};
14+
}
15+
16+
export interface SDXP2PConsumerPatternConfig extends Record<string, any> {
1217
organization: string;
1318
conn_id: string;
1419
client_id: string;
1520
service_id: string;
16-
upgrades: string;
21+
upgrades: ConsumerUpgrades;
1722
tls_verify?: string;
18-
token_exchange_token_endpoint?: string;
19-
token_exchange_client_id?: string;
2023
}
2124

2225
export interface SDXP2PConsumerPatternData {
@@ -59,7 +62,7 @@ export const SDXP2PConsumerPattern = {
5962
};
6063
},
6164

62-
eval: (inputs: Record<string, string>, data: SDXP2PConsumerPatternData) => {
65+
eval: (inputs: Record<string, any>, data: SDXP2PConsumerPatternData) => {
6366
const serviceLocator = data.service.name;
6467

6568
const clientLocator = data.client.subsystem.clientId;
@@ -72,9 +75,9 @@ export const SDXP2PConsumerPattern = {
7275
const tags = [`ns.${consumerGateway}.${inputs.conn_id}.c`, 'sdx'];
7376
const name = `sdx.p2p.${inputs.conn_id}.c.${serviceLocator}`;
7477

75-
const upgrades = inputs.upgrades || '';
78+
const upgrades: ConsumerUpgrades = inputs.upgrades || {};
7679

77-
const config1 = {
80+
const config = {
7881
kind: 'GatewayService',
7982
name,
8083
retries: 0,
@@ -94,20 +97,20 @@ export const SDXP2PConsumerPattern = {
9497
url: data.service.subsystem.runtimeGroup.sdxEndpoint,
9598
plugins: [
9699
...[transformer(tags, data)],
97-
...(upgrades.includes('edge-sign')
100+
...(upgrades.hasOwnProperty('sign')
98101
? [upgradeToTrustSign(tags, data)]
99102
: []),
100-
...(upgrades.includes('edge-verify')
103+
...(upgrades.hasOwnProperty('verify')
101104
? [upgradeToTrustVerify(tags, data)]
102105
: []),
103106
],
104107
} as any;
105108

106109
if (inputs.tls_verify) {
107-
config1['tls_verify'] = inputs.tls_verify === 'false' ? false : true;
110+
config['tls_verify'] = inputs.tls_verify === 'false' ? false : true;
108111
}
109112

110-
return [config1] as any[];
113+
return [config] as any[];
111114
},
112115
};
113116

src/services/gateway-patterns/patterns/sdx-p2p-provider.ts

Lines changed: 30 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,29 @@ import { Logger } from '../../../logger';
1313

1414
const logger = Logger('sdx-p2p-provider-pattern');
1515

16+
// TODO: clean this up a bit!
17+
const SDX_KONG_URL =
18+
process.env.SDX_KONG_URL || 'http://sdx-konghc-kong-admin:8001';
19+
20+
interface ProviderUpgrades {
21+
sign: {};
22+
verify: {};
23+
token_exchange: {
24+
token_endpoint: string;
25+
client_id: string;
26+
scopes: string[];
27+
audience: string;
28+
};
29+
}
30+
1631
export interface SDXP2PProviderPatternConfig extends Record<string, any> {
1732
organization: string;
1833
conn_id: string;
1934
client_id: string;
2035
service_id: string;
2136
upstream_url: string;
22-
upgrades: string;
37+
upgrades: ProviderUpgrades;
2338
use_sni: string;
24-
kms_key_id?: string;
25-
upgrade_config: {
26-
token_exchange: {
27-
token_endpoint: string;
28-
client_id: string;
29-
scopes: string[];
30-
audience: string;
31-
};
32-
};
3339
}
3440

3541
export interface SDXP2PProviderPatternData {
@@ -75,7 +81,7 @@ export const SDXP2PProviderPattern = {
7581

7682
let key: KongKey = undefined;
7783
if (upgrades.includes('org-kms-sign')) {
78-
const keys = new KongKeys('http://sdx-konghc-kong-admin:8001');
84+
const keys = new KongKeys(SDX_KONG_URL);
7985

8086
key = await keys.getKeyByName(name);
8187

@@ -90,7 +96,7 @@ export const SDXP2PProviderPattern = {
9096
};
9197
},
9298

93-
eval: (inputs: Record<string, string>, data: SDXP2PProviderPatternData) => {
99+
eval: (inputs: Record<string, any>, data: SDXP2PProviderPatternData) => {
94100
const serviceLocator = data.service.name;
95101
const serviceHost = data.service.subsystem.runtimeGroup.host;
96102

@@ -103,7 +109,7 @@ export const SDXP2PProviderPattern = {
103109

104110
const upstreamUrl = inputs.upstream_url;
105111

106-
const upgrades = inputs.upgrades || '';
112+
const upgrades: ProviderUpgrades = inputs.upgrades || {};
107113

108114
return [
109115
{
@@ -153,20 +159,13 @@ export const SDXP2PProviderPattern = {
153159
tags: [...tags, `service:${serviceLocator}`, `client:${clientLocator}`],
154160
url: upstreamUrl,
155161
plugins: [
156-
...(upgrades.includes('edge-sign')
162+
...(upgrades.hasOwnProperty('sign')
157163
? [upgradeToTrustSign(tags, data)]
158164
: []),
159-
...(upgrades.includes('edge-verify')
165+
...(upgrades.hasOwnProperty('verify')
160166
? [upgradeToTrustVerify(tags, data)]
161167
: []),
162-
...(upgrades.includes('org-kms-sign')
163-
? [upgradeToTrustKMSSign(tags, data)]
164-
: []),
165-
...(upgrades.includes('timestamp')
166-
? [upgradeToTimestamp(tags, data)]
167-
: []),
168-
...(upgrades.includes('ledger') ? [upgradeToLedger(tags, data)] : []),
169-
...(upgrades.includes('token-exchange')
168+
...(upgrades.hasOwnProperty('token_exchange')
170169
? [
171170
upgradeToTokenExchange(
172171
tags,
@@ -213,65 +212,27 @@ function upgradeToTrustVerify(tags: string[], data: SDXP2PProviderPatternData) {
213212
};
214213
}
215214

216-
function upgradeToTrustKMSSign(
217-
tags: string[],
218-
data: SDXP2PProviderPatternData
219-
) {
220-
if (data.key == null) {
221-
logger.warn('Unable to configure trust KMS - no key found');
222-
}
223-
return {
224-
name: 'trust-kms',
225-
tags: tags,
226-
config: {
227-
direction: 'response',
228-
operation: 'sign',
229-
signature_header_key: 'X-Edge-Token',
230-
key_id: data.key?.kid,
231-
},
232-
};
233-
}
234-
235-
function upgradeToTimestamp(tags: string[], data: SDXP2PProviderPatternData) {
236-
return {
237-
name: 'trust-timestamp',
238-
tags: tags,
239-
config: {
240-
endpoint_url: 'https://freetsa.org/tsr',
241-
policy_oid: '1.2.1.2.1',
242-
},
243-
};
244-
}
245-
246-
function upgradeToLedger(tags: string[], data: SDXP2PProviderPatternData) {
247-
return {
248-
name: 'trust-ledger',
249-
tags: tags,
250-
config: {
251-
endpoint_url: 'https://rekor.sigstore.dev',
252-
provider: 'rekor',
253-
},
254-
};
255-
}
256-
257215
function upgradeToTokenExchange(
258216
tags: string[],
259217
data: SDXP2PProviderPatternData,
260218
inputs: SDXP2PProviderPatternConfig
261219
) {
220+
const tokenExchangeConfig = inputs.upgrades.token_exchange;
221+
262222
const kid = `urn:ca:bc:sdx:edge:${data.service.subsystem.runtimeGroup.name}:edge`;
223+
263224
return {
264225
name: 'token-exchange',
265226
tags: tags,
266227
config: {
267-
token_endpoint: inputs.upgrade_config?.token_exchange?.token_endpoint,
268-
client_id: inputs.upgrade_config?.token_exchange?.client_id,
228+
client_id: tokenExchangeConfig?.client_id,
229+
token_endpoint: tokenExchangeConfig?.token_endpoint,
230+
scopes: tokenExchangeConfig?.scopes,
231+
audience: tokenExchangeConfig?.audience,
232+
key_id: kid,
269233
private_key_location: '/etc/secrets/sdx-edge-signing-cert/tls.key',
270234
algorithm: 'ES256',
271235
expiration: 60,
272-
key_id: kid,
273-
scopes: inputs.upgrade_config?.token_exchange?.scopes,
274-
audience: inputs.upgrade_config?.token_exchange?.audience,
275236
},
276237
};
277238
}

src/services/workflow/sdx-org-keys.ts

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)