Граф коммитов

217 Коммитов

Автор SHA1 Сообщение Дата
Greg Villicana a55475de45
Report TargetFrameworks as part of DetectedComponent class (#1297)
* Report TargetFrameworks as part of DetectedComponent class
2024-11-03 14:03:36 -08:00
Eric StJohn c2546faf1e
Add experimental NuGet detector for framework and dev dependencies (#1285)
* Add experimental NuGet detector for framework and dev dependencies

This PR does 3 things.

1. Adds `TargetFramework` to NuGet package references.  This can be useful when querying component data to understand if components are used in a place where a vulnerability applies.
2. Adds _framework package_ handling.  The .NET SDK will do [conflict resolution](https://github.com/dotnet/sdk/tree/main/src/Tasks/Common/ConflictResolution) and drop assets from packages that overlap with the framework.  NuGet is planning to do the same https://github.com/NuGet/Home/issues/7344 but until then, it's beneficial to have component detection duplicate some of this logic.  When a package is identified as overlapping with the framework we'll treat it as a Development Dependency so that it might be auto-dismissed.
  - .NETFramework projects do not get this - .NETFramework does not participate in conflict resolution by default.  Even when enabled framework assemblies can be bypassed using bindingRedirects, or avoiding references to them.  Due this fragility it's not safe to apply framework package rules to .NETFramework.
  - packages.config usage is also excluded since it precludes SDK conflict resolution (and is also only used on .NETFramework projects).
3. Recognizes `ExcludeAssets="Runtime"` usage as a Development Dependencies, also any packages which don't contribute to "runtime" will be developement dependencies.

I reused _Development Dependency_ rather than plumbing a new concept.
I only mapped data for the `Microsoft.NETCore.App` - the default shared framework.  We could consider doing the same for `Microsoft.ASPNETCore.App` and `Microsoft.WindowsDesktop.App` but we'd need to plumb the reference information out of the assets file - currently that's not read and I'm not aware of a supported NuGet API for reading it (though it is present under `project/frameworks/<framework>/frameworkReferences/<name>`
.NET Core 1.x has no data since it was packages itself.  I have a fallback for future frameworks to read the data from the targeting packs.

* Address feedback
2024-10-31 11:52:23 -07:00
dependabot[bot] b055b623df
Bump cryptography (#1242)
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.4 to 43.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.4...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 12:15:09 -07:00
dependabot[bot] 7261dda023
Bump express (#1247)
Bumps [express](https://github.com/expressjs/express) from 4.17.2 to 4.20.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.17.2...4.20.0)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-28 12:13:56 -07:00
Amitla Vannikumar 950576a2ec
Move Go Replace Detector to Prod (#1272)
* move goreplace from experiments to prod

* json version

* go replace detector

* require string

---------

Co-authored-by: Amitla Vannikumar <avannikumar@microsoft.com>
2024-10-10 10:18:53 -07:00
Paul Dorsch ed4488a297
Add support for cleaning up files created by tool (#1259)
* add feature that removes some python files that are created during pip install report dry run

* move to more central file detector

* add tests and fix bugs

* remove extra dir

* fix dotnet 8 styling

* semaphore to only run a single cleanup process at a time for a given detector

* add test

* add test

* refactor to abstract file and directory operations out to allow for unit tests with a mocked file system

* break out the cleanup changes to its own abstract class

* pr feedback

* rename vars and fix tests

* torevert: quick console log for test

* revert log and add file to source control

* os agnostic test file paths

* update snapshot verify, and bump report version

* add python to verification pipeline

* adding back setup file
2024-10-03 16:49:36 -04:00
Coby Allred 15c96f4776
Add ARM64 Runtimes (#1255)
* Add arm64 RIDs

* Simplify release YAML

* Update release.yml

* Update Microsoft.ComponentDetection.csproj
2024-10-01 09:09:11 -07:00
Amitla Vannikumar 79ff9edf32
Adding Support for Relative Paths Go Replace Detector (#1254)
* adding go tests

* upgrade version

* unused using statement

* nit changes

* nit

* make tests more generic

* simplifying conditional statements

* simplifying

---------

Co-authored-by: Amitla Vannikumar <avannikumar@microsoft.com>
2024-09-30 15:55:47 -07:00
Coby Allred 809f458c4a
Update Component Detection to .NET v8 (#1249)
* Initial NET 8 changes

* Resolve formatting errors, fix tests

* Fix debug log condition

* Rollback SDK version

* Update csproj refs

* Fix integration test build failures

* Potential test fix

* Set up .NET 6

* Update test csproj
2024-09-27 13:41:06 -07:00
Paul Dorsch 836085312c
Add additional removal indicator (#1245)
* add additional removal indicator

* remove param

* pr feedback
2024-09-19 13:53:19 -04:00
cobya 7528c8f4fd Revert non-PR .NET 8 commits 2024-09-16 09:27:20 -07:00
cobya bb9945e5ac Resolve formatting errors, fix tests 2024-09-16 09:20:15 -07:00
cobya 7bb2afae00 Initial NET 8 changes 2024-09-10 12:57:23 -07:00
Paul Dorsch 1d1e13bfa7
update packages to fix pack (#1234) 2024-08-23 15:27:44 -04:00
Paul Dorsch 9297f055e6
Pauldorsch/fix invalid version bug (#1232)
* catch exceptions thrown from manual dependency scanning

* handle argument exceptions thrown, skipping those packages

* whitespace

* pr feedback
2024-08-22 10:07:36 -04:00
stan-sz 2dcd512bfa
Use MSTest meta package (#1215)
* Use MSTest meta package

This enables running MSTest Analyzers on test code to help avoid common test problems.

* Fix code coverage

* Fixes

Upgrade to latest and fix unnecessary type param

* Fix tests

* PR feedback

* Fix CC
2024-08-22 08:03:39 -04:00
Paul Dorsch 00edc78bf5
Pauldorsch/pipreport version fix (#1229)
* check for valid python versions before adding to the dependency graph

* bump version

* compiled regex
2024-08-19 12:49:12 -04:00
Paul Dorsch edf0c8dc6e
Fix bug where pipreport used index-urls from requirements.txt (#1227)
* fix bug where pipreport used index urls in requirements.txt

* update tests

* docs

* add --no-input to pip install, so we do not hang waiting for user input

* pr feedback: performance and cleanup

* bump version
2024-08-19 14:28:52 +00:00
Paul Dorsch 924c4ea498
Pauldorsch/fix support python m pip (unit tests) (#1223)
* add support for python -m pip

* update pip command service to accept python exe

* swap so we use pip as default

* fixing remote build

* fix tests

* add unit tests
2024-08-08 17:06:32 -04:00
Paul Dorsch 84e9308790
Pauldorsch/fix support python m pip (#1222)
* add support for python -m pip

* update pip command service to accept python exe

* swap so we use pip as default

* fixing remote build

* fix tests
2024-08-08 16:30:12 -04:00
Greg Villicana 80146ce1b9
Add logs to MvnCLI and use dictionaries to improve perf on large repos (#1213)
* Add logs to MvnCLI and use dictionaries to improve perf on large repos
* Add cancellation token to MvnCLI command
2024-07-30 15:56:59 -07:00
Paul Dorsch f4d84a84e8
Pauldorsch/bugfix invalid pipreport files (#1205)
* ignore pregenerated pipreports that don't cover the correct set of dependencies

* add validation to the pre-generated pipreport to prevent underdetection for overridden reports

* dispose of telemetry object

* move re-used code to a common utility method
2024-07-19 16:09:52 -04:00
Paul Dorsch 024e2a57ce
PipReport back to experimental, add pre-generated PipReport parsing (#1201)
* revert experiment graduation, bump threads, and enable fast deps

* put reqs back

* add ability for pip to detect pregenerated reports with a specific naming scheme

* better directory handling

* improve logging
2024-07-16 15:49:35 -04:00
Amitla Vannikumar 0707d99b36
Revert "Move Go With Replace Detector to the Standard Go Detector" (#1198)
* Revert "go detector (#1194)"

This reverts commit 39058c5561.

* Update ServiceCollectionExtensions.cs

* Update ServiceCollectionExtensions.cs
2024-07-10 14:18:24 -07:00
Amitla Vannikumar 39058c5561
go detector (#1194)
Co-authored-by: Amitla Vannikumar <avannikumar@microsoft.com>
2024-07-08 12:54:11 -07:00
Paul Dorsch fb9423e93c
PipReport option to fallback and parse roots from source (#1190)
* add fallback logic to pipreport for cases where we shouldn't reach out to remote feed, and should parse source instead

* add the manual detection as fallback if pip report fails

* add option to skip or fallback to a source code scan

* add docs and fix tests

* remove fallback

* add fallback back, and env var to allow for skipping fallback
2024-07-08 12:39:27 -04:00
Paul Dorsch c20c3b0f56
Pauldorsch/reconcile dependency graph logic (#1183)
* reconcile dependency graph logic

* handle null / empty conditional vars

* remove files

* current pip detector case insensitive metadata file match

* some cleanup

* fix tests

* test with reverted reqs

* Revert "test with reverted reqs"

This reverts commit 293a4b53cc.

* disable parallelism for all but pip report

* whitespace

* pr feedback, fix ignore packages, bump versions
2024-06-21 13:25:42 -07:00
Amitla Vannikumar 2284e06a29
Go With Replace Detector no File Parsing (#1181)
* not parsing for replace module

* require

---------

Co-authored-by: Amitla Vannikumar <avannikumar@microsoft.com>
2024-06-19 15:11:43 -07:00
Paul Dorsch 6c4ca4f842
Enable parallelism by detector (#1171)
* conflicts

* save

* resolving remaining conflicts

* change location of default max thread var

* add input validation

* reduce default parallelism

* Update default max threads

---------

Co-authored-by: Coby Allred <cobyallred@gmail.com>
2024-06-14 13:21:12 -07:00
Fernando Rojo 22a88b52af
Add python version conditional dependency check (#973)
* Add python version conditional dependency check

* add sys_platform condition, and some tests

* add comments / string comparison

---------

Co-authored-by: Coby Allred <cobyallred@gmail.com>
Co-authored-by: Paul Dorsch <pauldorsch@microsoft.com>
2024-06-14 13:10:26 -07:00
Paul Dorsch e626211624
Add CancellationToken support to CD processes (#1167)
* add cancellation tokens to pip report

* update timeouts for experimental runs

* fix tests

* simplify logic

* update registration

* remove out/err timeout

* fix ci build

* swallow certain invalid operation exceptions from killing processes

* add pip command test

* pr feedback
2024-06-13 18:08:42 -07:00
Paul Dorsch e8c72a1b00
Add env var that allows customers to skip pip report (#1166)
* add env var to skip pip report

* fixed log messages
2024-06-10 16:17:44 -07:00
Greg Villicana 341b036de7
Sanitize Docker environment vars in logs (#1163) 2024-06-06 17:50:14 -07:00
Greg Villicana 07a2e84f94
Simple sanitization in strings used in CLI before logging (#1155) 2024-06-05 18:10:19 -07:00
Paul Dorsch dec038ae37
fix the requested_extras parsing for pip report (#1154) 2024-06-05 12:42:53 -04:00
Coby Allred 9f1e5a9083
Update NormalizePath to be more robust (#1152) 2024-06-04 22:10:30 +00:00
Paul Dorsch b3e3c9de59
Pauldorsch/remove pip report throw (#1151)
* remove throw for pip report so all pip files will be scanned

* fix tests
2024-06-04 15:03:27 -07:00
Paul Dorsch 393db4724c
Merged pnpm6 experiment into pnpm detector (#1145)
* merged pnpm6 into pnpm detector

* bump version and make the factory method private

* name of type

* improved logging

* added telemetry record for pnpm, and other minor updates to methods for conciseness

* standardize the invalid version telemetry object

* removed invalid version file
2024-06-03 13:02:49 -04:00
Coby Allred 3947eee67a
Small updates to PipReport detector (#1131)
Co-authored-by: Coby Allred <coallred@microsoft.com>
2024-05-23 09:13:54 -07:00
Coby Allred e9a146ca76
Add Pip installation report experimental detector (#1129)
* Add PipReport experimental detector

* Don't use primary constructor

* Fix CI break

* Address PR comments

* Update src/Microsoft.ComponentDetection.Detectors/pip/PipReportUtilities.cs

Co-authored-by: Jamie Magee <jamagee@microsoft.com>

* Update src/Microsoft.ComponentDetection.Detectors/pip/PipReportComponentDetector.cs

Co-authored-by: Jamie Magee <jamagee@microsoft.com>

* Log cmd failure

---------

Co-authored-by: Coby Allred <coallred@microsoft.com>
Co-authored-by: Jamie Magee <jamagee@microsoft.com>
2024-05-22 18:43:13 -07:00
Fernando Rojo 5894c27af3
Update RustCli Parsing to process pkgId, and introduce manual override (#1106)
* Update RustCli Parsing to process pkgId, and allow manual override to fallback with DisableRustCliScan

* add tests

* Update detector version

* Update cli detector to use manifest packages instead of manually parsing
2024-05-16 14:15:54 -07:00
Coby Allred 95c12a8b4e
Add pnpm v6 support as an experimental detector (#1110)
* Add pnpm v6 support

* PR comments

---------

Co-authored-by: Coby Allred <coallred@microsoft.com>
2024-05-15 12:57:49 -07:00
Amitla Vannikumar 2de3cc0db2
Go CLI Replacement (#1052)
* adding go cli replace strategy

* adding test for replace section

* revert gocomponent detector

* reverting

* adding replace module test

* adding tests and null checks

---------

Co-authored-by: Amitla Vannikumar <avannikumar@microsoft.com>
2024-04-01 10:17:14 -07:00
Greg Villicana 1165716c72
Update VCPKG component identifier in detector (#1046) 2024-03-25 10:39:26 -07:00
Juan Carlos Fiorenzano cd5e3010e5
Support for release candidate versions python detector (#1021)
* Support for release candidate versions python detector

* Allow SimplePythonResolver to detect release candidate versions

* bumped detectors version
2024-03-15 08:35:17 -07:00
Rushabh 9a600c8690
Evaluating invalid maven scope as "Compile" (#1033)
* Evaluating invalid maven scope as "Compile"

* upgrading component version

* fixed typos in test names
2024-03-14 20:54:13 -07:00
Juan Carlos Fiorenzano fb464caf8d
Handle comments gracefully by the go fallback detector (#1027) 2024-03-14 08:16:53 -07:00
Rushabh 0bbeeee418
Added optional dependency detection for npm lockfiles (version 2 and 3) (#1030) 2024-03-13 14:55:31 -07:00
Juan Carlos Fiorenzano 5be87280bf
Ignore leading and trailing spaces on versions (#1025) 2024-03-06 15:31:08 -08:00
James Oakley f85b6c4363
Support development dependencies for the Gradle detector (#878)
* Support development dependencies for the Gradle detector

Lack of development dependency detection for Gradle is a problem for
Android teams, especially in the context of Component Governance
alerts. Unfortunately Gradle doesn't provide enough information to
definitively identify dev dependencies in all cases, so manual
configuration is required. This change adds dev dependency
classification through two mechanisms

1. `buildscript-gradle.lockfile` and `settings-gradle.lockfile`
   contain only build-system dependencies, so always classify these as
   development dependencies.
2. Processing based on two new environment variables:
   `GRADLE_PROD_CONFIGURATIONS_REGEX` and
   `GRADLE_DEV_CONFIGURATIONS_REGEX`. Gradle lockfiles indicate which
   Gradle configuration(s) each dependency is required by.
   `GRADLE_PROD_CONFIGURATIONS_REGEX` allows specifying
   production configurations explicitly. All other configurations are
   considered development. Alternately, dev configurations may be
   specified in `GRADLE_DEV_CONFIGURATIONS_REGEX` and all others are
   considered production.

* Changes based on meeting prior to the holidays

* fluent assertions

* Visual studio recommendations

* More fluent assertsions

* Fix test to be cross-platform

* Fix the cross-platform test fix

* Fix code coverage by removing dead code check

* Address code review comments
2024-02-27 10:39:53 -08:00