Skip to content

Commit 369fe11

Browse files
committed
feat: base64 default for sast analysis
1 parent e01c853 commit 369fe11

File tree

7 files changed

+10
-54
lines changed

7 files changed

+10
-54
lines changed

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"@open-policy-agent/opa-wasm": "^1.6.0",
6363
"@snyk/cli-interface": "2.11.0",
6464
"@snyk/cloud-config-parser": "^1.14.3",
65-
"@snyk/code-client": "^4.13.0",
65+
"@snyk/code-client": "^4.14.0",
6666
"@snyk/dep-graph": "^1.27.1",
6767
"@snyk/docker-registry-v2-client": "^2.7.3",
6868
"@snyk/fix": "file:packages/snyk-fix",

src/lib/code-config.ts

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
import config from './config';
2-
import { config as userConfig } from './user-config';
32

4-
export function getCodeClientProxyUrl() {
3+
export function getCodeClientProxyUrl(): string {
54
const url = new URL(config.API);
65
const domain = url.origin;
76
return (
87
config.CODE_CLIENT_PROXY_URL ||
98
domain.replace(/\/\/(ap[pi]\.)?/, '//deeproxy.')
109
);
1110
}
12-
13-
export function getBase64Encoding(
14-
enabled = userConfig.get('use-base64-encoding'),
15-
): boolean {
16-
if (enabled) {
17-
return enabled.toLowerCase() === 'true';
18-
}
19-
return false;
20-
}

src/lib/plugins/sast/analysis.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { ReportingDescriptor, Result } from 'sarif';
77
import { SEVERITY } from '../../snyk-test/legacy';
88
import { api } from '../../api-token';
99
import config from '../../config';
10-
import { getBase64Encoding } from '../../code-config';
1110
import { spinner } from '../../spinner';
1211
import { Options } from '../../types';
1312
import { SastSettings, Log } from './types';
@@ -58,9 +57,6 @@ async function getCodeAnalysis(
5857
? sastSettings.localCodeEngine.url
5958
: getCodeClientProxyUrl();
6059

61-
const base64Encoding = getBase64Encoding();
62-
debug(`base64 encoding enabled: ${base64Encoding}`);
63-
6460
// TODO(james) This mirrors the implementation in request.ts and we need to use this for deeproxy calls
6561
// This ensures we support lowercase http(s)_proxy values as well
6662
// The weird IF around it ensures we don't create an envvar with
@@ -86,7 +82,7 @@ async function getCodeAnalysis(
8682
? severityToAnalysisSeverity(options.severityThreshold)
8783
: AnalysisSeverity.info;
8884
const result = await analyzeFolders({
89-
connection: { baseURL, sessionToken, source, requestId, base64Encoding },
85+
connection: { baseURL, sessionToken, source, requestId },
9086
analysisOptions: { severity },
9187
fileOptions: { paths: [root] },
9288
analysisContext: {

test/jest/acceptance/snyk-code-config/snyk-code-config.spec.ts

-13
This file was deleted.

test/jest/unit/snyk-code/snyk-code-config.spec.ts

-15
This file was deleted.

test/jest/unit/snyk-code/snyk-code-test.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,6 @@ describe('Test snyk code', () => {
685685
sessionToken,
686686
source,
687687
requestId: 'test-id',
688-
base64Encoding: false,
689688
},
690689
analysisOptions: {
691690
severity,
@@ -781,7 +780,6 @@ describe('Test snyk code', () => {
781780
sessionToken,
782781
source,
783782
requestId: 'test-id',
784-
base64Encoding: false,
785783
},
786784
analysisOptions: {
787785
severity,

0 commit comments

Comments
 (0)