Skip to content

Commit c1def2b

Browse files
committed
Address community feedback
1 parent 9599d27 commit c1def2b

File tree

1 file changed

+35
-13
lines changed

1 file changed

+35
-13
lines changed

proposed/2021/MachineReadableOutput.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ dotnet list [<PROJECT>|<SOLUTION>] package [--config <SOURCE>]
4848
dotnet list package -h|--help
4949
```
5050

51-
`<FORMAT>` - Allowed values as part of spec is `json`. Also `text` is acceptable value too, it'll just output current cli output. (In the future `parseable`, `csv`, `yaml`, `xml` could be candidates.)
52-
5351
#### `> dotnet list package`
5452

5553
```dotnetcli
@@ -80,6 +78,7 @@ Project 'MyProjectB' has the following package references
8078
"projects": {
8179
"MyProjectA": [
8280
{
81+
"Path": "src/tool/MyProjectA.csproj",
8382
"framework": "netcoreapp3.1",
8483
"topLevelPackages": [
8584
{
@@ -102,6 +101,7 @@ Project 'MyProjectB' has the following package references
102101
],
103102
"MyProjectB": [
104103
{
104+
"Path": "src/lib/MyProjectB.csproj",
105105
"framework": "netcoreapp3.1",
106106
"topLevelPackages": [
107107
{
@@ -117,6 +117,7 @@ Project 'MyProjectB' has the following package references
117117
]
118118
},
119119
{
120+
"Path": "src/lib/MyProjectB.csproj",
120121
"framework": "net5.0",
121122
"topLevelPackages": [
122123
{
@@ -175,6 +176,7 @@ Project `MyProjectB` has the following updates to its packages
175176
"projects": {
176177
"MyProjectA": [
177178
{
179+
"Path": "src/tool/MyProjectA.csproj",
178180
"framework": "netcoreapp3.1",
179181
"topLevelPackages": [
180182
{
@@ -200,6 +202,7 @@ Project `MyProjectB` has the following updates to its packages
200202
],
201203
"MyProjectB": [
202204
{
205+
"Path": "src/tool/MyProjectB.csproj",
203206
"framework": "netcoreapp3.1",
204207
"topLevelPackages": [
205208
{
@@ -217,6 +220,7 @@ Project `MyProjectB` has the following updates to its packages
217220
]
218221
},
219222
{
223+
"Path": "src/tool/MyProjectB.csproj",
220224
"framework": "net5.0",
221225
"topLevelPackages": [
222226
{
@@ -271,8 +275,10 @@ Project `MyProjectB` has the following deprecated packages
271275
"https://apidev.nugettest.org/v3-index/index.json"
272276
],
273277
"projects": {
278+
274279
"MyProjectA": [
275280
{
281+
"Path": "src/tool/MyProjectA.csproj",
276282
"framework": "netcoreapp3.1",
277283
"topLevelPackages": [
278284
{
@@ -296,6 +302,7 @@ Project `MyProjectB` has the following deprecated packages
296302
],
297303
"MyProjectB": [
298304
{
305+
"Path": "src/lib/MyProjectB.csproj",
299306
"framework": "netcoreapp3.1",
300307
"topLevelPackages": [
301308
{
@@ -307,6 +314,7 @@ Project `MyProjectB` has the following deprecated packages
307314
]
308315
},
309316
{
317+
"Path": "src/lib/MyProjectB.csproj",
310318
"framework": "net5.0",
311319
"topLevelPackages": [
312320
{
@@ -378,6 +386,7 @@ Project `MyProjectB` has the following vulnerable packages
378386
"projects": {
379387
"MyProjectA": [
380388
{
389+
"Path": "src/lib/MyProjectA.csproj",
381390
"framework": "netcoreapp3.1",
382391
"topLevelPackages": [
383392
{
@@ -401,6 +410,7 @@ Project `MyProjectB` has the following vulnerable packages
401410
],
402411
"MyProjectB": [
403412
{
413+
"Path": "src/lib/MyProjectB.csproj",
404414
"framework": "netcoreapp3.1",
405415
"topLevelPackages": [
406416
{
@@ -422,6 +432,7 @@ Project `MyProjectB` has the following vulnerable packages
422432
]
423433
},
424434
{
435+
"Path": "src/lib/MyProjectB.csproj",
425436
"framework": "net5.0",
426437
"topLevelPackages": [
427438
{
@@ -497,6 +508,7 @@ Project 'MyProjectB' has the following package references
497508
"projects": {
498509
"MyProjectA": [
499510
{
511+
"Path": "src/lib/MyProjectA.csproj",
500512
"framework": "netcoreapp3.1",
501513
"topLevelPackages": [
502514
{
@@ -530,6 +542,7 @@ Project 'MyProjectB' has the following package references
530542
],
531543
"MyProjectB": [
532544
{
545+
"Path": "src/lib/MyProjectB.csproj",
533546
"framework": "netcoreapp3.1",
534547
"topLevelPackages": [
535548
{
@@ -556,6 +569,7 @@ Project 'MyProjectB' has the following package references
556569
]
557570
},
558571
{
572+
"Path": "src/lib/MyProjectB.csproj",
559573
"framework": "net5.0",
560574
"topLevelPackages": [
561575
{
@@ -608,15 +622,13 @@ Please note, except "tab completion" (for dotnet) part all changes would be insi
608622
<!-- What lessons from other communities can we learn from? -->
609623
<!-- Are there any resources that are relevent to this proposal? -->
610624

611-
* https://github.com/NuGet/Home/blob/dotnet-audit/proposed/2021/DotNetAudit.md#dotnet-audit---json
625+
* https://github.com/NuGet/Home/blob/dotnet-audit/proposed/2021/DotNetAudit.md#dotnet-audit---futjson There're some overlaps, but current spec is one more focused on SBOM and CI/CD actions, while `dotnet audit fix` is more focused detecting/fixing dependencies manually. Current spec already include ideas from this spec like `json format`.
612626

613-
* https://github.com/NuGet/Home/wiki/%5BSpec%5D-Machine-readable-output-for-dotnet-list-package
627+
* https://github.com/NuGet/Home/wiki/%5BSpec%5D-Machine-readable-output-for-dotnet-list-package Basic idea from this spec is still same here and I extended from it. In current spec more orient to `dotnet style syntax` and cover more uses cases like `dotnet list package --vulnerable --format json` and `--include-transitive`, also json schema improved to include project name/identifier for multi-project scenario which would most likely use case.
614628

615-
## Unresolved Questions
629+
* https://docs.microsoft.com/en-us/dotnet/core/diagnostics/dotnet-counters One idea we can take from `dotnet counter` is we can specify output file with `-o`, `--output` option. So instead of writing output into console, it allows output directly saved into file. It allows both `csv` and `json` formats, currently saved file doesn't have version concept.
616630

617-
* Chris: One problem is most `dotnet list package` options outputs are exclusive and have to query separately and join result to get full picture. Both below approach require additional work.
618-
* dotnet cli needs an all up `dotnet list package --all` that shows all deprecated, vulnerable, and outdated top level and transitive packages. [r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629)
619-
* Alternatively the behavior of --outdated and --deprecated could be additive rather than exclusive. That adds to the scope of this work though.[r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629). With this approach we can have single schema to populate.
631+
## Unresolved Questions
620632

621633
* Donnie: When I want to create archival records, will I want something more unique than the project name?
622634
Adding the path, repo, commit ID, etc seems complex. [r766920783](https://github.com/NuGet/Home/pull/11446#discussion_r766920783)
@@ -626,12 +638,22 @@ Adding the path, repo, commit ID, etc seems complex. [r766920783](https://github
626638
In other words, if I look at this output years from now, how would I know whether any transitives were in this project? [r766924390](https://github.com/NuGet/Home/pull/11446#discussion_r766924390)
627639
* packages.lock.json format could be used here.
628640

629-
* Loïc : Should `dotnet list package` include hashes or package source for each dependency? The package ID and version isn't globally unique across package sources?
630-
* If we re-sign package then hash changes?
631-
* Related to above: `dotnet list package --outdated`output include `The following sources were used:`, but `dotnet list package` doesn't. Should we make them same?
632-
* Loïc : Should we include some sort of hash or package source used to restore the package? A package ID and version may have different content across different package sources. In other words, the package ID + version does not actually capture which package your project depends on. [r767030495](https://github.com/NuGet/Home/pull/11446#discussion_r767030495)
633641
* Loïc : How would this format evolve if we add another "package pivot" in addition to top level and transitive packages? For example, what if we add new package kinds for source generators, Roslyn analyzers, etc...? [r767026799](https://github.com/NuGet/Home/pull/11446#discussion_r767026799)
634642

643+
>> Out of scope from MVP, this schema can evolve over time, by the time we have necessity to do change we can make more educated decision.
644+
635645
* Could we use existing packages.lock.json format? [sample](https://gist.github.com/erdembayar/4894b66bde227147b60e60997d20df41)
636646
* Direct/top level packages point to dependency packages.
637-
* Content hash.
647+
* Content hash. >> out of scope for now. Tracking issue https://github.com/NuGet/Home/issues/11552
648+
649+
## Future Possibilities
650+
651+
* Show resolution tree for transitive dependencies and constraint for dependency [resolved version](https://github.com/NuGet/Home/pull/11446/files#r777233006), tracking issue: https://github.com/NuGet/Home/issues/11553
652+
653+
* Return different exit codes if any vulnerabilities, deprecations, outdated package is [detected](https://github.com/NuGet/Home/blob/dotnet-audit/proposed/2021/DotNetAudit.md#dotnet-audit-exit-codes).
654+
655+
* `--all` option for dotnet list package [r766860629](https://github.com/NuGet/Home/pull/11446#discussion_r766860629), tracking issue https://github.com/NuGet/Home/issues/11551
656+
657+
* Include-transitive dependencies by default [r766924390](https://github.com/NuGet/Home/pull/11446#discussion_r766924390), tracking issue https://github.com/NuGet/Home/issues/11550
658+
659+
* Include hash + source for package, because same package ID+version might have different hash. It can be used to detect [dependency confusion attack](https://github.com/NuGet/Home/pull/11446#discussion_r767030495), tracking issue: https://github.com/NuGet/Home/issues/11552

0 commit comments

Comments
 (0)