Skip to content

Commit

Permalink
Close JupiterOne-Archives#10 Added warning that appears if insecureSk…
Browse files Browse the repository at this point in the history
…ipTlsVerify is true
  • Loading branch information
befirst committed Jun 3, 2019
1 parent 17fbf4b commit 07fab5c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/initializeContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ export default async function initializeContext(
): Promise<OpenShiftExecutionContext> {
const {
instance: { config },
logger,
} = context;

const openshift = new OpenShiftClient();
const openshift = new OpenShiftClient(logger);
await openshift.authenticate(
config.apiToken,
config.cluster,
Expand Down
5 changes: 4 additions & 1 deletion src/openshift/OpenShiftClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ describe("OpenShiftClient fetch ok data", () => {
});

async function getAuthenticatedClient() {
const openshift = new OpenShiftClient();
const logger = {
warn: jest.fn().mockImplementation(),
};
const openshift = new OpenShiftClient(logger as any);
await openshift.authenticate(TOKEN, CLUSTER, true);

return openshift;
Expand Down
12 changes: 12 additions & 0 deletions src/openshift/OpenShiftClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// tslint:disable:no-var-requires
const openshiftRestClient = require("openshift-rest-client").OpenshiftClient;

import { IntegrationLogger } from "@jupiterone/jupiter-managed-integration-sdk";
import {
Deployment,
Group,
Expand All @@ -14,6 +15,11 @@ import {

export default class OpenShiftClient {
private restClient: any;
private logger: IntegrationLogger;

constructor(logger: IntegrationLogger) {
this.logger = logger;
}

public async authenticate(
apiToken: string,
Expand All @@ -26,6 +32,12 @@ export default class OpenShiftClient {
insecureSkipTlsVerify,
};

if (config.insecureSkipTlsVerify) {
this.logger.warn(
"Attention! SSL/TLS certificate verification is disabled.",
);
}

this.restClient = await openshiftRestClient({ config });
}

Expand Down

0 comments on commit 07fab5c

Please sign in to comment.