Skip to content

Commit 97d9ce4

Browse files
authored
chore(release): 1.3.0 (#106)
1 parent 77a7e88 commit 97d9ce4

18 files changed

+1533
-12
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ node_modules
66
.DS_Store
77
.nyc_output/
88
coverage/
9-
mochawesome-report/
9+
mochawesome-report/
10+
src/lib/key.json

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [1.3.0](https://github.com/SAP/vs-code-extension-for-project-credential-digger/compare/v1.2.0...v1.3.0) (2024-05-24)
6+
7+
### Features
8+
9+
- **extension:** add quick fix suggestions for secrets ([a25823c](https://github.com/SAP/vs-code-extension-for-project-credential-digger/commit/a25823c28765c3554719e7733ea87b4dd82f55e3))
10+
511
## [1.2.0](https://github.com/SAP/vs-code-extension-for-project-credential-digger/compare/v1.1.0...v1.2.0) (2023-09-18)
612

713
### Features

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ The tool provides the following support:
2525
- Triggers the scan when opening/saving a file
2626
- Forces a scan of a file via the command `Credential Digger: Scan`
2727
- Highlights the findings in the code and displays them in the `Problems` panel as warnings
28+
- Proposes three "quick fix" functionalities to address the secrets found in the code:
29+
30+
- <u>Quick Fix 1:</u> **Remove Secret** - Instantly remove the secret from your code, making cleanup tasks and revision simpler.
31+
- <u>Quick Fix 2:</u> **Create Environment Variable** - With this feature, you can effortlessly store found secrets in a dedicated file and set up dependencies. This will be done automatically if your coding language is amongst Python, PHP, JavaScript, C#, or Java Maven. If your language is outside these five, you will receive AI-assisted advice to guide your manual setup.
32+
- <u>Quick Fix 3:</u> **Secret Storage Options** - This feature provides three secret storage options, namely, BTP Secret Store, AWS Secret Manager, and Vault.
33+
34+
- For BTP Secret Store, the documentation is written mostly by us with a portion that is AI-generated.
35+
- For AWS Secret Manager and Vault, the entire set of instructions is AI-generated to provide a comprehensive, dynamic and user-specific guide for securely storing secrets and integrating them into your project.
36+
37+
(To fully benefit from the <u>AI functionality</u>, you need to configure some settings. Go to 'Configuration' section to have more information.)
38+
39+
These features aim to streamline your coding workflow, making it more efficient and secure.
2840

2941
## Requirements
3042

@@ -64,6 +76,20 @@ If you would like to exclude some files from being scanned you need to configure
6476

6577
![exclude-files](images/credential-digger-exclude-files.gif)
6678

79+
### OpenAI
80+
81+
To fully benefit from the AI functionality, you need to configure some settings. Specifically, two fields need to be filled in the extension settings.
82+
(Your code will not be transmitted to an AI, only the file extension will be used on the prompt.)
83+
84+
- **Openai Mode**: Select your preferred AI mode from the dropdown. The options include "BTP OpenAI" and "OpenAI."
85+
86+
- <u>BTP OpenAI</u>: This option is for a Multi-tenant BTP service proxy for third-party LLM APIs. The extension use Azure OpenAI text-davinci-003 model.
87+
- <u>OpenAI</u>: This option is for OpenAI (https://platform.openai.com/).
88+
89+
- **Openai Key Path**: This field is for entering the full path to your OpenAI key. The type of key file depends on the selected OpenAI mode.
90+
- If <u>BTP OpenAI</u> was selected in the OpenAI Mode, the path should lead to a `.json` file containing your key.
91+
- If <u>OpenAI</u> was chosen, the path should direct to a `.txt` file containing only your copied and pasted key.
92+
6793
## Support, Feedback, Contributing
6894

6995
This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/vs-code-extension-for-project-credential-digger/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md).

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vs-code-extension-for-project-credential-digger",
33
"displayName": "VS Code extension for project \"Credential Digger\"",
44
"description": "Runs credential digger scan",
5-
"version": "1.2.0",
5+
"version": "1.3.0",
66
"icon": "resources/logo-CD.png",
77
"keywords": [
88
"Credential Digger",
@@ -183,6 +183,22 @@
183183
"description": "Specifies whether to validate the Credential Digger webserver certificate"
184184
}
185185
}
186+
},
187+
"credentialDigger.openaiCallMode": {
188+
"type": "string",
189+
"description": "Specifies the way you want to call OpenAI API",
190+
"enum": [
191+
"BTP OpenAI",
192+
"OpenAI"
193+
],
194+
"enumDescriptions": [
195+
"OpenAI instance running on BTP (the extension use Azure OpenAI text-davinci-003 model)",
196+
"OpenAI from https://openai.com/"
197+
]
198+
},
199+
"credentialDigger.openaiKeyPath": {
200+
"type": "string",
201+
"description": "Full path to the file with the key\n- BTP OpenAI: a json file with a 'client credentials token' from a Multi-tenant BTP service proxy for third-party LLM APIs \n- OpenAI: a txt file with a key from https://openai.com/. \n"
186202
}
187203
}
188204
}
@@ -229,7 +245,7 @@
229245
"@types/vscode": "1.76.0",
230246
"@typescript-eslint/eslint-plugin": "5.60.0",
231247
"@typescript-eslint/parser": "5.53.0",
232-
"@vscode/test-electron": "2.3.4",
248+
"@vscode/test-electron": "2.3.10",
233249
"@vscode/vsce": "2.19.0",
234250
"chai": "4.3.8",
235251
"commitizen": "4.3.0",

