github.com/anchore/syft@v1.38.2/syft/pkg/cataloger/dotnet/cataloger_test.go (about) 1 package dotnet 2 3 import ( 4 "testing" 5 6 "github.com/scylladb/go-set/strset" 7 "github.com/stretchr/testify/assert" 8 9 "github.com/anchore/syft/syft/artifact" 10 "github.com/anchore/syft/syft/file" 11 "github.com/anchore/syft/syft/pkg" 12 "github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest" 13 ) 14 15 func TestCataloger_Globs(t *testing.T) { 16 tests := []struct { 17 name string 18 fixture string 19 cataloger pkg.Cataloger 20 expected []string 21 }{ 22 { 23 name: "obtain deps.json files", 24 fixture: "test-fixtures/glob-paths", 25 cataloger: NewDotnetDepsCataloger(), 26 expected: []string{ 27 "src/something.deps.json", 28 }, 29 }, 30 { 31 name: "obtain portable executable files", 32 fixture: "test-fixtures/glob-paths", 33 cataloger: NewDotnetPortableExecutableCataloger(), 34 expected: []string{ 35 "src/something.dll", 36 "src/something.exe", 37 }, 38 }, 39 { 40 name: "obtain combined files", 41 fixture: "test-fixtures/glob-paths", 42 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 43 expected: []string{ 44 "src/something.deps.json", 45 "src/something.dll", 46 "src/something.exe", 47 }, 48 }, 49 } 50 51 for _, test := range tests { 52 t.Run(test.name, func(t *testing.T) { 53 pkgtest.NewCatalogTester(). 54 FromDirectory(t, test.fixture). 55 ExpectsResolverContentQueries(test.expected). 56 TestCataloger(t, test.cataloger) 57 }) 58 } 59 } 60 61 func TestCataloger(t *testing.T) { 62 63 net8AppExpectedDepPkgsWithoutUnpairedDlls := []string{ 64 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json)", 65 "Humanizer.Core.af @ 2.14.1 (/app/dotnetapp.deps.json)", 66 "Humanizer.Core.ar @ 2.14.1 (/app/dotnetapp.deps.json)", 67 "Humanizer.Core.az @ 2.14.1 (/app/dotnetapp.deps.json)", 68 "Humanizer.Core.bg @ 2.14.1 (/app/dotnetapp.deps.json)", 69 "Humanizer.Core.bn-BD @ 2.14.1 (/app/dotnetapp.deps.json)", 70 "Humanizer.Core.cs @ 2.14.1 (/app/dotnetapp.deps.json)", 71 "Humanizer.Core.da @ 2.14.1 (/app/dotnetapp.deps.json)", 72 "Humanizer.Core.de @ 2.14.1 (/app/dotnetapp.deps.json)", 73 "Humanizer.Core.el @ 2.14.1 (/app/dotnetapp.deps.json)", 74 "Humanizer.Core.es @ 2.14.1 (/app/dotnetapp.deps.json)", 75 "Humanizer.Core.fa @ 2.14.1 (/app/dotnetapp.deps.json)", 76 "Humanizer.Core.fi-FI @ 2.14.1 (/app/dotnetapp.deps.json)", 77 "Humanizer.Core.fr @ 2.14.1 (/app/dotnetapp.deps.json)", 78 "Humanizer.Core.fr-BE @ 2.14.1 (/app/dotnetapp.deps.json)", 79 "Humanizer.Core.he @ 2.14.1 (/app/dotnetapp.deps.json)", 80 "Humanizer.Core.hr @ 2.14.1 (/app/dotnetapp.deps.json)", 81 "Humanizer.Core.hu @ 2.14.1 (/app/dotnetapp.deps.json)", 82 "Humanizer.Core.hy @ 2.14.1 (/app/dotnetapp.deps.json)", 83 "Humanizer.Core.id @ 2.14.1 (/app/dotnetapp.deps.json)", 84 "Humanizer.Core.is @ 2.14.1 (/app/dotnetapp.deps.json)", 85 "Humanizer.Core.it @ 2.14.1 (/app/dotnetapp.deps.json)", 86 "Humanizer.Core.ja @ 2.14.1 (/app/dotnetapp.deps.json)", 87 "Humanizer.Core.ko-KR @ 2.14.1 (/app/dotnetapp.deps.json)", 88 "Humanizer.Core.ku @ 2.14.1 (/app/dotnetapp.deps.json)", 89 "Humanizer.Core.lv @ 2.14.1 (/app/dotnetapp.deps.json)", 90 "Humanizer.Core.ms-MY @ 2.14.1 (/app/dotnetapp.deps.json)", 91 "Humanizer.Core.mt @ 2.14.1 (/app/dotnetapp.deps.json)", 92 "Humanizer.Core.nb @ 2.14.1 (/app/dotnetapp.deps.json)", 93 "Humanizer.Core.nb-NO @ 2.14.1 (/app/dotnetapp.deps.json)", 94 "Humanizer.Core.nl @ 2.14.1 (/app/dotnetapp.deps.json)", 95 "Humanizer.Core.pl @ 2.14.1 (/app/dotnetapp.deps.json)", 96 "Humanizer.Core.pt @ 2.14.1 (/app/dotnetapp.deps.json)", 97 "Humanizer.Core.ro @ 2.14.1 (/app/dotnetapp.deps.json)", 98 "Humanizer.Core.ru @ 2.14.1 (/app/dotnetapp.deps.json)", 99 "Humanizer.Core.sk @ 2.14.1 (/app/dotnetapp.deps.json)", 100 "Humanizer.Core.sl @ 2.14.1 (/app/dotnetapp.deps.json)", 101 "Humanizer.Core.sr @ 2.14.1 (/app/dotnetapp.deps.json)", 102 "Humanizer.Core.sr-Latn @ 2.14.1 (/app/dotnetapp.deps.json)", 103 "Humanizer.Core.sv @ 2.14.1 (/app/dotnetapp.deps.json)", 104 "Humanizer.Core.th-TH @ 2.14.1 (/app/dotnetapp.deps.json)", 105 "Humanizer.Core.tr @ 2.14.1 (/app/dotnetapp.deps.json)", 106 "Humanizer.Core.uk @ 2.14.1 (/app/dotnetapp.deps.json)", 107 "Humanizer.Core.uz-Cyrl-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 108 "Humanizer.Core.uz-Latn-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 109 "Humanizer.Core.vi @ 2.14.1 (/app/dotnetapp.deps.json)", 110 "Humanizer.Core.zh-CN @ 2.14.1 (/app/dotnetapp.deps.json)", 111 "Humanizer.Core.zh-Hans @ 2.14.1 (/app/dotnetapp.deps.json)", 112 "Humanizer.Core.zh-Hant @ 2.14.1 (/app/dotnetapp.deps.json)", 113 "Newtonsoft.Json @ 13.0.3 (/app/dotnetapp.deps.json)", 114 "dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 115 } 116 // app packages (from deps.json) 117 net8AppExpectedDepPkgs := []string{ 118 "Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 119 } 120 net8AppExpectedDepPkgs = append(net8AppExpectedDepPkgs, net8AppExpectedDepPkgsWithoutUnpairedDlls...) 121 122 var net8AppExpectedDepPkgsWithRuntime []string 123 net8AppExpectedDepPkgsWithRuntime = append(net8AppExpectedDepPkgsWithRuntime, net8AppExpectedDepPkgs...) 124 net8AppExpectedDepPkgsWithRuntime = append(net8AppExpectedDepPkgsWithRuntime, "Microsoft.NETCore.App.Runtime.linux-x64 @ 8.0.14 (/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/Microsoft.NETCore.App.deps.json)") 125 126 // app binaries (always dlls) 127 net8AppBinaryOnlyPkgs := []string{ 128 "Humanizer @ 2.14.1.48190 (/app/Humanizer.dll)", 129 "Humanizer @ 2.14.1.48190 (/app/af/Humanizer.resources.dll)", 130 "Humanizer @ 2.14.1.48190 (/app/ar/Humanizer.resources.dll)", 131 "Humanizer @ 2.14.1.48190 (/app/az/Humanizer.resources.dll)", 132 "Humanizer @ 2.14.1.48190 (/app/bg/Humanizer.resources.dll)", 133 "Humanizer @ 2.14.1.48190 (/app/bn-BD/Humanizer.resources.dll)", 134 "Humanizer @ 2.14.1.48190 (/app/cs/Humanizer.resources.dll)", 135 "Humanizer @ 2.14.1.48190 (/app/da/Humanizer.resources.dll)", 136 "Humanizer @ 2.14.1.48190 (/app/de/Humanizer.resources.dll)", 137 "Humanizer @ 2.14.1.48190 (/app/el/Humanizer.resources.dll)", 138 "Humanizer @ 2.14.1.48190 (/app/es/Humanizer.resources.dll)", 139 "Humanizer @ 2.14.1.48190 (/app/fa/Humanizer.resources.dll)", 140 "Humanizer @ 2.14.1.48190 (/app/fi-FI/Humanizer.resources.dll)", 141 "Humanizer @ 2.14.1.48190 (/app/fr-BE/Humanizer.resources.dll)", 142 "Humanizer @ 2.14.1.48190 (/app/fr/Humanizer.resources.dll)", 143 "Humanizer @ 2.14.1.48190 (/app/he/Humanizer.resources.dll)", 144 "Humanizer @ 2.14.1.48190 (/app/hr/Humanizer.resources.dll)", 145 "Humanizer @ 2.14.1.48190 (/app/hu/Humanizer.resources.dll)", 146 "Humanizer @ 2.14.1.48190 (/app/hy/Humanizer.resources.dll)", 147 "Humanizer @ 2.14.1.48190 (/app/id/Humanizer.resources.dll)", 148 "Humanizer @ 2.14.1.48190 (/app/is/Humanizer.resources.dll)", 149 "Humanizer @ 2.14.1.48190 (/app/it/Humanizer.resources.dll)", 150 "Humanizer @ 2.14.1.48190 (/app/ja/Humanizer.resources.dll)", 151 "Humanizer @ 2.14.1.48190 (/app/ku/Humanizer.resources.dll)", 152 "Humanizer @ 2.14.1.48190 (/app/lv/Humanizer.resources.dll)", 153 "Humanizer @ 2.14.1.48190 (/app/nb-NO/Humanizer.resources.dll)", 154 "Humanizer @ 2.14.1.48190 (/app/nb/Humanizer.resources.dll)", 155 "Humanizer @ 2.14.1.48190 (/app/nl/Humanizer.resources.dll)", 156 "Humanizer @ 2.14.1.48190 (/app/pl/Humanizer.resources.dll)", 157 "Humanizer @ 2.14.1.48190 (/app/pt/Humanizer.resources.dll)", 158 "Humanizer @ 2.14.1.48190 (/app/ro/Humanizer.resources.dll)", 159 "Humanizer @ 2.14.1.48190 (/app/ru/Humanizer.resources.dll)", 160 "Humanizer @ 2.14.1.48190 (/app/sk/Humanizer.resources.dll)", 161 "Humanizer @ 2.14.1.48190 (/app/sl/Humanizer.resources.dll)", 162 "Humanizer @ 2.14.1.48190 (/app/sr-Latn/Humanizer.resources.dll)", 163 "Humanizer @ 2.14.1.48190 (/app/sr/Humanizer.resources.dll)", 164 "Humanizer @ 2.14.1.48190 (/app/sv/Humanizer.resources.dll)", 165 "Humanizer @ 2.14.1.48190 (/app/tr/Humanizer.resources.dll)", 166 "Humanizer @ 2.14.1.48190 (/app/uk/Humanizer.resources.dll)", 167 "Humanizer @ 2.14.1.48190 (/app/uz-Cyrl-UZ/Humanizer.resources.dll)", 168 "Humanizer @ 2.14.1.48190 (/app/uz-Latn-UZ/Humanizer.resources.dll)", 169 "Humanizer @ 2.14.1.48190 (/app/vi/Humanizer.resources.dll)", 170 "Humanizer @ 2.14.1.48190 (/app/zh-CN/Humanizer.resources.dll)", 171 "Humanizer @ 2.14.1.48190 (/app/zh-Hans/Humanizer.resources.dll)", 172 "Humanizer @ 2.14.1.48190 (/app/zh-Hant/Humanizer.resources.dll)", 173 "Humanizer @ 2.14.1.48190 (/app/ko-KR/Humanizer.resources.dll)", 174 "Humanizer @ 2.14.1.48190 (/app/ms-MY/Humanizer.resources.dll)", 175 "Humanizer @ 2.14.1.48190 (/app/mt/Humanizer.resources.dll)", 176 "Humanizer @ 2.14.1.48190 (/app/th-TH/Humanizer.resources.dll)", 177 "Json.NET @ 13.0.3.27908 (/app/Newtonsoft.Json.dll)", 178 "dotnetapp @ 1.0.0.0 (/app/dotnetapp.dll)", 179 } 180 181 // app relationships (from deps.json) 182 net8AppDepOnlyRelationshipsWithoutHumanizer := []string{ 183 "Humanizer.Core.af @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 184 "Humanizer.Core.ar @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 185 "Humanizer.Core.az @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 186 "Humanizer.Core.bg @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 187 "Humanizer.Core.bn-BD @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 188 "Humanizer.Core.cs @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 189 "Humanizer.Core.da @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 190 "Humanizer.Core.de @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 191 "Humanizer.Core.el @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 192 "Humanizer.Core.es @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 193 "Humanizer.Core.fa @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 194 "Humanizer.Core.fi-FI @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 195 "Humanizer.Core.fr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 196 "Humanizer.Core.fr-BE @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 197 "Humanizer.Core.he @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 198 "Humanizer.Core.hr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 199 "Humanizer.Core.hu @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 200 "Humanizer.Core.hy @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 201 "Humanizer.Core.id @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 202 "Humanizer.Core.is @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 203 "Humanizer.Core.it @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 204 "Humanizer.Core.ja @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 205 "Humanizer.Core.ko-KR @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 206 "Humanizer.Core.ku @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 207 "Humanizer.Core.lv @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 208 "Humanizer.Core.ms-MY @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 209 "Humanizer.Core.mt @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 210 "Humanizer.Core.nb @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 211 "Humanizer.Core.nb-NO @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 212 "Humanizer.Core.nl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 213 "Humanizer.Core.pl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 214 "Humanizer.Core.pt @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 215 "Humanizer.Core.ro @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 216 "Humanizer.Core.ru @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 217 "Humanizer.Core.sk @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 218 "Humanizer.Core.sl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 219 "Humanizer.Core.sr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 220 "Humanizer.Core.sr-Latn @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 221 "Humanizer.Core.sv @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 222 "Humanizer.Core.th-TH @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 223 "Humanizer.Core.tr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 224 "Humanizer.Core.uk @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 225 "Humanizer.Core.uz-Cyrl-UZ @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 226 "Humanizer.Core.uz-Latn-UZ @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 227 "Humanizer.Core.vi @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 228 "Humanizer.Core.zh-CN @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 229 "Humanizer.Core.zh-Hans @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 230 "Humanizer.Core.zh-Hant @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer @ 2.14.1 (/app/dotnetapp.deps.json)", 231 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.af @ 2.14.1 (/app/dotnetapp.deps.json)", 232 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ar @ 2.14.1 (/app/dotnetapp.deps.json)", 233 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.az @ 2.14.1 (/app/dotnetapp.deps.json)", 234 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.bg @ 2.14.1 (/app/dotnetapp.deps.json)", 235 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.bn-BD @ 2.14.1 (/app/dotnetapp.deps.json)", 236 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.cs @ 2.14.1 (/app/dotnetapp.deps.json)", 237 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.da @ 2.14.1 (/app/dotnetapp.deps.json)", 238 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.de @ 2.14.1 (/app/dotnetapp.deps.json)", 239 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.el @ 2.14.1 (/app/dotnetapp.deps.json)", 240 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.es @ 2.14.1 (/app/dotnetapp.deps.json)", 241 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fa @ 2.14.1 (/app/dotnetapp.deps.json)", 242 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fi-FI @ 2.14.1 (/app/dotnetapp.deps.json)", 243 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fr @ 2.14.1 (/app/dotnetapp.deps.json)", 244 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fr-BE @ 2.14.1 (/app/dotnetapp.deps.json)", 245 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.he @ 2.14.1 (/app/dotnetapp.deps.json)", 246 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hr @ 2.14.1 (/app/dotnetapp.deps.json)", 247 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hu @ 2.14.1 (/app/dotnetapp.deps.json)", 248 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hy @ 2.14.1 (/app/dotnetapp.deps.json)", 249 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.id @ 2.14.1 (/app/dotnetapp.deps.json)", 250 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.is @ 2.14.1 (/app/dotnetapp.deps.json)", 251 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.it @ 2.14.1 (/app/dotnetapp.deps.json)", 252 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ja @ 2.14.1 (/app/dotnetapp.deps.json)", 253 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ko-KR @ 2.14.1 (/app/dotnetapp.deps.json)", 254 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ku @ 2.14.1 (/app/dotnetapp.deps.json)", 255 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.lv @ 2.14.1 (/app/dotnetapp.deps.json)", 256 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ms-MY @ 2.14.1 (/app/dotnetapp.deps.json)", 257 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.mt @ 2.14.1 (/app/dotnetapp.deps.json)", 258 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nb @ 2.14.1 (/app/dotnetapp.deps.json)", 259 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nb-NO @ 2.14.1 (/app/dotnetapp.deps.json)", 260 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nl @ 2.14.1 (/app/dotnetapp.deps.json)", 261 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.pl @ 2.14.1 (/app/dotnetapp.deps.json)", 262 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.pt @ 2.14.1 (/app/dotnetapp.deps.json)", 263 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ro @ 2.14.1 (/app/dotnetapp.deps.json)", 264 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ru @ 2.14.1 (/app/dotnetapp.deps.json)", 265 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sk @ 2.14.1 (/app/dotnetapp.deps.json)", 266 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sl @ 2.14.1 (/app/dotnetapp.deps.json)", 267 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sr @ 2.14.1 (/app/dotnetapp.deps.json)", 268 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sr-Latn @ 2.14.1 (/app/dotnetapp.deps.json)", 269 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sv @ 2.14.1 (/app/dotnetapp.deps.json)", 270 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.th-TH @ 2.14.1 (/app/dotnetapp.deps.json)", 271 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.tr @ 2.14.1 (/app/dotnetapp.deps.json)", 272 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uk @ 2.14.1 (/app/dotnetapp.deps.json)", 273 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uz-Cyrl-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 274 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uz-Latn-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 275 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.vi @ 2.14.1 (/app/dotnetapp.deps.json)", 276 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-CN @ 2.14.1 (/app/dotnetapp.deps.json)", 277 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-Hans @ 2.14.1 (/app/dotnetapp.deps.json)", 278 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-Hant @ 2.14.1 (/app/dotnetapp.deps.json)", 279 "Newtonsoft.Json @ 13.0.3 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 280 } 281 282 var net8AppDepOnlyRelationships []string 283 humanizerToAppDepsRelationship := "Humanizer @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)" 284 net8AppDepOnlyRelationships = append(net8AppDepOnlyRelationships, net8AppDepOnlyRelationshipsWithoutHumanizer...) 285 net8AppDepOnlyRelationships = append(net8AppDepOnlyRelationships, humanizerToAppDepsRelationship) 286 287 var net8AppDepOnlyRelationshipsWithRuntime []string 288 net8AppDepOnlyRelationshipsWithRuntime = append(net8AppDepOnlyRelationshipsWithRuntime, net8AppDepOnlyRelationships...) 289 net8AppDepOnlyRelationshipsWithRuntime = append(net8AppDepOnlyRelationshipsWithRuntime, 290 "Microsoft.NETCore.App.Runtime.linux-x64 @ 8.0.14 (/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/Microsoft.NETCore.App.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 291 ) 292 293 var net8AppExpectedDepRelationships []string 294 net8AppExpectedDepRelationships = append(net8AppExpectedDepRelationships, net8AppDepOnlyRelationships...) 295 296 var net8AppExpectedDepSelfContainedPkgs []string 297 net8AppExpectedDepSelfContainedPkgs = append(net8AppExpectedDepSelfContainedPkgs, net8AppExpectedDepPkgs...) 298 net8AppExpectedDepSelfContainedPkgs = append(net8AppExpectedDepSelfContainedPkgs, 299 // add the CLR runtime packages... 300 "runtimepack.Microsoft.NETCore.App.Runtime.win-x64 @ 8.0.14 (/app/dotnetapp.deps.json)", 301 ) 302 303 var net8AppExpectedDepsSelfContainedPkgs []string 304 net8AppExpectedDepsSelfContainedPkgs = append(net8AppExpectedDepsSelfContainedPkgs, net8AppExpectedDepPkgs...) 305 net8AppExpectedDepsSelfContainedPkgs = append(net8AppExpectedDepsSelfContainedPkgs, 306 // add the CLR runtime packages... 307 "runtimepack.Microsoft.NETCore.App.Runtime.win-x64 @ 8.0.14 (/app/dotnetapp.deps.json)", 308 ) 309 310 var net8AppExpectedDepSelfContainedRelationships []string 311 net8AppExpectedDepSelfContainedRelationships = append(net8AppExpectedDepSelfContainedRelationships, net8AppDepOnlyRelationships...) 312 net8AppExpectedDepSelfContainedRelationships = append(net8AppExpectedDepSelfContainedRelationships, 313 // add the CLR runtime relationships... 314 "runtimepack.Microsoft.NETCore.App.Runtime.win-x64 @ 8.0.14 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 315 ) 316 317 var net8AppExpectedBinarySelfContainedPkgs []string 318 net8AppExpectedBinarySelfContainedPkgs = append(net8AppExpectedBinarySelfContainedPkgs, net8AppBinaryOnlyPkgs...) 319 net8AppExpectedBinarySelfContainedPkgs = append(net8AppExpectedBinarySelfContainedPkgs, 320 // include the runtime... 321 ".NET Runtime @ 8,0,1425,11118 (/app/coreclr.dll)", 322 "Microsoft.CSharp @ 8.0.1425.11118 (/app/Microsoft.CSharp.dll)", 323 "Microsoft.VisualBasic @ 8.0.1425.11118 (/app/Microsoft.VisualBasic.dll)", 324 "Microsoft.VisualBasic.Core @ 13.0.1425.11118 (/app/Microsoft.VisualBasic.Core.dll)", 325 "Microsoft.Win32.Primitives @ 8.0.1425.11118 (/app/Microsoft.Win32.Primitives.dll)", 326 "Microsoft.Win32.Registry @ 8.0.1425.11118 (/app/Microsoft.Win32.Registry.dll)", 327 "System @ 8.0.1425.11118 (/app/System.dll)", 328 "System.AppContext @ 8.0.1425.11118 (/app/System.AppContext.dll)", 329 "System.Buffers @ 8.0.1425.11118 (/app/System.Buffers.dll)", 330 "System.Collections @ 8.0.1425.11118 (/app/System.Collections.dll)", 331 "System.Collections.Concurrent @ 8.0.1425.11118 (/app/System.Collections.Concurrent.dll)", 332 "System.Collections.Immutable @ 8.0.1425.11118 (/app/System.Collections.Immutable.dll)", 333 "System.Collections.NonGeneric @ 8.0.1425.11118 (/app/System.Collections.NonGeneric.dll)", 334 "System.Collections.Specialized @ 8.0.1425.11118 (/app/System.Collections.Specialized.dll)", 335 "System.ComponentModel @ 8.0.1425.11118 (/app/System.ComponentModel.dll)", 336 "System.ComponentModel.Annotations @ 8.0.1425.11118 (/app/System.ComponentModel.Annotations.dll)", 337 "System.ComponentModel.DataAnnotations @ 8.0.1425.11118 (/app/System.ComponentModel.DataAnnotations.dll)", 338 "System.ComponentModel.EventBasedAsync @ 8.0.1425.11118 (/app/System.ComponentModel.EventBasedAsync.dll)", 339 "System.ComponentModel.Primitives @ 8.0.1425.11118 (/app/System.ComponentModel.Primitives.dll)", 340 "System.ComponentModel.TypeConverter @ 8.0.1425.11118 (/app/System.ComponentModel.TypeConverter.dll)", 341 "System.Configuration @ 8.0.1425.11118 (/app/System.Configuration.dll)", 342 "System.Console @ 8.0.1425.11118 (/app/System.Console.dll)", 343 "System.Core @ 8.0.1425.11118 (/app/System.Core.dll)", 344 "System.Data @ 8.0.1425.11118 (/app/System.Data.dll)", 345 "System.Data.Common @ 8.0.1425.11118 (/app/System.Data.Common.dll)", 346 "System.Data.DataSetExtensions @ 8.0.1425.11118 (/app/System.Data.DataSetExtensions.dll)", 347 "System.Diagnostics.Contracts @ 8.0.1425.11118 (/app/System.Diagnostics.Contracts.dll)", 348 "System.Diagnostics.Debug @ 8.0.1425.11118 (/app/System.Diagnostics.Debug.dll)", 349 "System.Diagnostics.DiagnosticSource @ 8.0.1425.11118 (/app/System.Diagnostics.DiagnosticSource.dll)", 350 "System.Diagnostics.FileVersionInfo @ 8.0.1425.11118 (/app/System.Diagnostics.FileVersionInfo.dll)", 351 "System.Diagnostics.Process @ 8.0.1425.11118 (/app/System.Diagnostics.Process.dll)", 352 "System.Diagnostics.StackTrace @ 8.0.1425.11118 (/app/System.Diagnostics.StackTrace.dll)", 353 "System.Diagnostics.TextWriterTraceListener @ 8.0.1425.11118 (/app/System.Diagnostics.TextWriterTraceListener.dll)", 354 "System.Diagnostics.Tools @ 8.0.1425.11118 (/app/System.Diagnostics.Tools.dll)", 355 "System.Diagnostics.TraceSource @ 8.0.1425.11118 (/app/System.Diagnostics.TraceSource.dll)", 356 "System.Diagnostics.Tracing @ 8.0.1425.11118 (/app/System.Diagnostics.Tracing.dll)", 357 "System.Drawing @ 8.0.1425.11118 (/app/System.Drawing.dll)", 358 "System.Drawing.Primitives @ 8.0.1425.11118 (/app/System.Drawing.Primitives.dll)", 359 "System.Dynamic.Runtime @ 8.0.1425.11118 (/app/System.Dynamic.Runtime.dll)", 360 "System.Formats.Asn1 @ 8.0.1425.11118 (/app/System.Formats.Asn1.dll)", 361 "System.Formats.Tar @ 8.0.1425.11118 (/app/System.Formats.Tar.dll)", 362 "System.Globalization @ 8.0.1425.11118 (/app/System.Globalization.dll)", 363 "System.Globalization.Calendars @ 8.0.1425.11118 (/app/System.Globalization.Calendars.dll)", 364 "System.Globalization.Extensions @ 8.0.1425.11118 (/app/System.Globalization.Extensions.dll)", 365 "System.IO @ 8.0.1425.11118 (/app/System.IO.dll)", 366 "System.IO.Compression @ 8.0.1425.11118 (/app/System.IO.Compression.dll)", 367 "System.IO.Compression.Brotli @ 8.0.1425.11118 (/app/System.IO.Compression.Brotli.dll)", 368 "System.IO.Compression.FileSystem @ 8.0.1425.11118 (/app/System.IO.Compression.FileSystem.dll)", 369 "System.IO.Compression.ZipFile @ 8.0.1425.11118 (/app/System.IO.Compression.ZipFile.dll)", 370 "System.IO.FileSystem @ 8.0.1425.11118 (/app/System.IO.FileSystem.dll)", 371 "System.IO.FileSystem.AccessControl @ 8.0.1425.11118 (/app/System.IO.FileSystem.AccessControl.dll)", 372 "System.IO.FileSystem.DriveInfo @ 8.0.1425.11118 (/app/System.IO.FileSystem.DriveInfo.dll)", 373 "System.IO.FileSystem.Primitives @ 8.0.1425.11118 (/app/System.IO.FileSystem.Primitives.dll)", 374 "System.IO.FileSystem.Watcher @ 8.0.1425.11118 (/app/System.IO.FileSystem.Watcher.dll)", 375 "System.IO.IsolatedStorage @ 8.0.1425.11118 (/app/System.IO.IsolatedStorage.dll)", 376 "System.IO.MemoryMappedFiles @ 8.0.1425.11118 (/app/System.IO.MemoryMappedFiles.dll)", 377 "System.IO.Pipes @ 8.0.1425.11118 (/app/System.IO.Pipes.dll)", 378 "System.IO.Pipes.AccessControl @ 8.0.1425.11118 (/app/System.IO.Pipes.AccessControl.dll)", 379 "System.IO.UnmanagedMemoryStream @ 8.0.1425.11118 (/app/System.IO.UnmanagedMemoryStream.dll)", 380 "System.Linq @ 8.0.1425.11118 (/app/System.Linq.dll)", 381 "System.Linq.Expressions @ 8.0.1425.11118 (/app/System.Linq.Expressions.dll)", 382 "System.Linq.Parallel @ 8.0.1425.11118 (/app/System.Linq.Parallel.dll)", 383 "System.Linq.Queryable @ 8.0.1425.11118 (/app/System.Linq.Queryable.dll)", 384 "System.Memory @ 8.0.1425.11118 (/app/System.Memory.dll)", 385 "System.Net @ 8.0.1425.11118 (/app/System.Net.dll)", 386 "System.Net.Http @ 8.0.1425.11118 (/app/System.Net.Http.dll)", 387 "System.Net.Http.Json @ 8.0.1425.11118 (/app/System.Net.Http.Json.dll)", 388 "System.Net.HttpListener @ 8.0.1425.11118 (/app/System.Net.HttpListener.dll)", 389 "System.Net.Mail @ 8.0.1425.11118 (/app/System.Net.Mail.dll)", 390 "System.Net.NameResolution @ 8.0.1425.11118 (/app/System.Net.NameResolution.dll)", 391 "System.Net.NetworkInformation @ 8.0.1425.11118 (/app/System.Net.NetworkInformation.dll)", 392 "System.Net.Ping @ 8.0.1425.11118 (/app/System.Net.Ping.dll)", 393 "System.Net.Primitives @ 8.0.1425.11118 (/app/System.Net.Primitives.dll)", 394 "System.Net.Quic @ 8.0.1425.11118 (/app/System.Net.Quic.dll)", 395 "System.Net.Requests @ 8.0.1425.11118 (/app/System.Net.Requests.dll)", 396 "System.Net.Security @ 8.0.1425.11118 (/app/System.Net.Security.dll)", 397 "System.Net.ServicePoint @ 8.0.1425.11118 (/app/System.Net.ServicePoint.dll)", 398 "System.Net.Sockets @ 8.0.1425.11118 (/app/System.Net.Sockets.dll)", 399 "System.Net.WebClient @ 8.0.1425.11118 (/app/System.Net.WebClient.dll)", 400 "System.Net.WebHeaderCollection @ 8.0.1425.11118 (/app/System.Net.WebHeaderCollection.dll)", 401 "System.Net.WebProxy @ 8.0.1425.11118 (/app/System.Net.WebProxy.dll)", 402 "System.Net.WebSockets @ 8.0.1425.11118 (/app/System.Net.WebSockets.dll)", 403 "System.Net.WebSockets.Client @ 8.0.1425.11118 (/app/System.Net.WebSockets.Client.dll)", 404 "System.Numerics @ 8.0.1425.11118 (/app/System.Numerics.dll)", 405 "System.Numerics.Vectors @ 8.0.1425.11118 (/app/System.Numerics.Vectors.dll)", 406 "System.ObjectModel @ 8.0.1425.11118 (/app/System.ObjectModel.dll)", 407 "System.Private.CoreLib @ 8.0.1425.11118 (/app/System.Private.CoreLib.dll)", 408 "System.Private.DataContractSerialization @ 8.0.1425.11118 (/app/System.Private.DataContractSerialization.dll)", 409 "System.Private.Uri @ 8.0.1425.11118 (/app/System.Private.Uri.dll)", 410 "System.Private.Xml @ 8.0.1425.11118 (/app/System.Private.Xml.dll)", 411 "System.Private.Xml.Linq @ 8.0.1425.11118 (/app/System.Private.Xml.Linq.dll)", 412 "System.Reflection @ 8.0.1425.11118 (/app/System.Reflection.dll)", 413 "System.Reflection.DispatchProxy @ 8.0.1425.11118 (/app/System.Reflection.DispatchProxy.dll)", 414 "System.Reflection.Emit @ 8.0.1425.11118 (/app/System.Reflection.Emit.dll)", 415 "System.Reflection.Emit.ILGeneration @ 8.0.1425.11118 (/app/System.Reflection.Emit.ILGeneration.dll)", 416 "System.Reflection.Emit.Lightweight @ 8.0.1425.11118 (/app/System.Reflection.Emit.Lightweight.dll)", 417 "System.Reflection.Extensions @ 8.0.1425.11118 (/app/System.Reflection.Extensions.dll)", 418 "System.Reflection.Metadata @ 8.0.1425.11118 (/app/System.Reflection.Metadata.dll)", 419 "System.Reflection.Primitives @ 8.0.1425.11118 (/app/System.Reflection.Primitives.dll)", 420 "System.Reflection.TypeExtensions @ 8.0.1425.11118 (/app/System.Reflection.TypeExtensions.dll)", 421 "System.Resources.Reader @ 8.0.1425.11118 (/app/System.Resources.Reader.dll)", 422 "System.Resources.ResourceManager @ 8.0.1425.11118 (/app/System.Resources.ResourceManager.dll)", 423 "System.Resources.Writer @ 8.0.1425.11118 (/app/System.Resources.Writer.dll)", 424 "System.Runtime @ 8.0.1425.11118 (/app/System.Runtime.dll)", 425 "System.Runtime.CompilerServices.Unsafe @ 8.0.1425.11118 (/app/System.Runtime.CompilerServices.Unsafe.dll)", 426 "System.Runtime.CompilerServices.VisualC @ 8.0.1425.11118 (/app/System.Runtime.CompilerServices.VisualC.dll)", 427 "System.Runtime.Extensions @ 8.0.1425.11118 (/app/System.Runtime.Extensions.dll)", 428 "System.Runtime.Handles @ 8.0.1425.11118 (/app/System.Runtime.Handles.dll)", 429 "System.Runtime.InteropServices @ 8.0.1425.11118 (/app/System.Runtime.InteropServices.dll)", 430 "System.Runtime.InteropServices.JavaScript @ 8.0.1425.11118 (/app/System.Runtime.InteropServices.JavaScript.dll)", 431 "System.Runtime.InteropServices.RuntimeInformation @ 8.0.1425.11118 (/app/System.Runtime.InteropServices.RuntimeInformation.dll)", 432 "System.Runtime.Intrinsics @ 8.0.1425.11118 (/app/System.Runtime.Intrinsics.dll)", 433 "System.Runtime.Loader @ 8.0.1425.11118 (/app/System.Runtime.Loader.dll)", 434 "System.Runtime.Numerics @ 8.0.1425.11118 (/app/System.Runtime.Numerics.dll)", 435 "System.Runtime.Serialization @ 8.0.1425.11118 (/app/System.Runtime.Serialization.dll)", 436 "System.Runtime.Serialization.Formatters @ 8.0.1425.11118 (/app/System.Runtime.Serialization.Formatters.dll)", 437 "System.Runtime.Serialization.Json @ 8.0.1425.11118 (/app/System.Runtime.Serialization.Json.dll)", 438 "System.Runtime.Serialization.Primitives @ 8.0.1425.11118 (/app/System.Runtime.Serialization.Primitives.dll)", 439 "System.Runtime.Serialization.Xml @ 8.0.1425.11118 (/app/System.Runtime.Serialization.Xml.dll)", 440 "System.Security @ 8.0.1425.11118 (/app/System.Security.dll)", 441 "System.Security.AccessControl @ 8.0.1425.11118 (/app/System.Security.AccessControl.dll)", 442 "System.Security.Claims @ 8.0.1425.11118 (/app/System.Security.Claims.dll)", 443 "System.Security.Cryptography @ 8.0.1425.11118 (/app/System.Security.Cryptography.dll)", 444 "System.Security.Cryptography.Algorithms @ 8.0.1425.11118 (/app/System.Security.Cryptography.Algorithms.dll)", 445 "System.Security.Cryptography.Cng @ 8.0.1425.11118 (/app/System.Security.Cryptography.Cng.dll)", 446 "System.Security.Cryptography.Csp @ 8.0.1425.11118 (/app/System.Security.Cryptography.Csp.dll)", 447 "System.Security.Cryptography.Encoding @ 8.0.1425.11118 (/app/System.Security.Cryptography.Encoding.dll)", 448 "System.Security.Cryptography.OpenSsl @ 8.0.1425.11118 (/app/System.Security.Cryptography.OpenSsl.dll)", 449 "System.Security.Cryptography.Primitives @ 8.0.1425.11118 (/app/System.Security.Cryptography.Primitives.dll)", 450 "System.Security.Cryptography.X509Certificates @ 8.0.1425.11118 (/app/System.Security.Cryptography.X509Certificates.dll)", 451 "System.Security.Principal @ 8.0.1425.11118 (/app/System.Security.Principal.dll)", 452 "System.Security.Principal.Windows @ 8.0.1425.11118 (/app/System.Security.Principal.Windows.dll)", 453 "System.Security.SecureString @ 8.0.1425.11118 (/app/System.Security.SecureString.dll)", 454 "System.ServiceModel.Web @ 8.0.1425.11118 (/app/System.ServiceModel.Web.dll)", 455 "System.ServiceProcess @ 8.0.1425.11118 (/app/System.ServiceProcess.dll)", 456 "System.Text.Encoding @ 8.0.1425.11118 (/app/System.Text.Encoding.dll)", 457 "System.Text.Encoding.CodePages @ 8.0.1425.11118 (/app/System.Text.Encoding.CodePages.dll)", 458 "System.Text.Encoding.Extensions @ 8.0.1425.11118 (/app/System.Text.Encoding.Extensions.dll)", 459 "System.Text.Encodings.Web @ 8.0.1425.11118 (/app/System.Text.Encodings.Web.dll)", 460 "System.Text.Json @ 8.0.1425.11118 (/app/System.Text.Json.dll)", 461 "System.Text.RegularExpressions @ 8.0.1425.11118 (/app/System.Text.RegularExpressions.dll)", 462 "System.Threading @ 8.0.1425.11118 (/app/System.Threading.dll)", 463 "System.Threading.Channels @ 8.0.1425.11118 (/app/System.Threading.Channels.dll)", 464 "System.Threading.Overlapped @ 8.0.1425.11118 (/app/System.Threading.Overlapped.dll)", 465 "System.Threading.Tasks @ 8.0.1425.11118 (/app/System.Threading.Tasks.dll)", 466 "System.Threading.Tasks.Dataflow @ 8.0.1425.11118 (/app/System.Threading.Tasks.Dataflow.dll)", 467 "System.Threading.Tasks.Extensions @ 8.0.1425.11118 (/app/System.Threading.Tasks.Extensions.dll)", 468 "System.Threading.Tasks.Parallel @ 8.0.1425.11118 (/app/System.Threading.Tasks.Parallel.dll)", 469 "System.Threading.Thread @ 8.0.1425.11118 (/app/System.Threading.Thread.dll)", 470 "System.Threading.ThreadPool @ 8.0.1425.11118 (/app/System.Threading.ThreadPool.dll)", 471 "System.Threading.Timer @ 8.0.1425.11118 (/app/System.Threading.Timer.dll)", 472 "System.Transactions @ 8.0.1425.11118 (/app/System.Transactions.dll)", 473 "System.Transactions.Local @ 8.0.1425.11118 (/app/System.Transactions.Local.dll)", 474 "System.ValueTuple @ 8.0.1425.11118 (/app/System.ValueTuple.dll)", 475 "System.Web @ 8.0.1425.11118 (/app/System.Web.dll)", 476 "System.Web.HttpUtility @ 8.0.1425.11118 (/app/System.Web.HttpUtility.dll)", 477 "System.Windows @ 8.0.1425.11118 (/app/System.Windows.dll)", 478 "System.Xml @ 8.0.1425.11118 (/app/System.Xml.dll)", 479 "System.Xml.Linq @ 8.0.1425.11118 (/app/System.Xml.Linq.dll)", 480 "System.Xml.ReaderWriter @ 8.0.1425.11118 (/app/System.Xml.ReaderWriter.dll)", 481 "System.Xml.Serialization @ 8.0.1425.11118 (/app/System.Xml.Serialization.dll)", 482 "System.Xml.XDocument @ 8.0.1425.11118 (/app/System.Xml.XDocument.dll)", 483 "System.Xml.XPath @ 8.0.1425.11118 (/app/System.Xml.XPath.dll)", 484 "System.Xml.XPath.XDocument @ 8.0.1425.11118 (/app/System.Xml.XPath.XDocument.dll)", 485 "System.Xml.XmlDocument @ 8.0.1425.11118 (/app/System.Xml.XmlDocument.dll)", 486 "System.Xml.XmlSerializer @ 8.0.1425.11118 (/app/System.Xml.XmlSerializer.dll)", 487 "WindowsBase @ 8.0.1425.11118 (/app/WindowsBase.dll)", 488 "mscorlib @ 8.0.1425.11118 (/app/mscorlib.dll)", 489 "netstandard @ 8.0.1425.11118 (/app/netstandard.dll)", 490 ) 491 492 assertAllDepEntriesWithoutExecutables := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 493 t.Helper() 494 for _, p := range pkgs { 495 // assert that all packages DO NOT have an executable associated with it 496 m, ok := p.Metadata.(pkg.DotnetDepsEntry) 497 if !ok { 498 t.Fatalf("expected metadata to be of type DotnetDepsEntry") 499 } 500 if len(m.Executables) != 0 { 501 t.Errorf("expected no executables for package %s, found %d", p.Name, len(m.Executables)) 502 } 503 } 504 505 actual := extractMatchingPackage(t, "Newtonsoft.Json", pkgs) 506 expected := pkg.Package{ 507 Name: "Newtonsoft.Json", 508 Version: "13.0.3", 509 Locations: file.NewLocationSet(file.NewLocation("/app/dotnetapp.deps.json")), 510 Language: pkg.Dotnet, 511 Type: pkg.DotnetPkg, 512 PURL: "pkg:nuget/Newtonsoft.Json@13.0.3", 513 Metadata: pkg.DotnetDepsEntry{ 514 Name: "Newtonsoft.Json", 515 Version: "13.0.3", 516 Path: "newtonsoft.json/13.0.3", 517 Sha512: "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", 518 HashPath: "newtonsoft.json.13.0.3.nupkg.sha512", 519 Executables: nil, // important! 520 }, 521 } 522 523 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 524 } 525 526 assertAllDepEntriesWithExecutables := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 527 t.Helper() 528 for _, p := range pkgs { 529 // assert that all packages have an executable associated with it 530 m, ok := p.Metadata.(pkg.DotnetDepsEntry) 531 if !ok { 532 t.Fatalf("expected metadata to be of type DotnetDepsEntry") 533 } 534 if len(m.Executables) != 1 { 535 t.Errorf("expected exactly one executable for package %s, found %d", p.Name, len(m.Executables)) 536 } 537 } 538 } 539 540 assertAlmostAllDepEntriesWithExecutables := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 541 t.Helper() 542 for _, p := range pkgs { 543 // assert that all packages have an executable associated with it 544 m, ok := p.Metadata.(pkg.DotnetDepsEntry) 545 if !ok { 546 t.Fatalf("expected metadata to be of type DotnetDepsEntry") 547 } 548 if len(m.Executables) != 1 { 549 if m.Name == "Humanizer" { 550 // there is only one "virtual" package that doesn't have an actual DLL associated 551 assert.Empty(t, m.Executables) 552 continue 553 } 554 t.Errorf("expected exactly one executable for package %s, found %d", p.Name, len(m.Executables)) 555 } 556 } 557 558 actual := extractMatchingPackage(t, "dotnetapp", pkgs) 559 560 expected := pkg.Package{ 561 Name: "dotnetapp", 562 Version: "1.0.0", 563 FoundBy: "", 564 Locations: file.NewLocationSet( 565 file.NewLocation("/app/dotnetapp.deps.json"), 566 file.NewLocation("/app/dotnetapp.dll"), 567 ), 568 Language: pkg.Dotnet, 569 Type: pkg.DotnetPkg, 570 PURL: "pkg:nuget/dotnetapp@1.0.0", 571 Metadata: pkg.DotnetDepsEntry{ 572 Name: "dotnetapp", 573 Version: "1.0.0", 574 // note: the main package does not have a hash/path/etc 575 Executables: map[string]pkg.DotnetPortableExecutableEntry{ 576 "dotnetapp.dll": { 577 AssemblyVersion: "1.0.0.0", 578 InternalName: "dotnetapp.dll", 579 CompanyName: "dotnetapp", 580 ProductName: "dotnetapp", 581 ProductVersion: "1.0.0", 582 }, 583 }, 584 }, 585 } 586 587 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 588 } 589 590 assertAllBinaryEntries := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 591 t.Helper() 592 for _, p := range pkgs { 593 if p.Name == "Microsoft.NETCore.App" { 594 // for the runtime app we created ourselves there is no metadata for 595 continue 596 } 597 // assert that all packages have an executable associated with it 598 m, ok := p.Metadata.(pkg.DotnetPortableExecutableEntry) 599 if !ok { 600 t.Fatalf("expected metadata to be of type DotnetPortableExecutableEntry") 601 } 602 603 assert.NotNil(t, m, "expected metadata to be a non-nil DotnetPortableExecutableEntry") 604 } 605 606 actual := extractMatchingPackage(t, "dotnetapp", pkgs) 607 608 expected := pkg.Package{ 609 Name: "dotnetapp", 610 Version: "1.0.0.0", // important: in the dep.json this is 1.0.0, now the assembly version is used 611 FoundBy: "", 612 Locations: file.NewLocationSet( 613 // important: we only have the dll as evidence 614 file.NewLocation("/app/dotnetapp.dll"), 615 ), 616 Language: pkg.Dotnet, 617 Type: pkg.DotnetPkg, 618 PURL: "pkg:nuget/dotnetapp@1.0.0.0", // important: in the dep.json this is 1.0.0, now the assembly version is used 619 Metadata: pkg.DotnetPortableExecutableEntry{ 620 AssemblyVersion: "1.0.0.0", 621 InternalName: "dotnetapp.dll", 622 CompanyName: "dotnetapp", 623 ProductName: "dotnetapp", 624 ProductVersion: "1.0.0", 625 }, 626 } 627 628 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 629 630 actual = extractMatchingPackage(t, "Json.NET", pkgs) 631 632 expected = pkg.Package{ 633 Name: "Json.NET", // TODO: could we have done this better? We expected Newtonsoft.Json 634 Version: "13.0.3.27908", // TODO: should we use the product version here? 635 Locations: file.NewLocationSet(file.NewLocation("/app/Newtonsoft.Json.dll")), 636 Language: pkg.Dotnet, 637 Type: pkg.DotnetPkg, 638 PURL: "pkg:nuget/Json.NET@13.0.3.27908", // TODO: should we use the product version here? 639 Metadata: pkg.DotnetPortableExecutableEntry{ 640 AssemblyVersion: "13.0.0.0", 641 LegalCopyright: "Copyright © James Newton-King 2008", 642 Comments: "Json.NET is a popular high-performance JSON framework for .NET", 643 InternalName: "Newtonsoft.Json.dll", 644 CompanyName: "Newtonsoft", 645 ProductName: "Json.NET", 646 ProductVersion: "13.0.3+0a2e291c0d9c0c7675d445703e51750363a549ef", 647 }, 648 } 649 650 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 651 652 } 653 654 assertSingleFileDeployment := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 655 t.Helper() 656 for _, p := range pkgs { 657 // assert that all packages have an executable associated with it 658 m, ok := p.Metadata.(pkg.DotnetPortableExecutableEntry) 659 if !ok { 660 t.Fatalf("expected metadata to be of type DotnetPortableExecutableEntry") 661 } 662 663 assert.NotNil(t, m, "expected metadata to be a non-nil DotnetPortableExecutableEntry") 664 } 665 666 actual := extractMatchingPackage(t, "dotnetapp", pkgs) 667 668 expected := pkg.Package{ 669 Name: "dotnetapp", 670 Version: "1.0.0.0", // important: in the dep.json this is 1.0.0, now the assembly version is used 671 FoundBy: "", 672 Locations: file.NewLocationSet( 673 // important: we only have the exe as evidence 674 file.NewLocation("/app/dotnetapp.exe"), 675 ), 676 Language: pkg.Dotnet, 677 Type: pkg.DotnetPkg, 678 PURL: "pkg:nuget/dotnetapp@1.0.0.0", // important: in the dep.json this is 1.0.0, now the assembly version is used 679 Metadata: pkg.DotnetPortableExecutableEntry{ 680 AssemblyVersion: "1.0.0.0", 681 InternalName: "dotnetapp.dll", 682 CompanyName: "dotnetapp", 683 ProductName: "dotnetapp", 684 ProductVersion: "1.0.0", 685 }, 686 } 687 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 688 } 689 690 assertAccurateNetRuntimePackage := func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 691 // the package with the CPE is the runtime package 692 for _, p := range pkgs { 693 if len(p.CPEs) == 0 { 694 continue 695 } 696 assert.Contains(t, p.Name, "Microsoft.NETCore.App") 697 return 698 } 699 t.Error("expected at least one runtime package with a CPE") 700 } 701 702 cases := []struct { 703 name string 704 fixture string 705 expectedPkgs []string 706 expectedRels []string 707 assertion func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) 708 cataloger pkg.Cataloger 709 }{ 710 { 711 name: "deps cataloger", 712 fixture: "image-net8-app", 713 cataloger: NewDotnetDepsCataloger(), 714 expectedPkgs: net8AppExpectedDepPkgs, 715 expectedRels: net8AppExpectedDepRelationships, 716 assertion: assertAllDepEntriesWithoutExecutables, 717 }, 718 { 719 name: "combined cataloger", 720 fixture: "image-net8-app", 721 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 722 expectedPkgs: net8AppExpectedDepPkgs, 723 expectedRels: net8AppDepOnlyRelationships, 724 assertion: assertAlmostAllDepEntriesWithExecutables, // important! this is what makes this case different from the previous one... dep entries have attached executables 725 }, 726 { 727 name: "combined cataloger (with runtime)", 728 fixture: "image-net8-app-with-runtime", 729 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 730 expectedPkgs: net8AppExpectedDepPkgsWithRuntime, 731 expectedRels: net8AppDepOnlyRelationshipsWithRuntime, 732 assertion: assertAccurateNetRuntimePackage, 733 }, 734 { 735 name: "combined cataloger (with runtime, no deps.json anywhere)", 736 fixture: "image-net8-app-with-runtime-nodepsjson", 737 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 738 expectedPkgs: func() []string { 739 // all the same packages we found in "image-net8-app-with-runtime", however we create a runtime package out of all of the DLLs we found instead 740 x := net8AppBinaryOnlyPkgs 741 x = append(x, "Microsoft.NETCore.App @ 8.0.14 (/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.14/Microsoft.CSharp.dll)") 742 return x 743 }(), 744 // important: no relationships should be found 745 assertion: func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 746 assertAllBinaryEntries(t, pkgs, relationships) 747 assertAccurateNetRuntimePackage(t, pkgs, relationships) 748 }, 749 }, 750 { 751 name: "combined cataloger (require dll pairings)", 752 fixture: "image-net8-app", 753 cataloger: NewDotnetDepsBinaryCataloger(CatalogerConfig{DepPackagesMustHaveDLL: true}), 754 expectedPkgs: net8AppExpectedDepPkgsWithoutUnpairedDlls, 755 expectedRels: []string{ 756 // the odd thing (but expected) is that the Humanizer.Core entries have a dependency to each Humanizer.Core.* locale entry 757 // because we're skipping over the "virtual" Humanizer package which does not have any associated DLLs with it. 758 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.af @ 2.14.1 (/app/dotnetapp.deps.json)", 759 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ar @ 2.14.1 (/app/dotnetapp.deps.json)", 760 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.az @ 2.14.1 (/app/dotnetapp.deps.json)", 761 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.bg @ 2.14.1 (/app/dotnetapp.deps.json)", 762 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.bn-BD @ 2.14.1 (/app/dotnetapp.deps.json)", 763 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.cs @ 2.14.1 (/app/dotnetapp.deps.json)", 764 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.da @ 2.14.1 (/app/dotnetapp.deps.json)", 765 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.de @ 2.14.1 (/app/dotnetapp.deps.json)", 766 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.el @ 2.14.1 (/app/dotnetapp.deps.json)", 767 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.es @ 2.14.1 (/app/dotnetapp.deps.json)", 768 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fa @ 2.14.1 (/app/dotnetapp.deps.json)", 769 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fi-FI @ 2.14.1 (/app/dotnetapp.deps.json)", 770 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fr @ 2.14.1 (/app/dotnetapp.deps.json)", 771 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.fr-BE @ 2.14.1 (/app/dotnetapp.deps.json)", 772 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.he @ 2.14.1 (/app/dotnetapp.deps.json)", 773 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hr @ 2.14.1 (/app/dotnetapp.deps.json)", 774 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hu @ 2.14.1 (/app/dotnetapp.deps.json)", 775 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.hy @ 2.14.1 (/app/dotnetapp.deps.json)", 776 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.id @ 2.14.1 (/app/dotnetapp.deps.json)", 777 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.is @ 2.14.1 (/app/dotnetapp.deps.json)", 778 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.it @ 2.14.1 (/app/dotnetapp.deps.json)", 779 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ja @ 2.14.1 (/app/dotnetapp.deps.json)", 780 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ko-KR @ 2.14.1 (/app/dotnetapp.deps.json)", 781 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ku @ 2.14.1 (/app/dotnetapp.deps.json)", 782 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.lv @ 2.14.1 (/app/dotnetapp.deps.json)", 783 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ms-MY @ 2.14.1 (/app/dotnetapp.deps.json)", 784 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.mt @ 2.14.1 (/app/dotnetapp.deps.json)", 785 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nb @ 2.14.1 (/app/dotnetapp.deps.json)", 786 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nb-NO @ 2.14.1 (/app/dotnetapp.deps.json)", 787 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.nl @ 2.14.1 (/app/dotnetapp.deps.json)", 788 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.pl @ 2.14.1 (/app/dotnetapp.deps.json)", 789 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.pt @ 2.14.1 (/app/dotnetapp.deps.json)", 790 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ro @ 2.14.1 (/app/dotnetapp.deps.json)", 791 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.ru @ 2.14.1 (/app/dotnetapp.deps.json)", 792 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sk @ 2.14.1 (/app/dotnetapp.deps.json)", 793 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sl @ 2.14.1 (/app/dotnetapp.deps.json)", 794 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sr @ 2.14.1 (/app/dotnetapp.deps.json)", 795 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sr-Latn @ 2.14.1 (/app/dotnetapp.deps.json)", 796 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.sv @ 2.14.1 (/app/dotnetapp.deps.json)", 797 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.th-TH @ 2.14.1 (/app/dotnetapp.deps.json)", 798 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.tr @ 2.14.1 (/app/dotnetapp.deps.json)", 799 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uk @ 2.14.1 (/app/dotnetapp.deps.json)", 800 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uz-Cyrl-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 801 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.uz-Latn-UZ @ 2.14.1 (/app/dotnetapp.deps.json)", 802 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.vi @ 2.14.1 (/app/dotnetapp.deps.json)", 803 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-CN @ 2.14.1 (/app/dotnetapp.deps.json)", 804 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-Hans @ 2.14.1 (/app/dotnetapp.deps.json)", 805 "Humanizer.Core @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] Humanizer.Core.zh-Hant @ 2.14.1 (/app/dotnetapp.deps.json)", 806 "Humanizer.Core.af @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 807 "Humanizer.Core.ar @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 808 "Humanizer.Core.az @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 809 "Humanizer.Core.bg @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 810 "Humanizer.Core.bn-BD @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 811 "Humanizer.Core.cs @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 812 "Humanizer.Core.da @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 813 "Humanizer.Core.de @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 814 "Humanizer.Core.el @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 815 "Humanizer.Core.es @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 816 "Humanizer.Core.fa @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 817 "Humanizer.Core.fi-FI @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 818 "Humanizer.Core.fr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 819 "Humanizer.Core.fr-BE @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 820 "Humanizer.Core.he @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 821 "Humanizer.Core.hr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 822 "Humanizer.Core.hu @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 823 "Humanizer.Core.hy @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 824 "Humanizer.Core.id @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 825 "Humanizer.Core.is @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 826 "Humanizer.Core.it @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 827 "Humanizer.Core.ja @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 828 "Humanizer.Core.ko-KR @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 829 "Humanizer.Core.ku @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 830 "Humanizer.Core.lv @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 831 "Humanizer.Core.ms-MY @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 832 "Humanizer.Core.mt @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 833 "Humanizer.Core.nb @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 834 "Humanizer.Core.nb-NO @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 835 "Humanizer.Core.nl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 836 "Humanizer.Core.pl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 837 "Humanizer.Core.pt @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 838 "Humanizer.Core.ro @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 839 "Humanizer.Core.ru @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 840 "Humanizer.Core.sk @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 841 "Humanizer.Core.sl @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 842 "Humanizer.Core.sr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 843 "Humanizer.Core.sr-Latn @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 844 "Humanizer.Core.sv @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 845 "Humanizer.Core.th-TH @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 846 "Humanizer.Core.tr @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 847 "Humanizer.Core.uk @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 848 "Humanizer.Core.uz-Cyrl-UZ @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 849 "Humanizer.Core.uz-Latn-UZ @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 850 "Humanizer.Core.vi @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 851 "Humanizer.Core.zh-CN @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 852 "Humanizer.Core.zh-Hans @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 853 "Humanizer.Core.zh-Hant @ 2.14.1 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 854 "Newtonsoft.Json @ 13.0.3 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 855 }, 856 assertion: assertAllDepEntriesWithExecutables, // important! we want the Humanizer package without a DLL to be ignored 857 }, 858 { 859 name: "PE cataloger", 860 fixture: "image-net8-app", 861 cataloger: NewDotnetPortableExecutableCataloger(), 862 expectedPkgs: net8AppBinaryOnlyPkgs, 863 // important: no relationships should be found 864 assertion: assertAllBinaryEntries, 865 }, 866 { 867 name: "deps cataloger (no deps.json)", 868 fixture: "image-net8-app-no-depjson", 869 cataloger: NewDotnetDepsCataloger(), 870 // there should be no packages found! 871 }, 872 { 873 name: "combined cataloger (no deps.json)", 874 fixture: "image-net8-app-no-depjson", 875 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 876 expectedPkgs: net8AppBinaryOnlyPkgs, 877 // important: no relationships should be found 878 assertion: assertAllBinaryEntries, 879 }, 880 { 881 name: "pe cataloger (no deps.json)", 882 fixture: "image-net8-app-no-depjson", 883 cataloger: NewDotnetPortableExecutableCataloger(), 884 expectedPkgs: net8AppBinaryOnlyPkgs, 885 // important: no relationships should be found 886 assertion: assertAllBinaryEntries, 887 }, 888 { 889 name: "deps cataloger (single file)", 890 fixture: "image-net8-app-single-file", 891 cataloger: NewDotnetDepsCataloger(), 892 // there should be no packages found! 893 }, 894 { 895 name: "combined cataloger (single file)", 896 fixture: "image-net8-app-single-file", 897 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 898 899 // important: no relationships should be found 900 expectedPkgs: []string{ 901 "dotnetapp @ 1.0.0.0 (/app/dotnetapp.exe)", 902 }, 903 assertion: assertSingleFileDeployment, 904 }, 905 { 906 name: "pe cataloger (single file)", 907 fixture: "image-net8-app-single-file", 908 cataloger: NewDotnetPortableExecutableCataloger(), 909 // important: no relationships should be found 910 expectedPkgs: []string{ 911 "dotnetapp @ 1.0.0.0 (/app/dotnetapp.exe)", 912 }, 913 assertion: assertSingleFileDeployment, 914 }, 915 { 916 name: "deps cataloger (self-contained)", 917 fixture: "image-net8-app-self-contained", 918 cataloger: NewDotnetDepsCataloger(), 919 expectedPkgs: net8AppExpectedDepsSelfContainedPkgs, 920 expectedRels: net8AppExpectedDepSelfContainedRelationships, 921 }, 922 { 923 name: "combined cataloger (self-contained)", 924 fixture: "image-net8-app-self-contained", 925 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 926 // we care about DLL claims in the deps.json, so the main application inherits all relationships to/from humarizer 927 expectedPkgs: net8AppExpectedDepSelfContainedPkgs, 928 expectedRels: net8AppExpectedDepSelfContainedRelationships, 929 assertion: assertAccurateNetRuntimePackage, 930 }, 931 { 932 name: "pe cataloger (self-contained)", 933 fixture: "image-net8-app-self-contained", 934 cataloger: NewDotnetPortableExecutableCataloger(), 935 // important: no relationships should be found 936 expectedPkgs: net8AppExpectedBinarySelfContainedPkgs, 937 }, 938 { 939 name: "combined cataloger (private assets + require dlls)", 940 fixture: "image-net8-privateassets", 941 cataloger: NewDotnetDepsBinaryCataloger(CatalogerConfig{DepPackagesMustHaveDLL: true}), 942 expectedPkgs: []string{ 943 "dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 944 }, 945 }, 946 { 947 name: "combined cataloger (private assets)", 948 fixture: "image-net8-privateassets", 949 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 950 expectedPkgs: []string{ 951 "dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 952 }, 953 }, 954 { 955 name: "combined cataloger (ilrepack + require dlls)", 956 fixture: "image-net8-ilrepack", 957 cataloger: NewDotnetDepsBinaryCataloger(CatalogerConfig{DepPackagesMustHaveDLL: true}), 958 expectedPkgs: []string{ 959 "dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 960 }, 961 }, 962 { 963 // TODO: this is to help us out in the future... we can use TypeDef info from the Metadata table to determine 964 // if package names are any "namespace" values of the assembly. Today we don't do this so we relax claims 965 // when bundling is detected instead of attempting to check for namespace values in TypeDef entries 966 // and correlate against deps.json entries (which is not a sure thing!). 967 name: "combined cataloger (ilrepack)", 968 fixture: "image-net8-ilrepack", 969 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 970 expectedPkgs: func() []string { 971 x := net8AppExpectedDepPkgs 972 x = append(x, 973 "ILRepack @ 2.0.33 (/app/dotnetapp.deps.json)", 974 "ILRepack.FullAuto @ 1.6.0 (/app/dotnetapp.deps.json)", 975 ) 976 return x 977 }(), 978 expectedRels: func() []string { 979 x := net8AppExpectedDepRelationships 980 x = append(x, 981 "ILRepack @ 2.0.33 (/app/dotnetapp.deps.json) [dependency-of] ILRepack.FullAuto @ 1.6.0 (/app/dotnetapp.deps.json)", 982 "ILRepack.FullAuto @ 1.6.0 (/app/dotnetapp.deps.json) [dependency-of] dotnetapp @ 1.0.0 (/app/dotnetapp.deps.json)", 983 ) 984 return x 985 }(), 986 }, 987 { 988 name: "net2 app, combined cataloger (private assets)", 989 fixture: "image-net2-app", 990 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 991 expectedPkgs: []string{ 992 "Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 993 "Microsoft.NETCore.DotNetHostPolicy @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 994 "Serilog @ 2.10.0 (/app/helloworld.deps.json)", 995 "Serilog.Sinks.Console @ 4.0.1 (/app/helloworld.deps.json)", 996 "helloworld @ 1.0.0 (/app/helloworld.deps.json)", 997 "runtime.linux-x64.Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 998 "runtime.linux-x64.Microsoft.NETCore.DotNetHostPolicy @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", // a compile target reference 999 }, 1000 expectedRels: []string{ 1001 "Microsoft.NETCore.DotNetHostPolicy @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json) [dependency-of] Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 1002 "Serilog @ 2.10.0 (/app/helloworld.deps.json) [dependency-of] Serilog.Sinks.Console @ 4.0.1 (/app/helloworld.deps.json)", 1003 "Serilog @ 2.10.0 (/app/helloworld.deps.json) [dependency-of] helloworld @ 1.0.0 (/app/helloworld.deps.json)", 1004 "Serilog.Sinks.Console @ 4.0.1 (/app/helloworld.deps.json) [dependency-of] helloworld @ 1.0.0 (/app/helloworld.deps.json)", 1005 "runtime.linux-x64.Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json) [dependency-of] Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 1006 "runtime.linux-x64.Microsoft.NETCore.App @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json) [dependency-of] helloworld @ 1.0.0 (/app/helloworld.deps.json)", 1007 "runtime.linux-x64.Microsoft.NETCore.DotNetHostPolicy @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json) [dependency-of] Microsoft.NETCore.DotNetHostPolicy @ 2.2.8 (/usr/share/dotnet/shared/Microsoft.NETCore.App/2.2.8/Microsoft.NETCore.App.deps.json)", 1008 }, 1009 assertion: assertAccurateNetRuntimePackage, 1010 }, 1011 { 1012 name: "libman support", 1013 fixture: "image-net6-asp-libman", 1014 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 1015 expectedPkgs: []string{ 1016 "LibManSample @ 1.0.0 (/app/LibManSample.deps.json)", 1017 "jquery @ 3.3.1 (/app/libman.json)", 1018 }, 1019 expectedRels: []string{ 1020 "jquery @ 3.3.1 (/app/libman.json) [dependency-of] LibManSample @ 1.0.0 (/app/LibManSample.deps.json)", 1021 }, 1022 }, 1023 } 1024 1025 for _, tt := range cases { 1026 t.Run(tt.name, func(t *testing.T) { 1027 if tt.assertion == nil { 1028 tt.assertion = func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) {} 1029 } 1030 pkgtest.NewCatalogTester(). 1031 WithImageResolver(t, tt.fixture). 1032 IgnoreLocationLayer(). // this fixture can be rebuilt, thus the layer ID will change 1033 ExpectsPackageStrings(tt.expectedPkgs). 1034 ExpectsRelationshipStrings(tt.expectedRels). 1035 ExpectsAssertion(tt.assertion). 1036 TestCataloger(t, tt.cataloger) 1037 }) 1038 } 1039 } 1040 1041 func TestDotnetDepsCataloger_regressions(t *testing.T) { 1042 1043 assertPackages := func(mustHave []string, mustNotHave []string) func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 1044 expected := strset.New(mustHave...) 1045 notExpected := strset.New(mustNotHave...) 1046 return func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 1047 1048 for _, p := range pkgs { 1049 expected.Remove(p.Name) 1050 if notExpected.Has(p.Name) { 1051 t.Errorf("unexpected package: %s", p.Name) 1052 } 1053 } 1054 if expected.IsEmpty() { 1055 return 1056 } 1057 t.Errorf("missing packages: %s", expected.List()) 1058 } 1059 } 1060 1061 cases := []struct { 1062 name string 1063 fixture string 1064 assertion func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) 1065 cataloger pkg.Cataloger 1066 }{ 1067 { 1068 // during development, these version resources tended to be corrupted 1069 name: "Newtonsoft dll details", 1070 fixture: "image-net8-app-no-depjson", 1071 cataloger: NewDotnetPortableExecutableCataloger(), 1072 assertion: func(t *testing.T, pkgs []pkg.Package, relationships []artifact.Relationship) { 1073 // TODO: name should be "Newtonsoft.Json" (bad metadata in the artifact) 1074 actual := extractMatchingPackage(t, "Json.NET", pkgs) 1075 1076 expected := pkg.Package{ 1077 Name: "Json.NET", 1078 Version: "13.0.3.27908", // TODO should we parse the product version to get 13.0.3? 1079 Locations: file.NewLocationSet(file.NewLocation("/app/Newtonsoft.Json.dll")), 1080 Language: pkg.Dotnet, 1081 Type: pkg.DotnetPkg, 1082 PURL: "pkg:nuget/Json.NET@13.0.3.27908", 1083 Metadata: pkg.DotnetPortableExecutableEntry{ 1084 AssemblyVersion: "13.0.0.0", 1085 LegalCopyright: "Copyright © James Newton-King 2008", 1086 Comments: "Json.NET is a popular high-performance JSON framework for .NET", 1087 InternalName: "Newtonsoft.Json.dll", 1088 CompanyName: "Newtonsoft", 1089 ProductName: "Json.NET", 1090 ProductVersion: "13.0.3+0a2e291c0d9c0c7675d445703e51750363a549ef", 1091 }, 1092 } 1093 1094 pkgtest.AssertPackagesEqualIgnoreLayers(t, expected, actual) 1095 }, 1096 }, 1097 { 1098 name: "indirect packages references", 1099 fixture: "image-net8-compile-target", 1100 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 1101 assertion: assertPackages( 1102 []string{ 1103 "DotNetNuke.Core", // uses a compile target reference in the deps.json 1104 "Umbraco.Cms", // this is the parent of other packages which do have DLLs included (even though it does not have any DLLs) 1105 }, 1106 []string{ 1107 "StyleCop.Analyzers", // this is a development tool 1108 "Microsoft.NET.Test.Sdk", // this is a development tool 1109 "jQuery", // has no DLLs but has javascript assets 1110 }, 1111 ), 1112 }, 1113 { 1114 name: "not propagating claims", 1115 fixture: "image-net8-compile-target", 1116 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig().WithPropagateDLLClaimsToParents(false)), 1117 assertion: assertPackages( 1118 []string{ 1119 "DotNetNuke.Core", // uses a compile target reference in the deps.json 1120 1121 }, 1122 []string{ 1123 "Umbraco.Cms", // this is the parent of other packages which do have DLLs included (even though it does not have any DLLs) 1124 "StyleCop.Analyzers", // this is a development tool 1125 "Microsoft.NET.Test.Sdk", // this is a development tool under the debug configuration (we build the release configuration) 1126 "jQuery", // has no DLLs but has javascript assets -- this is bad behavior (as we want to detect this) 1127 }, 1128 ), 1129 }, 1130 { 1131 name: "not requiring claims finds jquery", 1132 fixture: "image-net8-compile-target", 1133 cataloger: NewDotnetDepsBinaryCataloger(CatalogerConfig{ 1134 DepPackagesMustHaveDLL: false, 1135 DepPackagesMustClaimDLL: false, 1136 PropagateDLLClaimsToParents: false, 1137 RelaxDLLClaimsWhenBundlingDetected: false, 1138 }), 1139 assertion: assertPackages( 1140 []string{ 1141 "jQuery", // has no DLLs but has javascript assets 1142 "StyleCop.Analyzers", // this is a development tool -- this is bad behavior (since we should not detect this), but cannot be helped 1143 }, 1144 []string{ 1145 "Microsoft.NET.Test.Sdk", // this is a development tool under the debug configuration (we build the release configuration) 1146 }, 1147 ), 1148 }, 1149 { 1150 name: "libman support", 1151 fixture: "image-net6-asp-libman", 1152 cataloger: NewDotnetDepsBinaryCataloger(DefaultCatalogerConfig()), 1153 assertion: assertPackages( 1154 []string{ 1155 "jquery", // a javascript package, not the nuget package 1156 }, 1157 []string{ 1158 "vendor", // this is the string reference for a filesystem provider 1159 "lodash", // this is from a filesystem provider, which is not supported 1160 }, 1161 ), 1162 }, 1163 } 1164 for _, tt := range cases { 1165 t.Run(tt.name, func(t *testing.T) { 1166 if tt.assertion == nil { 1167 t.Fatalf("assertion is required") 1168 } 1169 pkgtest.NewCatalogTester(). 1170 WithImageResolver(t, tt.fixture). 1171 IgnoreLocationLayer(). // this fixture can be rebuilt, thus the layer ID will change 1172 ExpectsAssertion(tt.assertion). 1173 TestCataloger(t, tt.cataloger) 1174 }) 1175 } 1176 } 1177 1178 func Test_corruptDotnetPE(t *testing.T) { 1179 pkgtest.NewCatalogTester(). 1180 FromDirectory(t, "test-fixtures/glob-paths/src"). 1181 Expects(nil, nil). // we shouldn't find packages nor error out 1182 TestCataloger(t, NewDotnetPortableExecutableCataloger()) 1183 } 1184 1185 func Test_corruptDotnetDeps(t *testing.T) { 1186 pkgtest.NewCatalogTester(). 1187 FromDirectory(t, "test-fixtures/glob-paths/src"). 1188 Expects(nil, nil). // we shouldn't find packages nor error out 1189 TestCataloger(t, NewDotnetDepsCataloger()) 1190 } 1191 1192 func TestParseDotnetDeps(t *testing.T) { 1193 fixture := "test-fixtures/dir-example-1" 1194 fixtureLocationSet := file.NewLocationSet(file.NewLocation("TestLibrary.deps.json")) 1195 rootPkg := pkg.Package{ 1196 Name: "TestLibrary", 1197 Version: "1.0.0", 1198 PURL: "pkg:nuget/TestLibrary@1.0.0", 1199 Locations: fixtureLocationSet, 1200 Language: pkg.Dotnet, 1201 Type: pkg.DotnetPkg, 1202 Metadata: pkg.DotnetDepsEntry{ 1203 Name: "TestLibrary", 1204 Version: "1.0.0", 1205 }, 1206 } 1207 testCommon := pkg.Package{ 1208 Name: "TestCommon", 1209 Version: "1.0.0", 1210 PURL: "pkg:nuget/TestCommon@1.0.0", 1211 Locations: fixtureLocationSet, 1212 Language: pkg.Dotnet, 1213 Type: pkg.DotnetPkg, 1214 Metadata: pkg.DotnetDepsEntry{ 1215 Name: "TestCommon", 1216 Version: "1.0.0", 1217 }, 1218 } 1219 awssdkcore := pkg.Package{ 1220 Name: "AWSSDK.Core", 1221 Version: "3.7.10.6", 1222 PURL: "pkg:nuget/AWSSDK.Core@3.7.10.6", 1223 Locations: fixtureLocationSet, 1224 Language: pkg.Dotnet, 1225 Type: pkg.DotnetPkg, 1226 Metadata: pkg.DotnetDepsEntry{ 1227 Name: "AWSSDK.Core", 1228 Version: "3.7.10.6", 1229 Sha512: "sha512-kHBB+QmosVaG6DpngXQ8OlLVVNMzltNITfsRr68Z90qO7dSqJ2EHNd8dtBU1u3AQQLqqFHOY0lfmbpexeH6Pew==", 1230 Path: "awssdk.core/3.7.10.6", 1231 HashPath: "awssdk.core.3.7.10.6.nupkg.sha512", 1232 }, 1233 } 1234 msftDependencyInjectionAbstractions := pkg.Package{ 1235 Name: "Microsoft.Extensions.DependencyInjection.Abstractions", 1236 Version: "6.0.0", 1237 PURL: "pkg:nuget/Microsoft.Extensions.DependencyInjection.Abstractions@6.0.0", 1238 Locations: fixtureLocationSet, 1239 Language: pkg.Dotnet, 1240 Type: pkg.DotnetPkg, 1241 Metadata: pkg.DotnetDepsEntry{ 1242 Name: "Microsoft.Extensions.DependencyInjection.Abstractions", 1243 Version: "6.0.0", 1244 Sha512: "sha512-xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==", 1245 Path: "microsoft.extensions.dependencyinjection.abstractions/6.0.0", 1246 HashPath: "microsoft.extensions.dependencyinjection.abstractions.6.0.0.nupkg.sha512", 1247 }, 1248 } 1249 msftDependencyInjection := pkg.Package{ 1250 Name: "Microsoft.Extensions.DependencyInjection", 1251 Version: "6.0.0", 1252 PURL: "pkg:nuget/Microsoft.Extensions.DependencyInjection@6.0.0", 1253 Locations: fixtureLocationSet, 1254 Language: pkg.Dotnet, 1255 Type: pkg.DotnetPkg, 1256 Metadata: pkg.DotnetDepsEntry{ 1257 Name: "Microsoft.Extensions.DependencyInjection", 1258 Version: "6.0.0", 1259 Sha512: "sha512-k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", 1260 Path: "microsoft.extensions.dependencyinjection/6.0.0", 1261 HashPath: "microsoft.extensions.dependencyinjection.6.0.0.nupkg.sha512", 1262 }, 1263 } 1264 msftLoggingAbstractions := pkg.Package{ 1265 Name: "Microsoft.Extensions.Logging.Abstractions", 1266 Version: "6.0.0", 1267 PURL: "pkg:nuget/Microsoft.Extensions.Logging.Abstractions@6.0.0", 1268 Locations: fixtureLocationSet, 1269 Language: pkg.Dotnet, 1270 Type: pkg.DotnetPkg, 1271 Metadata: pkg.DotnetDepsEntry{ 1272 Name: "Microsoft.Extensions.Logging.Abstractions", 1273 Version: "6.0.0", 1274 Sha512: "sha512-/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==", 1275 Path: "microsoft.extensions.logging.abstractions/6.0.0", 1276 HashPath: "microsoft.extensions.logging.abstractions.6.0.0.nupkg.sha512", 1277 }, 1278 } 1279 msftExtensionsLogging := pkg.Package{ 1280 Name: "Microsoft.Extensions.Logging", 1281 Version: "6.0.0", 1282 PURL: "pkg:nuget/Microsoft.Extensions.Logging@6.0.0", 1283 Locations: fixtureLocationSet, 1284 Language: pkg.Dotnet, 1285 Type: pkg.DotnetPkg, 1286 Metadata: pkg.DotnetDepsEntry{ 1287 Name: "Microsoft.Extensions.Logging", 1288 Version: "6.0.0", 1289 Sha512: "sha512-eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==", 1290 Path: "microsoft.extensions.logging/6.0.0", 1291 HashPath: "microsoft.extensions.logging.6.0.0.nupkg.sha512", 1292 }, 1293 } 1294 msftExtensionsOptions := pkg.Package{ 1295 Name: "Microsoft.Extensions.Options", 1296 Version: "6.0.0", 1297 PURL: "pkg:nuget/Microsoft.Extensions.Options@6.0.0", 1298 Locations: fixtureLocationSet, 1299 Language: pkg.Dotnet, 1300 Type: pkg.DotnetPkg, 1301 Metadata: pkg.DotnetDepsEntry{ 1302 Name: "Microsoft.Extensions.Options", 1303 Version: "6.0.0", 1304 Sha512: "sha512-dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", 1305 Path: "microsoft.extensions.options/6.0.0", 1306 HashPath: "microsoft.extensions.options.6.0.0.nupkg.sha512", 1307 }, 1308 } 1309 msftExtensionsPrimitives := pkg.Package{ 1310 Name: "Microsoft.Extensions.Primitives", 1311 Version: "6.0.0", 1312 PURL: "pkg:nuget/Microsoft.Extensions.Primitives@6.0.0", 1313 Locations: fixtureLocationSet, 1314 Language: pkg.Dotnet, 1315 Type: pkg.DotnetPkg, 1316 Metadata: pkg.DotnetDepsEntry{ 1317 Name: "Microsoft.Extensions.Primitives", 1318 Version: "6.0.0", 1319 Sha512: "sha512-9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", 1320 Path: "microsoft.extensions.primitives/6.0.0", 1321 HashPath: "microsoft.extensions.primitives.6.0.0.nupkg.sha512", 1322 }, 1323 } 1324 newtonsoftJson := pkg.Package{ 1325 Name: "Newtonsoft.Json", 1326 Version: "13.0.1", 1327 PURL: "pkg:nuget/Newtonsoft.Json@13.0.1", 1328 Locations: fixtureLocationSet, 1329 Language: pkg.Dotnet, 1330 Type: pkg.DotnetPkg, 1331 Metadata: pkg.DotnetDepsEntry{ 1332 Name: "Newtonsoft.Json", 1333 Version: "13.0.1", 1334 Sha512: "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", 1335 Path: "newtonsoft.json/13.0.1", 1336 HashPath: "newtonsoft.json.13.0.1.nupkg.sha512", 1337 }, 1338 } 1339 serilogSinksConsole := pkg.Package{ 1340 Name: "Serilog.Sinks.Console", 1341 Version: "4.0.1", 1342 PURL: "pkg:nuget/Serilog.Sinks.Console@4.0.1", 1343 Locations: fixtureLocationSet, 1344 Language: pkg.Dotnet, 1345 Type: pkg.DotnetPkg, 1346 Metadata: pkg.DotnetDepsEntry{ 1347 Name: "Serilog.Sinks.Console", 1348 Version: "4.0.1", 1349 Sha512: "sha512-apLOvSJQLlIbKlbx+Y2UDHSP05kJsV7mou+fvJoRGs/iR+jC22r8cuFVMjjfVxz/AD4B2UCltFhE1naRLXwKNw==", 1350 Path: "serilog.sinks.console/4.0.1", 1351 HashPath: "serilog.sinks.console.4.0.1.nupkg.sha512", 1352 }, 1353 } 1354 serilog := pkg.Package{ 1355 Name: "Serilog", 1356 Version: "2.10.0", 1357 PURL: "pkg:nuget/Serilog@2.10.0", 1358 Locations: fixtureLocationSet, 1359 Language: pkg.Dotnet, 1360 Type: pkg.DotnetPkg, 1361 Metadata: pkg.DotnetDepsEntry{ 1362 Name: "Serilog", 1363 Version: "2.10.0", 1364 Sha512: "sha512-+QX0hmf37a0/OZLxM3wL7V6/ADvC1XihXN4Kq/p6d8lCPfgkRdiuhbWlMaFjR9Av0dy5F0+MBeDmDdRZN/YwQA==", 1365 Path: "serilog/2.10.0", 1366 HashPath: "serilog.2.10.0.nupkg.sha512", 1367 }, 1368 } 1369 systemDiagnosticsDiagnosticsource := pkg.Package{ 1370 Name: "System.Diagnostics.DiagnosticSource", 1371 Version: "6.0.0", 1372 PURL: "pkg:nuget/System.Diagnostics.DiagnosticSource@6.0.0", 1373 Locations: fixtureLocationSet, 1374 Language: pkg.Dotnet, 1375 Type: pkg.DotnetPkg, 1376 Metadata: pkg.DotnetDepsEntry{ 1377 Name: "System.Diagnostics.DiagnosticSource", 1378 Version: "6.0.0", 1379 Sha512: "sha512-frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==", 1380 Path: "system.diagnostics.diagnosticsource/6.0.0", 1381 HashPath: "system.diagnostics.diagnosticsource.6.0.0.nupkg.sha512", 1382 }, 1383 } 1384 systemRuntimeCompilerServicesUnsafe := pkg.Package{ 1385 Name: "System.Runtime.CompilerServices.Unsafe", 1386 Version: "6.0.0", 1387 PURL: "pkg:nuget/System.Runtime.CompilerServices.Unsafe@6.0.0", 1388 Locations: fixtureLocationSet, 1389 Language: pkg.Dotnet, 1390 Type: pkg.DotnetPkg, 1391 Metadata: pkg.DotnetDepsEntry{ 1392 Name: "System.Runtime.CompilerServices.Unsafe", 1393 Version: "6.0.0", 1394 Sha512: "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", 1395 Path: "system.runtime.compilerservices.unsafe/6.0.0", 1396 HashPath: "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512", 1397 }} 1398 1399 expectedPkgs := []pkg.Package{ 1400 awssdkcore, 1401 msftDependencyInjection, 1402 msftDependencyInjectionAbstractions, 1403 msftExtensionsLogging, 1404 msftLoggingAbstractions, 1405 msftExtensionsOptions, 1406 msftExtensionsPrimitives, 1407 newtonsoftJson, 1408 serilog, 1409 serilogSinksConsole, 1410 systemDiagnosticsDiagnosticsource, 1411 systemRuntimeCompilerServicesUnsafe, 1412 testCommon, 1413 rootPkg, 1414 } 1415 1416 // ┌── (✓ = is represented in the test) 1417 // ↓ 1418 // 1419 // ✓ TestLibrary/1.0.0 (project) 1420 // ✓ ├── [a] Microsoft.Extensions.DependencyInjection/6.0.0 [file version: 6.0.21.52210] 1421 // ✓ │ ├── [b] Microsoft.Extensions.DependencyInjection.Abstractions/6.0.0 [file version: 6.0.21.52210] 1422 // ✓ │ └── [c!] System.Runtime.CompilerServices.Unsafe/6.0.0 [NO TARGET INFO] 1423 // ✓ ├── Microsoft.Extensions.Logging/6.0.0 [file version: 6.0.21.52210] 1424 // ✓ │ ├── Microsoft.Extensions.DependencyInjection/6.0.0 ...to [a] 1425 // ✓ │ ├── Microsoft.Extensions.DependencyInjection.Abstractions/6.0.0 ...to [b] 1426 // ✓ │ ├── Microsoft.Extensions.Logging.Abstractions/6.0.0 [file version: 6.0.21.52210] 1427 // ✓ │ ├── Microsoft.Extensions.Options/6.0.0 [file version: 6.0.21.52210] 1428 // ✓ │ │ ├── Microsoft.Extensions.DependencyInjection.Abstractions/6.0.0 ...to [b] 1429 // ✓ │ │ └── Microsoft.Extensions.Primitives/6.0.0 [file version: 6.0.21.52210] 1430 // ✓ │ │ └── System.Runtime.CompilerServices.Unsafe/6.0.0 ...to [c!] 1431 // ✓ │ └── System.Diagnostics.DiagnosticSource/6.0.0 [NO RUNTIME INFO] 1432 // ✓ │ └── System.Runtime.CompilerServices.Unsafe/6.0.0 ...to [c!] 1433 // ✓ ├── Newtonsoft.Json/13.0.1 [file version: 13.0.1.25517] 1434 // ✓ ├── [d] Serilog/2.10.0 [file version: 2.10.0.0] 1435 // ✓ ├── Serilog.Sinks.Console/4.0.1 [file version: 4.0.1.0] 1436 // ✓ │ └── Serilog/2.10.0 ...to [d] 1437 // ✓ └── [e!] TestCommon/1.0.0 [NOT SERVICEABLE / NO SHA] 1438 // ✓ └── AWSSDK.Core/3.7.10.6 [file version: 3.7.10.6] 1439 1440 expectedRelationships := []artifact.Relationship{ 1441 { 1442 From: awssdkcore, 1443 To: testCommon, 1444 Type: artifact.DependencyOfRelationship, 1445 }, 1446 { 1447 From: msftDependencyInjection, 1448 To: msftExtensionsLogging, 1449 Type: artifact.DependencyOfRelationship, 1450 }, 1451 { 1452 From: msftDependencyInjection, 1453 To: rootPkg, 1454 Type: artifact.DependencyOfRelationship, 1455 }, 1456 { 1457 From: msftDependencyInjectionAbstractions, 1458 To: msftDependencyInjection, 1459 Type: artifact.DependencyOfRelationship, 1460 }, 1461 { 1462 From: msftDependencyInjectionAbstractions, 1463 To: msftExtensionsLogging, 1464 Type: artifact.DependencyOfRelationship, 1465 }, 1466 { 1467 From: msftDependencyInjectionAbstractions, 1468 To: msftExtensionsOptions, 1469 Type: artifact.DependencyOfRelationship, 1470 }, 1471 { 1472 From: msftExtensionsLogging, 1473 To: rootPkg, 1474 Type: artifact.DependencyOfRelationship, 1475 }, 1476 { 1477 From: msftLoggingAbstractions, 1478 To: msftExtensionsLogging, 1479 Type: artifact.DependencyOfRelationship, 1480 }, 1481 { 1482 From: msftExtensionsOptions, 1483 To: msftExtensionsLogging, 1484 Type: artifact.DependencyOfRelationship, 1485 }, 1486 { 1487 From: msftExtensionsPrimitives, 1488 To: msftExtensionsOptions, 1489 Type: artifact.DependencyOfRelationship, 1490 }, 1491 { 1492 From: newtonsoftJson, 1493 To: rootPkg, 1494 Type: artifact.DependencyOfRelationship, 1495 }, 1496 { 1497 From: serilog, 1498 To: serilogSinksConsole, 1499 Type: artifact.DependencyOfRelationship, 1500 }, 1501 { 1502 From: serilog, 1503 To: rootPkg, 1504 Type: artifact.DependencyOfRelationship, 1505 }, 1506 { 1507 From: serilogSinksConsole, 1508 To: rootPkg, 1509 Type: artifact.DependencyOfRelationship, 1510 }, 1511 { 1512 From: systemDiagnosticsDiagnosticsource, 1513 To: msftExtensionsLogging, 1514 Type: artifact.DependencyOfRelationship, 1515 }, 1516 { 1517 From: systemRuntimeCompilerServicesUnsafe, 1518 To: msftDependencyInjection, 1519 Type: artifact.DependencyOfRelationship, 1520 }, 1521 { 1522 From: systemRuntimeCompilerServicesUnsafe, 1523 To: msftExtensionsPrimitives, 1524 Type: artifact.DependencyOfRelationship, 1525 }, 1526 { 1527 From: systemRuntimeCompilerServicesUnsafe, 1528 To: systemDiagnosticsDiagnosticsource, 1529 Type: artifact.DependencyOfRelationship, 1530 }, 1531 { 1532 From: testCommon, 1533 To: rootPkg, 1534 Type: artifact.DependencyOfRelationship, 1535 }, 1536 } 1537 1538 pkgtest.TestCataloger(t, fixture, NewDotnetDepsCataloger(), expectedPkgs, expectedRelationships) 1539 } 1540 1541 func extractMatchingPackage(t *testing.T, name string, pkgs []pkg.Package) pkg.Package { 1542 t.Helper() 1543 for _, p := range pkgs { 1544 if p.Name == name { 1545 return p 1546 } 1547 } 1548 t.Fatalf("expected to find package %s", name) 1549 return pkg.Package{} 1550 }