Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use gw routing for code #4857

Merged
merged 6 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test/jest/acceptance/iac/ @snyk/cloud-dev-ex
test/jest/acceptance/iac/describe.spec.ts @snyk/cloud-dev-ex
test/jest/acceptance/iac/capture.spec.ts @snyk/cloud-dev-ex
test/jest/acceptance/snyk-apps @snyk/moose
src/lib/code-config.ts @snyk/nebula
src/lib/code-config.ts @snyk/pulsar
src/lib/errors/describe-required-argument-error.ts @snyk/cloud-dev-ex
src/lib/errors/describe-exclusive-argument-error.ts @snyk/cloud-dev-ex
src/lib/errors/no-supported-sast-files-found.ts @snyk/zenith
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@sentry/node": "^7.34.0",
"@snyk/cli-interface": "2.12.0",
"@snyk/cloud-config-parser": "^1.14.5",
"@snyk/code-client": "^4.19.1",
"@snyk/code-client": "^4.22.3",
"@snyk/dep-graph": "^2.7.4",
"@snyk/docker-registry-v2-client": "^2.10.0",
"@snyk/fix": "file:packages/snyk-fix",
Expand Down
7 changes: 6 additions & 1 deletion src/lib/code-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ import config from './config';
export function getCodeClientProxyUrl(): string {
const url = new URL(config.API);
const domain = url.origin;
const routeToAPI = isFedramp(domain);
return (
config.CODE_CLIENT_PROXY_URL ||
domain.replace(/\/\/(ap[pi]\.)?/, '//deeproxy.')
domain.replace(/\/\/(ap[pi]\.)?/, routeToAPI ? '//api.' : '//deeproxy.')
);
}

function isFedramp(domain: string): boolean {
return domain.includes('snykgov.io');
}
2 changes: 2 additions & 0 deletions src/lib/plugins/sast/analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type GetCodeAnalysisArgs = {
};
connectionOptions: {
org?: string;
orgId?: string;
source: string;
baseURL: string;
requestId: string;
Expand Down Expand Up @@ -102,6 +103,7 @@ export async function getCodeTestResults(
source: 'snyk-cli',
requestId,
org: sastSettings.org,
orgId: config.orgId,
},
analysisOptions: {
severity: options.severityThreshold
Expand Down
2 changes: 2 additions & 0 deletions test/jest/unit/snyk-code/snyk-code-test.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ describe('Test snyk code', () => {
sessionToken,
source,
requestId: 'test-id',
orgId: '',
},
analysisOptions: {
severity,
Expand Down Expand Up @@ -850,6 +851,7 @@ describe('Test snyk code', () => {
sessionToken,
source,
requestId: 'test-id',
orgId: '',
},
analysisOptions: {
severity,
Expand Down
Loading