Skip to content

Commit

Permalink
Merge pull request #783 from snyk/chore/remove-cra-integration-type-a…
Browse files Browse the repository at this point in the history
…nd-refs

Chore/remove cra integration type and refs
  • Loading branch information
aarlaud authored Jul 10, 2024
2 parents ff86e4e + 4131d44 commit 0868c6b
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 208 deletions.
149 changes: 0 additions & 149 deletions config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"azure-repos",
"bitbucket-server",
"bitbucket-server-bearer-auth",
"container-registry-agent",
"github-enterprise",
"github-server-app",
"github",
Expand Down Expand Up @@ -365,7 +364,6 @@
"azure-repos": "defaultFilters/azure-repos.json",
"bitbucket-server": "defaultFilters/bitbucket-server.json",
"bitbucket-server-bearer-auth": "defaultFilters/bitbucket-server-bearer-auth.json",
"container-registry-agent": "defaultFilters/container-registry-agent.json",
"github-enterprise": "defaultFilters/github-enterprise.json",
"github-server-app": "defaultFilters/github-server-app.json",
"github": "defaultFilters/github.json",
Expand All @@ -386,152 +384,5 @@
"digitalocean-cr":"defaultFilters/container-registry-agent.json",
"gitlab-cr":"defaultFilters/container-registry-agent.json",
"google-artifact-cr":"defaultFilters/container-registry-agent.json"
},
"SOURCE_TYPES": {
"github": {
"publicId": "9a3e5d90-b782-468a-a042-9a2073736f0b",
"name": "GitHub",
"type": "github",
"brokerType": "github"
},
"bitbucket-server": {
"publicId": "87c79724-9555-4959-b811-08aa22635614",
"name": "Bitbucket Server",
"type": "bitbucket-server",
"brokerType": "bitbucket-server"
},
"bitbucket-server-bearer-auth": {
"publicId": "87c79724-9555-4959-b811-08aa22635614",
"name": "Bitbucket Server",
"type": "bitbucket-server",
"brokerType": "bitbucket-server-bearer-auth"
},
"github-enterprise": {
"publicId": "219fbe9f-2fb3-4919-b69c-afd6fab25d54",
"name": "GitHub Enterprise",
"type": "github-enterprise",
"brokerType": "github-enterprise"
},
"github-server-app": {
"publicId": "d79079c2-c675-4e9f-91bd-04d977fc0c9c",
"name": "GitHub Server App",
"type": "github-server-app",
"brokerType": "github-server-app"
},
"gitlab": {
"publicId": "6F37586C-ED9C-47BB-9D95-A2C93698836D",
"name": "GitLab",
"type": "gitlab",
"brokerType": "gitlab"
},
"docker-hub": {
"publicId": "7a4b3f39-eb1c-4a6e-9960-025f783b45c9",
"name": "Docker Hub",
"type": "docker-hub",
"brokerType": "container-registry-agent"
},
"ecr": {
"publicId": "850ff1ce-8bad-f00d-fee1-d00d00caca00",
"name": "ECR",
"type": "ecr",
"brokerType": "container-registry-agent"
},
"acr": {
"publicId": "75831964-2f5d-4c74-a798-0f3839b6ac00",
"name": "ACR",
"type": "acr",
"brokerType": "container-registry-agent"
},
"gcr": {
"publicId": "8a2cf306-50ae-4b3f-b98e-5a819c0ba9b6",
"name": "GCR",
"type": "gcr",
"brokerType": "container-registry-agent"
},
"artifactory-cr": {
"publicId": "66831964-2f5d-4c74-a798-0f3839b6ac00",
"name": "Artifactory",
"type": "artifactory-cr",
"brokerType": "container-registry-agent"
},
"harbor-cr": {
"publicId": "62b98e6e-0c70-47c1-9bc3-f6e7005d1069",
"name": "Harbor",
"type": "harbor-cr",
"brokerType": "container-registry-agent"
},
"quay-cr": {
"publicId": "3e82698b-2563-461f-921a-e41c483e3daf",
"name": "Quay",
"type": "quay-cr",
"brokerType": "container-registry-agent"
},
"github-cr": {
"publicId": "86e781e7-a8f9-40ed-b5b5-e442cc3037de",
"name": "GitHub Container Registry",
"type": "github-cr",
"brokerType": "container-registry-agent"
},
"nexus-cr": {
"publicId": "bc5dc4b4-530e-4dff-b494-b927dbab568f",
"name": "Nexus",
"type": "nexus-cr",
"brokerType": "container-registry-agent"
},
"digitalocean-cr": {
"publicId": "465c35cf-7155-4173-bf59-b2c404ad4867",
"name": "DigitalOcean",
"type": "digitalocean-cr",
"brokerType": "container-registry-agent"
},
"gitlab-cr": {
"publicId": "872fe239-fdc8-4d39-9e88-4fb99a2d5f7e",
"name": "GitLab Container Registry",
"type": "gitlab-cr",
"brokerType": "container-registry-agent"
},
"google-artifact-cr": {
"publicId": "481b389f-e23b-4255-a045-f245d425cef0",
"uri": "http://docker-registry-agent",
"name": "Google Artifact Registry",
"type": "google-artifact-cr",
"brokerType": "container-registry-agent"
},
"azure-repos": {
"publicId": "92ff53a7-366d-4639-b75d-d762b5e840b4",
"name": "Azure Repos",
"type": "azure-repos",
"brokerType": "azure-repos"
},
"artifactory": {
"name": "Artifactory Private Registry",
"type": "artifactory",
"brokerType": "artifactory"
},
"nexus": {
"name": "Nexus Private Registry",
"type": "nexus",
"brokerType": "nexus"
},
"nexus2": {
"name": "Nexus2 Private Registry",
"type": "nexus2",
"brokerType": "nexus2"
},
"jira": {
"name": "Jira",
"type": "jira",
"brokerType": "jira"
},
"jira-bearer-auth": {
"name": "Jira",
"type": "jira",
"brokerType": "jira-bearer-auth"
},
"apprisk": {
"name": "Apprisk",
"type": "apprisk",
"brokerType": "apprisk"
}
}
}
2 changes: 1 addition & 1 deletion lib/client/config/remoteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const retrieveConnectionsForDeployment = async (
};
connectionsObjectForFile.CONNECTIONS[
`${connections[i].attributes.name}`
].type = connections[i].attributes.type;
].type = connections[i].attributes.configuration.type;
connectionsObjectForFile.CONNECTIONS[
`${connections[i].attributes.name}`
].identifier = connections[i].attributes.identifier;
Expand Down
2 changes: 1 addition & 1 deletion lib/client/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface BrokerConnectionAttributes {
default: {};
required: {};
validations: Array<ConnectionValidation>;
type: string;
};
name: string;
identifier: string;
Expand All @@ -26,5 +27,4 @@ export interface BrokerConnectionAttributes {
nonce: string;
};
};
type: string;
}
12 changes: 0 additions & 12 deletions lib/client/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,11 @@ interface CommitSigning {
GPG_PRIVATE_KEY: string;
}