src/extension.ts

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ import {
1010
window,
1111
workspace,
1212
} from 'vscode';
13+
import * as vscode from 'vscode';
1314

1415
import ignore from 'ignore';
1516

17+
import { QuickFixProviderEnvVar } from './lib/code-actions/QuickFixProviderEnvVar';
18+
import { QuickFixProviderRemoveSecret } from './lib/code-actions/QuickFixProviderRemoveSecret';
19+
import { QuickFixProviderSecretStore } from './lib/code-actions/QuickFixProviderSecretStore';
1620
import LoggerFactory from './lib/logger-factory';
1721
import MetaReaderFactory from './lib/meta-reader-factory';
1822
import RunnerFactory from './lib/runner-factory';
@@ -81,6 +85,54 @@ export async function activate(context: ExtensionContext): Promise<void> {
8185
workspace.onDidChangeConfiguration(updateFilterPatternHandler),
8286
);
8387

88+
// Quick Fix
89+
const quickFixProviderRemoveSecret = new QuickFixProviderRemoveSecret(
90+
diagCollection,
91+
);
92+
const quickFixProviderEnvVar = new QuickFixProviderEnvVar(diagCollection);
93+
const quickFixProviderSecretStore = new QuickFixProviderSecretStore(
94+
diagCollection,
95+
);
96+
97+
context.subscriptions.push(
98+
vscode.languages.registerCodeActionsProvider(
99+
'*',
100+
quickFixProviderSecretStore,
101+
{
102+
// '*' means all languages
103+
providedCodeActionKinds:
104+
QuickFixProviderSecretStore.providedCodeActionKinds,
105+
},
106+
),
107+
);
108+
context.subscriptions.push(
109+
vscode.languages.registerCodeActionsProvider(
110+
'*',
111+
quickFixProviderEnvVar,
112+
{
113+
// '*' means all languages
114+
providedCodeActionKinds:
115+
QuickFixProviderEnvVar.providedCodeActionKinds,
116+
},
117+
),
118+
);
119+
context.subscriptions.push(
120+
vscode.languages.registerCodeActionsProvider(
121+
'*',
122+
quickFixProviderRemoveSecret,
123+
{
124+
// '*' means all languages
125+
providedCodeActionKinds:
126+
QuickFixProviderRemoveSecret.providedCodeActionKinds,
127+
},
128+
),
129+
);
130+
context.subscriptions.push(
131+
quickFixProviderRemoveSecret.registerCommands(),
132+
quickFixProviderEnvVar.registerCommands(),
133+
quickFixProviderSecretStore.registerCommands(),
134+
);
135+
84136
// The commandId has been defined in the package.json file
85137
let disposable = commands.registerCommand(
86138
MetaReaderFactory.getInstance().getExtensionScanCommand(),

src/lib/client/runner/runner.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default abstract class Runner {
9595
if (!rules) {
9696
throw new Error('Please provide the path to the rules file');
9797
}
98+
console.log('Rules file path: ', rules);
9899
this.rules = Uri.parse(rules);
99100
switch (this.runnerType) {
100101
case CredentialDiggerRuntime.Docker:

0 commit comments

Comments
 (0)