diff --git a/package.json b/package.json index 62957591..00b44710 100644 --- a/package.json +++ b/package.json @@ -72,11 +72,6 @@ "command": "rhda.stackLogs", "title": "Debug logs", "category": "Red Hat Dependency Analytics" - }, - { - "command": "rhda.setSnykToken", - "title": "Set Snyk Token", - "category": "Red Hat Dependency Analytics" } ], "menus": { @@ -173,15 +168,6 @@ "default": "off", "description": "Traces the communication between VSCode and the Red Hat Dependency Analytics Language Server." }, - "redHatDependencyAnalytics.snykTokenStorage": { - "type": "string", - "enum": [ - "Always use VS Code's secret storage" - ], - "default": "Always use VS Code's secret storage", - "markdownDescription": "Red Hat Dependency Analytics uses VS Code's [secret storage](https://code.visualstudio.com/api/references/vscode-api#SecretStorage) to safely store the authentication token for Snyk. To set the token, run the VS Code command [RHDA: Set Snyk Token](command:rhda.setSnykToken).", - "scope": "window" - }, "redHatDependencyAnalytics.matchManifestVersions": { "type": "boolean", "default": true, @@ -318,4 +304,4 @@ "path": "^0.12.7", "vscode-languageclient": "^8.1.0" } -} +} \ No newline at end of file diff --git a/src/config.ts b/src/config.ts index 64ed72d4..8f7e5247 100644 --- a/src/config.ts +++ b/src/config.ts @@ -109,8 +109,8 @@ class Config { process.env['VSCEXT_EXHORT_PIP_PATH'] = this.exhortPipPath; process.env['VSCEXT_TELEMETRY_ID'] = this.telemetryId; - const token = await this.getSnykToken(); - process.env['VSCEXT_EXHORT_SNYK_TOKEN'] = token; + // const token = await this.getSnykToken(); + // process.env['VSCEXT_EXHORT_SNYK_TOKEN'] = token; } /** diff --git a/src/exhortServices.ts b/src/exhortServices.ts index 331ee78a..4e665990 100644 --- a/src/exhortServices.ts +++ b/src/exhortServices.ts @@ -24,7 +24,7 @@ function stackAnalysisService(pathToManifest, options): Promise { /** * Performes RHDA token validation based on the provided options and displays messages based on the validation status. * @param options The options for token validation. - * @param source The source for which the token is being validated. Example values: 'Snyk', 'OSS Index'. + * @param source The source for which the token is being validated. * @returns A promise resolving after validating the token. */ async function tokenValidationService(options, source): Promise { diff --git a/src/extension.ts b/src/extension.ts index 809c5be7..48cb6820 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -10,7 +10,7 @@ import { } from 'vscode-languageclient/node'; import * as commands from './commands'; -import { GlobalState, EXTENSION_QUALIFIED_ID, REDHAT_MAVEN_REPOSITORY, REDHAT_MAVEN_REPOSITORY_DOCUMENTATION_URL, SNYK_TOKEN_KEY } from './constants'; +import { GlobalState, EXTENSION_QUALIFIED_ID, REDHAT_MAVEN_REPOSITORY, REDHAT_MAVEN_REPOSITORY_DOCUMENTATION_URL } from './constants'; import { generateRHDAReport } from './stackAnalysis'; import { globalConfig } from './config'; import { StatusMessages, PromptText } from './constants'; @@ -18,7 +18,7 @@ import { caStatusBarProvider } from './caStatusBarProvider'; import { CANotification } from './caNotification'; import { DepOutputChannel } from './depOutputChannel'; import { record, startUp, TelemetryActions } from './redhatTelemetry'; -import { validateSnykToken } from './tokenValidation'; +// import { validateSnykToken } from './tokenValidation'; import { applySettingNameMappings } from './utils'; let lspClient: LanguageClient; @@ -75,25 +75,25 @@ export function activate(context: vscode.ExtensionContext) { } ); - const disposableSetSnykToken = vscode.commands.registerCommand( - commands.SET_SNYK_TOKEN_COMMAND, - async () => { - const token = await vscode.window.showInputBox({ - prompt: 'Please enter your Snyk Token:', - placeHolder: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', - password: true, - validateInput: validateSnykToken - }); - - if (token === undefined) { - return; - } else if (token === '') { - await globalConfig.clearSnykToken(true); - } else { - await globalConfig.setSnykToken(token); - } - } - ); + // const disposableSetSnykToken = vscode.commands.registerCommand( + // commands.SET_SNYK_TOKEN_COMMAND, + // async () => { + // const token = await vscode.window.showInputBox({ + // prompt: 'Please enter your Snyk Token:', + // placeHolder: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', + // password: true, + // validateInput: validateSnykToken + // }); + + // if (token === undefined) { + // return; + // } else if (token === '') { + // await globalConfig.clearSnykToken(true); + // } else { + // await globalConfig.setSnykToken(token); + // } + // } + // ); registerStackAnalysisCommands(context); @@ -178,7 +178,7 @@ export function activate(context: vscode.ExtensionContext) { disposableStackAnalysisCommand, disposableStackLogsCommand, rhRepositoryRecommendationNotification, - disposableSetSnykToken, + // disposableSetSnykToken, caStatusBarProvider, ); }) @@ -191,12 +191,12 @@ export function activate(context: vscode.ExtensionContext) { globalConfig.loadData(); }); - context.secrets.onDidChange(async (e) => { - if (e.key === SNYK_TOKEN_KEY) { - const token = await globalConfig.getSnykToken(); - lspClient.sendNotification('snykTokenModified', token); - } - }); + // context.secrets.onDidChange(async (e) => { + // if (e.key === SNYK_TOKEN_KEY) { + // const token = await globalConfig.getSnykToken(); + // lspClient.sendNotification('snykTokenModified', token); + // } + // }); } /** diff --git a/src/stackAnalysis.ts b/src/stackAnalysis.ts index df730517..b14106e3 100644 --- a/src/stackAnalysis.ts +++ b/src/stackAnalysis.ts @@ -82,11 +82,11 @@ async function executeStackAnalysis(manifestFilePath): Promise { 'EXHORT_PIP_PATH': globalConfig.exhortPipPath }; - const snykToken = await globalConfig.getSnykToken(); - /* istanbul ignore else */ - if (snykToken !== '') { - options['EXHORT_SNYK_TOKEN'] = snykToken; - } + // const snykToken = await globalConfig.getSnykToken(); + // /* istanbul ignore else */ + // if (snykToken !== '') { + // options['EXHORT_SNYK_TOKEN'] = snykToken; + // } // execute stack analysis await stackAnalysisService(manifestFilePath, options) diff --git a/test/config.test.ts b/test/config.test.ts index 95db8574..617370d1 100644 --- a/test/config.test.ts +++ b/test/config.test.ts @@ -66,7 +66,6 @@ suite('Config module', () => { expect(process.env['VSCEXT_STACK_ANALYSIS_COMMAND']).to.eq(commands.STACK_ANALYSIS_COMMAND); expect(process.env['VSCEXT_REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION_COMMAND']).to.eq(commands.REDHAT_REPOSITORY_RECOMMENDATION_NOTIFICATION_COMMAND); expect(process.env['VSCEXT_UTM_SOURCE']).to.eq(GlobalState.UTM_SOURCE); - expect(process.env['VSCEXT_EXHORT_SNYK_TOKEN']).to.eq(''); expect(process.env['VSCEXT_MATCH_MANIFEST_VERSIONS']).to.eq('true'); expect(process.env['VSCEXT_USE_PYTHON_VIRTUAL_ENVIRONMENT']).to.eq('false'); expect(process.env['VSCEXT_USE_GO_MVS']).to.eq('false'); @@ -81,7 +80,7 @@ suite('Config module', () => { expect(process.env['VSCEXT_EXHORT_PYTHON_PATH']).to.eq('python'); expect(process.env['VSCEXT_EXHORT_PIP_PATH']).to.eq('pip'); expect(process.env['VSCEXT_TELEMETRY_ID']).to.equal(mockId); - expect(process.env['VSCEXT_EXHORT_SNYK_TOKEN']).to.equal(''); + // expect(process.env['VSCEXT_EXHORT_SNYK_TOKEN']).to.equal(''); }); test('should set Snyk token in VSCode SecretStorage', async () => {