interface SourceTypes {
sourceTypes: {
[key: string]: {
publicId?: string;
name: string;
type: string;
brokerType: string;
};
};
}

export type Config = BackendAPI &
BrokerClient &
BrokerServer &
CommitSigning &
HighAvailabilityMode &
SourceTypes &
Record<string, any>;

export interface ConnectionValidations {
Expand Down
6 changes: 0 additions & 6 deletions lib/client/utils/integrations.ts

This file was deleted.

8 changes: 1 addition & 7 deletions lib/common/relay/forwardHttpRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { streamsStore } from '../http/server-post-stream-handler';
import { ExtendedLogContext } from '../types/log';
import { LoadedClientOpts, LoadedServerOpts } from '../types/options';
import { LOADEDFILTERSET } from '../types/filter';
import { translateIntegrationTypeToBrokerIntegrationType } from '../../client/utils/integrations';

// 1. Request coming in over HTTP conn (logged)
// 2. Filter for rule match (log and block if no match)
Expand Down Expand Up @@ -63,12 +62,7 @@ export const forwardHttpRequest = (
>;
filterResponse =
loadedFilters
.get(
translateIntegrationTypeToBrokerIntegrationType(
res.locals.websocket.supportedIntegrationType,
options.config,
),
) // The chosen type is determined by websocket connect middlwr
.get(res.locals.websocket.supportedIntegrationType) // The chosen type is determined by websocket connect middlwr
?.public(req) || false;
} else {
const loadedFilters = options.loadedFilters as LOADEDFILTERSET;
Expand Down
8 changes: 1 addition & 7 deletions lib/common/relay/forwardHttpRequestOverHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { makeRequestToDownstream } from '../http/request';
import { maskToken } from '../utils/token';
import { LoadedClientOpts, LoadedServerOpts } from '../types/options';
import { LOADEDFILTERSET } from '../types/filter';
import { translateIntegrationTypeToBrokerIntegrationType } from '../../client/utils/integrations';

// 1. Request coming in over HTTP conn (logged)
// 2. Filter for rule match (log and block if no match)
Expand Down Expand Up @@ -54,12 +53,7 @@ export const forwardHttpRequestOverHttp = (
>;
filterResponse =
loadedFilters
.get(
translateIntegrationTypeToBrokerIntegrationType(
res.locals.websocket.supportedIntegrationType,
options.config,
),
) // The chosen type is determined by websocket connect middlwr
.get(res.locals.websocket.supportedIntegrationType) // The chosen type is determined by websocket connect middlwr
?.public(req) || false;
} else {
const loadedFilters = options.loadedFilters as LOADEDFILTERSET;
Expand Down
8 changes: 1 addition & 7 deletions lib/common/relay/forwardWebsocketRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { LoadedClientOpts, LoadedServerOpts } from '../types/options';
import { runPreRequestPlugins } from '../../client/brokerClientPlugins/pluginManager';
import { computeContentLength } from '../utils/content-length';
import { contentLengthHeader } from '../utils/headers-value-constants';
import { translateIntegrationTypeToBrokerIntegrationType } from '../../client/utils/integrations';

export const forwardWebSocketRequest = (
options: LoadedClientOpts | LoadedServerOpts,
Expand Down Expand Up @@ -183,12 +182,7 @@ export const forwardWebSocketRequest = (
>;
filterResponse =
loadedFilters
.get(
translateIntegrationTypeToBrokerIntegrationType(
websocketConnectionHandler.supportedIntegrationType,
options.config,
),
)
.get(websocketConnectionHandler.supportedIntegrationType)
?.private(payload) || false;
} else {
const loadedFilters = options.loadedFilters as LOADEDFILTERSET;
Expand Down
16 changes: 0 additions & 16 deletions test/unit/relay-response-body-universal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,6 @@ describe('body relay', () => {
},
github: { default: {} },
},
sourceTypes: {
github: {
publicId: '9a3e5d90-b782-468a-a042-9a2073736f0b',
name: 'GitHub',
type: 'github',
brokerType: 'github',
},
},
};
loadBrokerConfig(config);

Expand Down Expand Up @@ -179,14 +171,6 @@ describe('body relay', () => {
},
github: { default: {} },
},
sourceTypes: {
github: {
publicId: '9a3e5d90-b782-468a-a042-9a2073736f0b',
name: 'GitHub',
type: 'github',
brokerType: 'github',
},
},
};
loadBrokerConfig(config);

Expand Down
4 changes: 2 additions & 2 deletions test/unit/remoteConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ describe('Remote config helpers', () => {
type: 'broker_connection',
attributes: {
name: 'my github connection',
type: 'github',
configuration: {
default: {},
required: {
github_token: 'GITHUB_TOKEN_XYZ',
},
type: 'github',
},
identifier: 'BROKER_TOKEN_1',
deployment_id: '67890',
Expand All @@ -51,12 +51,12 @@ describe('Remote config helpers', () => {
type: 'broker_connection',
attributes: {
name: 'my github connection',
type: 'github',
configuration: {
default: {},
required: {
github_token: 'GITHUB_TOKEN_XYZ',
},
type: 'github',
},
deployment_id: '67890',
},
Expand Down

0 comments on commit 0868c6b

Please sign in to comment.