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

chore: sync release-candidate-back-to-main #5552

Merged
merged 27 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
badecb3
Revert "revert: "feat: change binary download url""
sandor-trombitas Sep 9, 2024
0b4e721
Merge pull request #5475 from snyk/revert-5431-revert-5369-CLI-415-bi…
j-luong Sep 9, 2024
3295116
docs: release notes
sandor-trombitas Sep 10, 2024
131726a
Merge pull request #5477 from snyk/chore/update-rc-release-notes
sandor-trombitas Sep 10, 2024
58c22d9
fix: upgrade go-getter to 1.7.5
PeterSchafer Aug 30, 2024
a9c5f6a
Merge pull request #5478 from snyk/fix/update_deps
PeterSchafer Sep 10, 2024
70c9da1
docs: update release notes
thisislawatts Oct 18, 2024
3912b72
Merge branch 'release-candidate-again' into tmp/123-release-candidate…
thisislawatts Oct 18, 2024
e50bdfb
Merge pull request #5540 from snyk/tmp/123-release-candidate-again
thisislawatts Oct 18, 2024
baef934
fix: update snyk-nodejs-plugin to fix micromatch vuln
sandor-trombitas Oct 16, 2024
151f63d
fix: add missing option `--gradle-normalize-deps` to SBOM command
mcombuechen Oct 14, 2024
a543179
fix: include CVE in JSON output of `sbom test` command
mcombuechen Oct 16, 2024
7ca7919
fix: update snyk-ls to latest fixes
bastiandoetsch Oct 18, 2024
7798d13
fix(deps): address security vulnerability in snyk-php-plugin
thisislawatts Oct 18, 2024
d6a3d9d
Merge pull request #5542 from snyk/rc/upgrade-release-candidate
thisislawatts Oct 18, 2024
c614284
fix(deps): address security vulnerability in snyk-gradle-plugin
thisislawatts Oct 21, 2024
da81bad
Merge pull request #5544 from snyk/fix/upgrade-snyk-gradle-plugin-v-4…
thisislawatts Oct 21, 2024
d23d69f
fix: update styles
bastiandoetsch Oct 23, 2024
eb749aa
Merge pull request #5547 from snyk/fix/IDE-690_fixed_styles
bastiandoetsch Oct 23, 2024
07a9f6b
fix: make scans run async
bastiandoetsch Oct 23, 2024
e024276
Revert "fix: respect default detection depth of 4"
thisislawatts Oct 23, 2024
c759f9e
Merge pull request #5548 from snyk/fix/IDE-690_didchangeworkspace_con…
thisislawatts Oct 23, 2024
20cedcf
Merge pull request #5549 from snyk/fix/revert-detection-depth
thisislawatts Oct 23, 2024
a274f78
docs: capture latest updates in release notes
thisislawatts Oct 23, 2024
d037ebb
Merge pull request #5551 from snyk/docs/update-release-notes
thisislawatts Oct 23, 2024
27af724
chore: drop RELEASE_NOTES
thisislawatts Oct 23, 2024
39d24dd
Merge branch 'main' into release-candidate-conflict-resolution
thisislawatts Oct 23, 2024
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
6 changes: 3 additions & 3 deletions cliv2/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ require (
github.com/google/uuid v1.6.0
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.33.0
github.com/snyk/cli-extension-dep-graph v0.0.0-20240426125928-8d56ac52821e
github.com/snyk/cli-extension-dep-graph v0.0.0-20241014075215-311d3c8a423f
github.com/snyk/cli-extension-iac-rules v0.0.0-20241008152401-24c8cf03a1a3
github.com/snyk/cli-extension-sbom v0.0.0-20240820111700-68258cba52c7
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7
github.com/snyk/error-catalog-golang-public v0.0.0-20240809094525-c48d19c27edb
github.com/snyk/go-application-framework v0.0.0-20241011135148-71eca49aa231
github.com/snyk/go-httpauth v0.0.0-20240307114523-1f5ea3f55c65
github.com/snyk/snyk-iac-capture v0.6.5
github.com/snyk/snyk-ls v0.0.0-20241017063705-68655f0e7f39
github.com/snyk/snyk-ls v0.0.0-20241023124225-627b73041471
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
Expand Down
12 changes: 6 additions & 6 deletions cliv2/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,12 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A=
github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo=
github.com/snyk/cli-extension-dep-graph v0.0.0-20240426125928-8d56ac52821e h1:j17Ujw51/2SC3m1hbNCUwxFc8aNIFyfpnwFAszgEM8c=
github.com/snyk/cli-extension-dep-graph v0.0.0-20240426125928-8d56ac52821e/go.mod h1:QF3v8HBpOpyudYNCuR8LqfULutO76c91sBdLzD+pBJU=
github.com/snyk/cli-extension-dep-graph v0.0.0-20241014075215-311d3c8a423f h1:xZK+6ug+pNgnIfPFGkQtxBZwcN/6RoXpQruRHimjfKM=
github.com/snyk/cli-extension-dep-graph v0.0.0-20241014075215-311d3c8a423f/go.mod h1:QF3v8HBpOpyudYNCuR8LqfULutO76c91sBdLzD+pBJU=
github.com/snyk/cli-extension-iac-rules v0.0.0-20241008152401-24c8cf03a1a3 h1:AQMi52/aevl9bBSzwxGLz9kxInojkSe/Q6j1s1s6yJg=
github.com/snyk/cli-extension-iac-rules v0.0.0-20241008152401-24c8cf03a1a3/go.mod h1:A/DNK3ZnUgqOKJ33Lc1z5KbbHqRSBgwCWw9KuyJu0xQ=
github.com/snyk/cli-extension-sbom v0.0.0-20240820111700-68258cba52c7 h1:+xhigV8lkriZ8riIg79Yx/sDpKZV9ihz2iAM0Xa8/V4=
github.com/snyk/cli-extension-sbom v0.0.0-20240820111700-68258cba52c7/go.mod h1:5CaY1bgvJY/uoG/1plLOf8T8o9AkwoBIGvw34RfRLZw=
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f h1:dlL+f+5sjHj4JCzW/Evl1x9UREXLyc3M4KjoZvQx0Bs=
github.com/snyk/cli-extension-sbom v0.0.0-20241016065306-0df2be5b3b8f/go.mod h1:5CaY1bgvJY/uoG/1plLOf8T8o9AkwoBIGvw34RfRLZw=
github.com/snyk/code-client-go v1.10.0 h1:t/hBINxj4lKvoo681uGhxHBpMued/j68p2sHbB9qbfo=
github.com/snyk/code-client-go v1.10.0/go.mod h1:orU911flV1kJQOlxxx0InUQkAfpBrcERsb2olfnlI8s=
github.com/snyk/container-cli v0.0.0-20240821111304-7ca1c415a5d7 h1:Zn5BcV76oFAbJm5tDygU945lvoZ3yY8FoRFDC3YpwF8=
Expand All @@ -770,8 +770,8 @@ github.com/snyk/policy-engine v0.31.3 h1:FepCg6QN/X8uvxYjF+WwB2aiBPJB+NENDgKQeI/
github.com/snyk/policy-engine v0.31.3/go.mod h1:Z9/hcngz+2txX4QfQRwfODk8F7w4mr/IQOvCtIosnLo=
github.com/snyk/snyk-iac-capture v0.6.5 h1:992DXCAJSN97KtUh8T5ndaWwd/6ZCal2bDkRXqM1u/E=
github.com/snyk/snyk-iac-capture v0.6.5/go.mod h1:e47i55EmM0F69ZxyFHC4sCi7vyaJW6DLoaamJJCzWGk=
github.com/snyk/snyk-ls v0.0.0-20241017063705-68655f0e7f39 h1:yZwQfzpNNYmV6p97F2mW14N725Ce5Zem3VNcriKhuJY=
github.com/snyk/snyk-ls v0.0.0-20241017063705-68655f0e7f39/go.mod h1:ymVHnn1JE/pqWhTHSQEz/1MP8FmYYfYFszaptaaI/PE=
github.com/snyk/snyk-ls v0.0.0-20241023124225-627b73041471 h1:k2mJ+C7chUf+THMsgbUBFTxxMBNBeGEdz6NrMbZHt/o=
github.com/snyk/snyk-ls v0.0.0-20241023124225-627b73041471/go.mod h1:ymVHnn1JE/pqWhTHSQEz/1MP8FmYYfYFszaptaaI/PE=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/sourcegraph/go-lsp v0.0.0-20240223163137-f80c5dd31dfd h1:Dq5WSzWsP1TbVi10zPWBI5LKEBDg4Y1OhWEph1wr5WQ=
Expand Down
124 changes: 100 additions & 24 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@
"snyk-cpp-plugin": "2.24.0",
"snyk-docker-plugin": "6.13.2",
"snyk-go-plugin": "1.23.0",
"snyk-gradle-plugin": "4.1.0",
"snyk-gradle-plugin": "4.6.0",
"snyk-module": "3.1.0",
"snyk-mvn-plugin": "3.6.0",
"snyk-nodejs-lockfile-parser": "1.58.10",
"snyk-nodejs-plugin": "1.3.4",
"snyk-nuget-plugin": "2.7.8",
"snyk-php-plugin": "1.9.2",
"snyk-php-plugin": "1.10.0",
"snyk-policy": "^4.0.0",
"snyk-python-plugin": "2.2.1",
"snyk-resolve-deps": "4.8.0",
Expand Down
3 changes: 0 additions & 3 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ export const CALL_PATH_LEADING_ELEMENTS = 2;

// Number of function names to show in the end of an abbreviated call path
export const CALL_PATH_TRAILING_ELEMENTS = 2;

// Number of subdirectories to search when running monitor or test
export const MAX_DETECTION_DEPTH = 4;
47 changes: 21 additions & 26 deletions src/lib/find-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import * as pathLib from 'path';

import * as sortBy from 'lodash.sortby';
import * as groupBy from 'lodash.groupby';
import * as assign from 'lodash.assign';
import { detectPackageManagerFromFile } from './detect';
import * as debugModule from 'debug';
import {
PNPM_FEATURE_FLAG,
SUPPORTED_MANIFEST_FILES,
} from './package-managers';
import * as merge from 'lodash.merge';
import { MAX_DETECTION_DEPTH } from './constants';

const debug = debugModule('snyk:find-files');

Expand Down Expand Up @@ -56,12 +55,28 @@ interface FindFilesRes {
const ignoreFolders = ['node_modules', '.build'];

interface FindFilesConfig {
path: string;
ignore?: string[];
filter?: string[];
levelsDeep?: number;
featureFlags?: Set<string>;
}

type DefaultFindConfig = {
path: string;
ignore: string[];
filter: string[];
levelsDeep: number;
featureFlags: Set<string>;
}
};

const defaultFindConfig: DefaultFindConfig = {
path: '',
ignore: [],
filter: [],
levelsDeep: 4,
featureFlags: new Set<string>(),
};

/**
* Find all files in given search path. Returns paths to files found.
Expand All @@ -71,10 +86,8 @@ interface FindFilesConfig {
* @param filter (optional) file names to find. If not provided all files are returned.
* @param levelsDeep (optional) how many levels deep to search, defaults to two, this path and one sub directory.
*/
export async function find(
findConfig: Partial<FindFilesConfig>,
): Promise<FindFilesRes> {
const config = getFindConfig(findConfig);
export async function find(findConfig: FindFilesConfig): Promise<FindFilesRes> {
const config: DefaultFindConfig = assign({}, defaultFindConfig, findConfig);
const found: string[] = [];
const foundAll: string[] = [];

Expand Down Expand Up @@ -139,28 +152,10 @@ function findFile(path: string, filter: string[] = []): string | null {
return null;
}

function getFindConfig(option: Partial<FindFilesConfig>): FindFilesConfig {
const result = merge(
{
path: '',
ignore: [],
filter: [],
levelsDeep: MAX_DETECTION_DEPTH,
featureFlags: new Set<string>(),
},
option,
);

if (isNaN(result.levelsDeep) || result.levelsDeep === null) {
result.levelsDeep = MAX_DETECTION_DEPTH;
}
return result;
}

async function findInDirectory(
findConfig: FindFilesConfig,
): Promise<FindFilesRes> {
const config = getFindConfig(findConfig);
const config: DefaultFindConfig = assign({}, defaultFindConfig, findConfig);
const files = await readDirectory(config.path);
const toFind = files
.filter((file) => !config.ignore.includes(file))
Expand Down
3 changes: 1 addition & 2 deletions src/lib/plugins/get-deps-from-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { convertSingleResultToMultiCustom } from './convert-single-splugin-res-t
import { convertMultiResultToMultiCustom } from './convert-multi-plugin-res-to-multi-custom';
import { processYarnWorkspaces } from './nodejs-plugin/yarn-workspaces-parser';
import { ScannedProject } from '@snyk/cli-interface/legacy/common';
import { MAX_DETECTION_DEPTH } from '../constants';

const debug = debugModule('snyk-test');

Expand All @@ -44,7 +43,7 @@ export async function getDepsFromPlugin(
): Promise<pluginApi.MultiProjectResult | MultiProjectResultCustom> {
if (Object.keys(multiProjectProcessors).some((key) => options[key])) {
const scanType = options.yarnWorkspaces ? 'yarnWorkspaces' : 'allProjects';
const levelsDeep = options.detectionDepth || MAX_DETECTION_DEPTH;
const levelsDeep = options.detectionDepth;
const ignore = options.exclude ? options.exclude.split(',') : [];

const { files: targetFiles, allFilesFound } = await find({
Expand Down
3 changes: 0 additions & 3 deletions src/lib/plugins/get-extra-project-count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { legacyPlugin as pluginApi } from '@snyk/cli-interface';
import { find } from '../find-files';
import { AUTO_DETECTABLE_FILES } from '../detect';
import { Options } from '../types';
import { MAX_DETECTION_DEPTH } from '../constants';

export async function getExtraProjectCount(
root: string,
Expand All @@ -24,8 +23,6 @@ export async function getExtraProjectCount(
path: root,
ignore: [],
filter: AUTO_DETECTABLE_FILES,
levelsDeep: MAX_DETECTION_DEPTH,
featureFlags: new Set(),
});
const foundProjectsCount =
extraTargetFiles.length > 1 ? extraTargetFiles.length - 1 : undefined;
Expand Down
2 changes: 0 additions & 2 deletions test/acceptance/workspaces/mono-repo-nested/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions test/acceptance/workspaces/mono-repo-nested/README.md

This file was deleted.

This file was deleted.

Loading
Loading