mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-30 06:57:10 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c022824d2b | ||
|
|
5420480ef8 | ||
|
|
bde9eebf3d | ||
|
|
f65c0cc1f3 | ||
|
|
947b264d94 |
@@ -5,3 +5,6 @@ VITE_BACKEND_URL=http://localhost:8080
|
||||
# Frontend dev server port
|
||||
# The Vite development server will run on this port
|
||||
VITE_PORT=5173
|
||||
|
||||
# Origin sent on the dev WebSocket proxy, for a backend with an allowed-origins list
|
||||
# VITE_WS_ORIGIN=https://gohoarder.example.com
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<link rel="icon" href="data:," />
|
||||
<title>GoHoarder dashboard</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Generated
+144
-87
@@ -24,19 +24,19 @@ importers:
|
||||
version: 7.3.1
|
||||
'@perfect-design/ui':
|
||||
specifier: 0.3.10
|
||||
version: 0.3.10([email protected](@vue/[email protected])([email protected])([email protected]5([email protected])))([email protected])([email protected]5([email protected]))
|
||||
version: 0.3.10([email protected](@vue/[email protected])([email protected])([email protected]6([email protected])))([email protected])([email protected]6([email protected]))
|
||||
axios:
|
||||
specifier: ^1.20.0
|
||||
version: 1.21.1
|
||||
version: 1.21.1([email protected]([email protected]))([email protected])
|
||||
pinia:
|
||||
specifier: ^4.0.0
|
||||
version: 4.1.0(@vue/[email protected])([email protected])([email protected]5([email protected]))
|
||||
version: 4.1.0(@vue/[email protected])([email protected])([email protected]6([email protected]))
|
||||
vue:
|
||||
specifier: ^3.5.26
|
||||
version: 3.5.45([email protected])
|
||||
version: 3.5.46([email protected])
|
||||
vue-router:
|
||||
specifier: ^5.3.1
|
||||
version: 5.5.1(@vue/[email protected])([email protected])([email protected](@vue/[email protected])([email protected])([email protected]5([email protected])))([email protected])([email protected]([email protected])([email protected]))([email protected]5([email protected]))
|
||||
version: 5.5.1(@vue/[email protected])([email protected])([email protected](@vue/[email protected])([email protected])([email protected]6([email protected])))([email protected])([email protected]([email protected])([email protected]))([email protected]6([email protected]))
|
||||
devDependencies:
|
||||
'@tailwindcss/vite':
|
||||
specifier: ^4.3.3
|
||||
@@ -46,13 +46,13 @@ importers:
|
||||
version: 7.0.1(@testing-library/[email protected])([email protected]([email protected])([email protected]([email protected])([email protected])))
|
||||
'@testing-library/vue':
|
||||
specifier: ^8.1.0
|
||||
version: 8.1.0(@vue/[email protected]5)(@vue/[email protected])(@vue/[email protected]5)([email protected]5([email protected]))
|
||||
version: 8.1.0(@vue/[email protected]6)(@vue/[email protected])(@vue/[email protected]6)([email protected]6([email protected]))
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.11([email protected]([email protected])([email protected]))([email protected]5([email protected]))
|
||||
version: 6.0.11([email protected]([email protected])([email protected]))([email protected]6([email protected]))
|
||||
'@vue/test-utils':
|
||||
specifier: ^2.4.6
|
||||
version: 2.6.0(@vue/[email protected]5)(@vue/[email protected]5)([email protected]5([email protected]))
|
||||
version: 2.6.0(@vue/[email protected]6)(@vue/[email protected]6)([email protected]6([email protected]))
|
||||
jsdom:
|
||||
specifier: ^31.0.0
|
||||
version: 31.0.1
|
||||
@@ -654,18 +654,30 @@ packages:
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-XGHJrM6ufZARAc/w+tyOswStw9tdKiqCKBScI4gGaNxD+aaGu/HQWgKJ+JItjRLPqenQ7iE7G8AJC7T5ew1p+g==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-yb+N8/mgBcoeqCJPVyJI/D3OphLrSMXnB3ZQUNmRLU/1fsMW4bFfdJWNi9oIj7+EA3ULKKkP7b/VCpcYQYeiuQ==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-W5AoBFWdw1lQAKiHowkfgFKFab82oSRT6sGsPfw/q1GRjsy/ZJFLHGhJyBRIFN9APLTUduDH9U2JAiPOIyKuYg==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-LbP2d19GSOYGPmvMBBCVJVlv7TKtjM1Cfeyu3cYia720pknZP+1cLX7H5MVatvruT6MuJhiPuNbQBW/MDn/EwA==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-Bj3lCSw3DQnDRDxw115XqdLDd0+18Nftlgd8OXSGG+ud74hxJIE17eYrM+VWgQrTMsvJbLh9Hzf2MkwAzru36Q==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-MKFjb2UX0M/l/jhfzqMLrI8VM4pfvFKG3pqFZkSZFHRLtNld/O4RtUPZFWSwhro/14qP88UQEkWzHxAZAQ0tsw==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-hjUvMxGh+QIgegwksfp6BRBYleE/a8veZHvTR6sa+o+bM4HU+WnrUZlhN0X+pDcsl8Lhwmbu72xPvLMk3XUwog==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-RF5sbZOfYz5AK00tOJUn2PwFXR2fS1u2HVzI8D9VF9rGAFxuGBqg2bB1kJ3ZHMprqSltXnT9MZE1IsqjSM8oew==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-qebChL3aP0m1k+TlSf+fZWvOwAf3flBCi5o+n01ykR3DX4mTIWheFltmoiQ12+z66/4cGeXqbB2P7sPWkGhQNQ==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-6u4vXBlIBAC1wMplIZgpyPn7uh/s4Bf6F5bMzvLv+EdJ0aHs/+4B7Ygv864EStQSjRbsRzTko/kUG1A1IejQ3A==}
|
||||
|
||||
@@ -678,17 +690,17 @@ packages:
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg==}
|
||||
|
||||
'@vue/[email protected]5':
|
||||
resolution: {integrity: sha512-WqkyubNWpI4OYBOipSrjIssMdJO8K1i9Zts/Wm8Er10/0msOEwCyWWWvZnAI7WW3kQsTong6DJp8Cbb+vd4cPA==}
|
||||
'@vue/[email protected]6':
|
||||
resolution: {integrity: sha512-+FHtYTvGxgFoX3oRs7soz6JHizGv50Q26WJN6PWtXuTLXRfkfUpDUTRuoTA/kiZVVt8NMeMpsPQLh9h++ReUjQ==}
|
||||
|
||||
'@vue/[email protected]5':
|
||||
resolution: {integrity: sha512-bzIO3+FABjpj85uIKSc+Qnj36/sxDNI3tcH9i6w6xKA1k6e0ejv0G0jMCfeJBvK3yGL5XbJ3DMZj+ClqyCHFYw==}
|
||||
'@vue/[email protected]6':
|
||||
resolution: {integrity: sha512-eJUzKAUaHAmtnys/l9qduPzUnBrYMkmsCU7TN+vbSOSpm8kcETT7nacKxIO4MBej/XiOraVzq+lSeZv7o1//jQ==}
|
||||
|
||||
'@vue/[email protected]5':
|
||||
resolution: {integrity: sha512-ZvRTFMDgfqTDYWvJfoVpQTJx1RN5M6l7Pyd6wfdY2NaXzbPQVh9ezeQYFbNPP6bIcRVn2SqSSR25N/jSW69BFw==}
|
||||
'@vue/[email protected]6':
|
||||
resolution: {integrity: sha512-6L7lbBvXTYBFFjIt25a0pgdpmn3Ns8RqUnNVibRzF4bgyiWJvqOhKEV5MXYWKlCttZE3aGeJN8mveo+6IrIKXA==}
|
||||
|
||||
'@vue/[email protected]5':
|
||||
resolution: {integrity: sha512-1fNXUHhhsWf4EVL4XixbGBU5mKdiIXJAB82feHRTyPPo6ZUEYWIJuEeUl3mVV6QDBp50HJOX4obLhxYXlrjrzA==}
|
||||
'@vue/[email protected]6':
|
||||
resolution: {integrity: sha512-4mc0YWREc6OZ5pDCigvKPDzIUV+aciiH92yvyTS6xaHHxW/80rMceQQn11pYe7OEEBt2YQgYWR9zF8QF30GJUQ==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-H82XLH0DjmSOdbEwO15x3QTo1f5PWEtv237eLpYKc0mqLu+B8hnq16lFWmuBmNurkeiG3wr+oM1FhOll/YVFRg==}
|
||||
@@ -696,6 +708,9 @@ packages:
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-ue9fgHmVNPlP7iW3+cxoBX/Cnlw53dHlVSw0JKGY6z1lObg8pHoj928M2nzG4/yVsMZ3NaRZ2s2z61uC16NDwQ==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-P1WePbdzHrcIciWtmY2Im9EFhdakd3rZxYqvalOa3SfoxtF35Q8Uhmj1tKn6bWP4utcOpN8ao6BoJUItq0Uf+g==}
|
||||
|
||||
'@vue/[email protected]':
|
||||
resolution: {integrity: sha512-kTB6s2p34cA/xXSpt17G0enU9A3F3pdm+o5GZgE3WGXXXpXJ5SVBsRhgCJNCc+ekGAzY0T7Hjyo5yEfwencBlg==}
|
||||
peerDependencies:
|
||||
@@ -855,8 +870,8 @@ packages:
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==}
|
||||
|
||||
[email protected].3:
|
||||
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
|
||||
[email protected].4:
|
||||
resolution: {integrity: sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==}
|
||||
@@ -1476,6 +1491,10 @@ packages:
|
||||
resolution: {integrity: sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-J7ZjMvHd9O1fcT/5V09QWaaSl2BbWx3F6O08spde82Namf9UB0GxRVIPiNbVsdKkoizHiSpTodo3vp2bAy91MA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
[email protected]:
|
||||
resolution: {integrity: sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==}
|
||||
|
||||
@@ -1710,8 +1729,8 @@ packages:
|
||||
peerDependencies:
|
||||
typescript: '>=5.0.0'
|
||||
|
||||
[email protected]5:
|
||||
resolution: {integrity: sha512-3cvsib8m9c0vB24+MDKsgcW4+Da4xaBl9Z/5Tbm2pmSIsRPxcil4cdXjXlVsmJ2g64XJo5h+IRd7rsdGT9pZaw==}
|
||||
[email protected]6:
|
||||
resolution: {integrity: sha512-0kW5CgfjMPBqmH158049SaE1muufp+K/ZyrwvSEwrwYky6QB7zL2y8kXfruneKb9O12eh0xAJL6CVSpzb9o0Kg==}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
@@ -1901,11 +1920,11 @@ snapshots:
|
||||
|
||||
'@floating-ui/[email protected]': {}
|
||||
|
||||
'@floating-ui/[email protected]([email protected]5([email protected]))':
|
||||
'@floating-ui/[email protected]([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@floating-ui/dom': 1.8.0
|
||||
'@floating-ui/utils': 0.2.12
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@fontsource/[email protected]': {}
|
||||
|
||||
@@ -1948,13 +1967,13 @@ snapshots:
|
||||
|
||||
'@oxc-project/[email protected]': {}
|
||||
|
||||
'@perfect-design/[email protected]([email protected](@vue/[email protected])([email protected])([email protected]5([email protected])))([email protected])([email protected]5([email protected]))':
|
||||
'@perfect-design/[email protected]([email protected](@vue/[email protected])([email protected])([email protected]6([email protected])))([email protected])([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
pinia: 4.1.0(@vue/[email protected])([email protected])([email protected]5([email protected]))
|
||||
reka-ui: 2.11.0([email protected]5([email protected]))
|
||||
pinia: 4.1.0(@vue/[email protected])([email protected])([email protected]6([email protected]))
|
||||
reka-ui: 2.11.0([email protected]6([email protected]))
|
||||
tailwind-merge: 3.7.1
|
||||
tailwindcss: 4.3.5
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@rolldown/[email protected]':
|
||||
optional: true
|
||||
@@ -2077,10 +2096,10 @@ snapshots:
|
||||
|
||||
'@tanstack/[email protected]': {}
|
||||
|
||||
'@tanstack/[email protected]([email protected]5([email protected]))':
|
||||
'@tanstack/[email protected]([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@tanstack/virtual-core': 3.13.14
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@testing-library/[email protected]':
|
||||
dependencies:
|
||||
@@ -2116,12 +2135,12 @@ snapshots:
|
||||
optionalDependencies:
|
||||
vitest: 5.1.1([email protected])([email protected]([email protected])([email protected]))
|
||||
|
||||
'@testing-library/[email protected](@vue/[email protected]5)(@vue/[email protected])(@vue/[email protected]5)([email protected]5([email protected]))':
|
||||
'@testing-library/[email protected](@vue/[email protected]6)(@vue/[email protected])(@vue/[email protected]6)([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@babel/runtime': 7.28.4
|
||||
'@testing-library/dom': 9.3.4
|
||||
'@vue/test-utils': 2.6.0(@vue/[email protected]5)(@vue/[email protected]5)([email protected]5([email protected]))
|
||||
vue: 3.5.45([email protected])
|
||||
'@vue/test-utils': 2.6.0(@vue/[email protected]6)(@vue/[email protected]6)([email protected]6([email protected]))
|
||||
vue: 3.5.46([email protected])
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.5.45
|
||||
transitivePeerDependencies:
|
||||
@@ -2141,11 +2160,11 @@ snapshots:
|
||||
|
||||
'@types/[email protected]': {}
|
||||
|
||||
'@vitejs/[email protected]([email protected]([email protected])([email protected]))([email protected]5([email protected]))':
|
||||
'@vitejs/[email protected]([email protected]([email protected])([email protected]))([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@rolldown/pluginutils': 1.0.1
|
||||
vite: 8.3.8([email protected])([email protected])
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@vitest/[email protected]([email protected]([email protected])([email protected]))':
|
||||
dependencies:
|
||||
@@ -2182,7 +2201,7 @@ snapshots:
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
'@vue-macros/[email protected]([email protected]5([email protected]))':
|
||||
'@vue-macros/[email protected]([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@vue/compiler-sfc': 3.5.45
|
||||
ast-kit: 2.2.0
|
||||
@@ -2190,7 +2209,7 @@ snapshots:
|
||||
magic-string-ast: 1.0.3
|
||||
unplugin-utils: 0.3.2
|
||||
optionalDependencies:
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
@@ -2208,6 +2227,14 @@ snapshots:
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.2
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.13
|
||||
'@vue/shared': 3.5.46
|
||||
entities: 7.0.1
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.4
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.44
|
||||
@@ -2218,6 +2245,11 @@ snapshots:
|
||||
'@vue/compiler-core': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.13
|
||||
@@ -2230,11 +2262,28 @@ snapshots:
|
||||
postcss: 8.5.32
|
||||
source-map-js: 1.2.2
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.13
|
||||
'@vue/compiler-core': 3.5.46
|
||||
'@vue/compiler-dom': 3.5.46
|
||||
'@vue/compiler-ssr': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.21
|
||||
postcss: 8.5.32
|
||||
source-map-js: 1.2.4
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
|
||||
'@vue/[email protected]':
|
||||
dependencies:
|
||||
'@vue/devtools-kit': 8.2.1
|
||||
@@ -2258,61 +2307,63 @@ snapshots:
|
||||
path-browserify: 1.0.1
|
||||
picomatch: 4.0.7
|
||||
|
||||
'@vue/[email protected]5':
|
||||
'@vue/[email protected]6':
|
||||
dependencies:
|
||||
'@vue/shared': 3.5.45
|
||||
'@vue/shared': 3.5.46
|
||||
|
||||
'@vue/[email protected]5':
|
||||
'@vue/[email protected]6':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
'@vue/reactivity': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
|
||||
'@vue/[email protected]5':
|
||||
'@vue/[email protected]6':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.45
|
||||
'@vue/runtime-core': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
csstype: 3.2.3
|
||||
'@vue/reactivity': 3.5.46
|
||||
'@vue/runtime-core': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
csstype: 3.2.4
|
||||
|
||||
'@vue/[email protected]5':
|
||||
'@vue/[email protected]6':
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.5.45
|
||||
'@vue/runtime-dom': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
'@vue/compiler-ssr': 3.5.46
|
||||
'@vue/runtime-dom': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
|
||||
'@vue/[email protected]': {}
|
||||
|
||||
'@vue/[email protected]': {}
|
||||
|
||||
'@vue/[email protected](@vue/[email protected])(@vue/[email protected])([email protected]([email protected]))':
|
||||
'@vue/[email protected]': {}
|
||||
|
||||
'@vue/[email protected](@vue/[email protected])(@vue/[email protected])([email protected]([email protected]))':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.45
|
||||
'@vue/compiler-dom': 3.5.46
|
||||
js-beautify: 2.0.3
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
vue-component-type-helpers: 3.3.12
|
||||
optionalDependencies:
|
||||
'@vue/server-renderer': 3.5.45
|
||||
'@vue/server-renderer': 3.5.46
|
||||
|
||||
'@vueuse/[email protected]([email protected]5([email protected]))':
|
||||
'@vueuse/[email protected]([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
'@types/web-bluetooth': 0.0.21
|
||||
'@vueuse/metadata': 14.4.0
|
||||
'@vueuse/shared': 14.4.0([email protected]5([email protected]))
|
||||
vue: 3.5.45([email protected])
|
||||
'@vueuse/shared': 14.4.0([email protected]6([email protected]))
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
'@vueuse/[email protected]': {}
|
||||
|
||||
'@vueuse/[email protected]([email protected]5([email protected]))':
|
||||
'@vueuse/[email protected]([email protected]6([email protected]))':
|
||||
dependencies:
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
debug: 4.4.3
|
||||
debug: 4.4.3([email protected])
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -2368,11 +2419,11 @@ snapshots:
|
||||
dependencies:
|
||||
possible-typed-array-names: 1.1.0
|
||||
|
||||
[email protected]:
|
||||
[email protected]([email protected]([email protected]))([email protected]):
|
||||
dependencies:
|
||||
follow-redirects: 1.16.3
|
||||
follow-redirects: 1.16.3([email protected]([email protected]))
|
||||
form-data: 4.0.6
|
||||
https-proxy-agent: 5.0.1
|
||||
https-proxy-agent: 5.0.1([email protected])
|
||||
proxy-from-env: 2.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
@@ -2445,7 +2496,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected].3: {}
|
||||
[email protected].4: {}
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -2454,9 +2505,11 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
|
||||
[email protected]:
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
optionalDependencies:
|
||||
supports-color: 7.2.0
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
@@ -2600,7 +2653,9 @@ snapshots:
|
||||
optionalDependencies:
|
||||
picomatch: 4.0.7
|
||||
|
||||
[email protected]: {}
|
||||
[email protected]([email protected]([email protected])):
|
||||
optionalDependencies:
|
||||
debug: 4.4.3([email protected])
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -2675,10 +2730,10 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- '@noble/hashes'
|
||||
|
||||
[email protected]:
|
||||
[email protected]([email protected]):
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.4.3
|
||||
agent-base: 6.0.2([email protected])
|
||||
debug: 4.4.3([email protected])
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -2968,11 +3023,11 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected](@vue/[email protected])([email protected])([email protected]5([email protected])):
|
||||
[email protected](@vue/[email protected])([email protected])([email protected]6([email protected])):
|
||||
dependencies:
|
||||
'@vue/devtools-api': 8.2.1
|
||||
nostics: 1.3.0
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
@@ -3030,18 +3085,18 @@ snapshots:
|
||||
gopd: 1.2.0
|
||||
set-function-name: 2.0.2
|
||||
|
||||
[email protected]([email protected]5([email protected])):
|
||||
[email protected]([email protected]6([email protected])):
|
||||
dependencies:
|
||||
'@floating-ui/vue': 2.0.1([email protected]5([email protected]))
|
||||
'@floating-ui/vue': 2.0.1([email protected]6([email protected]))
|
||||
'@internationalized/date': 3.10.1
|
||||
'@internationalized/number': 3.6.5
|
||||
'@tanstack/vue-virtual': 3.13.14([email protected]5([email protected]))
|
||||
'@vueuse/core': 14.4.0([email protected]5([email protected]))
|
||||
'@vueuse/shared': 14.4.0([email protected]5([email protected]))
|
||||
'@tanstack/vue-virtual': 3.13.14([email protected]6([email protected]))
|
||||
'@vueuse/core': 14.4.0([email protected]6([email protected]))
|
||||
'@vueuse/shared': 14.4.0([email protected]6([email protected]))
|
||||
aria-hidden: 1.2.6
|
||||
defu: 6.1.7
|
||||
ohash: 2.0.11
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
|
||||
[email protected]:
|
||||
dependencies:
|
||||
@@ -3124,6 +3179,8 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected]:
|
||||
@@ -3240,9 +3297,9 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected](@vue/[email protected])([email protected])([email protected](@vue/[email protected])([email protected])([email protected]5([email protected])))([email protected])([email protected]([email protected])([email protected]))([email protected]5([email protected])):
|
||||
[email protected](@vue/[email protected])([email protected])([email protected](@vue/[email protected])([email protected])([email protected]6([email protected])))([email protected])([email protected]([email protected])([email protected]))([email protected]6([email protected])):
|
||||
dependencies:
|
||||
'@vue-macros/common': 3.1.4([email protected]5([email protected]))
|
||||
'@vue-macros/common': 3.1.4([email protected]6([email protected]))
|
||||
'@vue/devtools-api': 8.2.1
|
||||
ast-walker-scope: 0.10.0
|
||||
chokidar: 6.0.0
|
||||
@@ -3258,10 +3315,10 @@ snapshots:
|
||||
tinyglobby: 0.2.17
|
||||
unplugin: 3.7.0([email protected])([email protected])([email protected]([email protected])([email protected]))
|
||||
unplugin-utils: 0.3.2
|
||||
vue: 3.5.45([email protected])
|
||||
vue: 3.5.46([email protected])
|
||||
optionalDependencies:
|
||||
'@vue/compiler-sfc': 3.5.45
|
||||
pinia: 4.1.0(@vue/[email protected])([email protected])([email protected]5([email protected]))
|
||||
pinia: 4.1.0(@vue/[email protected])([email protected])([email protected]6([email protected]))
|
||||
vite: 8.3.8([email protected])([email protected])
|
||||
transitivePeerDependencies:
|
||||
- '@farmfe/core'
|
||||
@@ -3280,13 +3337,13 @@ snapshots:
|
||||
'@vue/language-core': 3.3.14
|
||||
typescript: 6.0.3
|
||||
|
||||
[email protected]5([email protected]):
|
||||
[email protected]6([email protected]):
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.45
|
||||
'@vue/compiler-sfc': 3.5.45
|
||||
'@vue/runtime-dom': 3.5.45
|
||||
'@vue/server-renderer': 3.5.45
|
||||
'@vue/shared': 3.5.45
|
||||
'@vue/compiler-dom': 3.5.46
|
||||
'@vue/compiler-sfc': 3.5.46
|
||||
'@vue/runtime-dom': 3.5.46
|
||||
'@vue/server-renderer': 3.5.46
|
||||
'@vue/shared': 3.5.46
|
||||
optionalDependencies:
|
||||
typescript: 6.0.3
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
:hint="
|
||||
bypassForm.type === 'cve'
|
||||
? 'Enter the CVE ID, for example CVE-2021-23337.'
|
||||
: 'Enter a package, for example npm/[email protected], or npm/lodash for all versions.'
|
||||
: 'Enter a package, for example npm/[email protected], or npm/lodash for all versions. PyPI packages use the release version, for example pypi/[email protected].'
|
||||
"
|
||||
required
|
||||
>
|
||||
@@ -137,6 +137,24 @@
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model:open="showKeyDialog">
|
||||
<DialogContent size="sm">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Admin API key</DialogTitle>
|
||||
<DialogDescription>Enter your admin API key to manage bypasses.</DialogDescription>
|
||||
</DialogHeader>
|
||||
<form class="flex flex-col gap-4" @submit.prevent="submitApiKey">
|
||||
<Field label="API key" required>
|
||||
<Input v-model="keyInput" type="password" autocomplete="off" />
|
||||
</Field>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" @click="showKeyDialog = false">Cancel</Button>
|
||||
<Button type="submit" :disabled="keyInput.trim() === ''">Continue</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<ConfirmDialog
|
||||
v-model:open="showDeleteModal"
|
||||
title="Delete bypass?"
|
||||
@@ -222,6 +240,8 @@ const bypassForm = ref({ ...EMPTY_FORM })
|
||||
|
||||
// Get API key from localStorage or prompt user
|
||||
const apiKey = ref<string>('')
|
||||
const keyInput = ref('')
|
||||
const showKeyDialog = ref(false)
|
||||
|
||||
const filteredBypasses = computed(() => {
|
||||
let filtered = bypasses.value
|
||||
@@ -264,16 +284,23 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
function promptForApiKey() {
|
||||
const key = prompt('Enter your admin API key:')
|
||||
if (key) {
|
||||
apiKey.value = key
|
||||
localStorage.setItem('admin_api_key', key)
|
||||
fetchBypasses()
|
||||
} else {
|
||||
error.value = 'Admin API key required to manage bypasses'
|
||||
}
|
||||
keyInput.value = ''
|
||||
showKeyDialog.value = true
|
||||
}
|
||||
|
||||
function submitApiKey() {
|
||||
const key = keyInput.value.trim()
|
||||
if (!key) return
|
||||
apiKey.value = key
|
||||
localStorage.setItem('admin_api_key', key)
|
||||
showKeyDialog.value = false
|
||||
fetchBypasses()
|
||||
}
|
||||
|
||||
watch(showKeyDialog, (open) => {
|
||||
if (!open && !apiKey.value) error.value = 'Admin API key required to manage bypasses'
|
||||
})
|
||||
|
||||
async function fetchBypasses() {
|
||||
if (!apiKey.value) {
|
||||
promptForApiKey()
|
||||
|
||||
@@ -127,7 +127,7 @@ import type { IconDefinition } from '@perfect-design/ui/lib/icons-tools'
|
||||
import { usePackageStore, type Package } from '../stores/packages'
|
||||
import { useRealtimeStore } from '../stores/realtime'
|
||||
import type { EventType, RealtimeEvent } from '@/lib/ws'
|
||||
import { formatBytes, formatNumber } from '@/lib/format'
|
||||
import { displayVersion, formatBytes, formatNumber, withVersionPrefix } from '@/lib/format'
|
||||
import {
|
||||
faBox,
|
||||
faBoxOpen,
|
||||
@@ -190,7 +190,8 @@ function labelForEvent(type: EventType): string {
|
||||
function describeEvent(evt: RealtimeEvent): string {
|
||||
const p = evt.payload
|
||||
const name = typeof p.name === 'string' ? p.name : ''
|
||||
const version = typeof p.version === 'string' ? `@${p.version}` : ''
|
||||
const shown = typeof p.release_version === 'string' && p.release_version ? p.release_version : p.version
|
||||
const version = typeof shown === 'string' ? `@${shown}` : ''
|
||||
const registry = typeof p.registry === 'string' ? `[${p.registry}] ` : ''
|
||||
if (evt.type === 'stats_update') return ''
|
||||
if (name) return `${registry}${name}${version}`
|
||||
@@ -250,7 +251,7 @@ const chartLabels = computed(() => chartData.value.map((_, index) => getChartLab
|
||||
|
||||
const packageColumns: DataTableColumn<Package>[] = [
|
||||
{ key: 'name', header: 'Package', rowHeader: true },
|
||||
{ key: 'version', header: 'Version' },
|
||||
{ key: 'version', header: 'Version', accessor: (pkg) => withVersionPrefix(displayVersion(pkg)) },
|
||||
{ key: 'registry', header: 'Registry' },
|
||||
{ key: 'size', header: 'Size', numeric: true, accessor: (pkg) => formatBytes(pkg.size) },
|
||||
{ key: 'download_count', header: 'Downloads', numeric: true, accessor: (pkg) => formatNumber(pkg.download_count) },
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<template #description>
|
||||
<span class="flex flex-wrap items-center gap-2">
|
||||
<Badge variant="outline">{{ registry }}</Badge>
|
||||
<Badge variant="outline" class="font-mono">v{{ version }}</Badge>
|
||||
<Badge variant="outline" class="font-mono">{{ withVersionPrefix(shownVersion) }}</Badge>
|
||||
</span>
|
||||
</template>
|
||||
</PageHeader>
|
||||
@@ -184,7 +184,7 @@ import {
|
||||
TableRow,
|
||||
} from '@perfect-design/ui'
|
||||
import SeveritySummary from './SeveritySummary.vue'
|
||||
import { formatDate } from '@/lib/format'
|
||||
import { formatDate, withVersionPrefix } from '@/lib/format'
|
||||
import { faArrowLeft, faChevronDown, faChevronUp, faCircleCheck } from '@/lib/icons'
|
||||
import { NO_VULNERABILITIES, SEVERITY_TONES, formatSeverityName, severityRank } from '@/lib/severity'
|
||||
|
||||
@@ -201,6 +201,7 @@ const packageName = computed(() => {
|
||||
return nameParam as string
|
||||
})
|
||||
const version = computed(() => route.params.version as string)
|
||||
const shownVersion = computed(() => vulnerabilities.value?.package?.release_version || version.value)
|
||||
|
||||
interface BypassInfo {
|
||||
id: string
|
||||
@@ -221,6 +222,7 @@ interface Vulnerability {
|
||||
}
|
||||
|
||||
interface VulnerabilityResponse {
|
||||
package?: { release_version?: string }
|
||||
scanned: boolean
|
||||
scanner: string
|
||||
scanned_at: string
|
||||
|
||||
@@ -140,6 +140,31 @@ describe('view smoke tests (strict mode throw, fixture data)', () => {
|
||||
expect(document.body.querySelector('textarea')).not.toBeNull()
|
||||
})
|
||||
|
||||
it('BypassManagementPanel asks for the admin key in a dialog, not a native prompt', async () => {
|
||||
localStorage.clear()
|
||||
const prompt = vi.spyOn(window, 'prompt')
|
||||
const { wrapper, problems } = await smoke(BypassManagementPanel, '/admin/bypasses')
|
||||
await flushPromises()
|
||||
expect(problems).toEqual([])
|
||||
expect(prompt).not.toHaveBeenCalled()
|
||||
expect(document.body.textContent).toContain('Enter your admin API key to manage bypasses.')
|
||||
|
||||
const input = document.body.querySelector<HTMLInputElement>('input[type="password"]')
|
||||
expect(input).not.toBeNull()
|
||||
input!.value = 'secret-key'
|
||||
input!.dispatchEvent(new Event('input', { bubbles: true }))
|
||||
await flushPromises()
|
||||
document.body.querySelector<HTMLFormElement>('input[type="password"]')!.form!.requestSubmit()
|
||||
await flushPromises()
|
||||
|
||||
expect(localStorage.getItem('admin_api_key')).toBe('secret-key')
|
||||
expect(vi.mocked(axios.get)).toHaveBeenCalledWith(
|
||||
expect.stringContaining('/api/admin/bypasses'),
|
||||
expect.objectContaining({ headers: { Authorization: 'Bearer secret-key' } }),
|
||||
)
|
||||
expect(wrapper.text()).toContain('CVE-2026-0002')
|
||||
})
|
||||
|
||||
it('Stats renders totals, the storage tile and the registry table', async () => {
|
||||
const { wrapper, problems } = await smoke(Stats, '/stats')
|
||||
expect(problems).toEqual([])
|
||||
@@ -186,3 +211,95 @@ describe('view smoke tests (strict mode throw, fixture data)', () => {
|
||||
expect(usePackageStore().packages.length).toBe(PACKAGES.length)
|
||||
})
|
||||
})
|
||||
|
||||
describe('PyPI rows show the release version, not the file name', () => {
|
||||
const FILE = 'six-1.17.0-py2.py3-none-any.whl'
|
||||
const SIX = {
|
||||
id: 'pypi-six',
|
||||
registry: 'pypi',
|
||||
name: 'six',
|
||||
version: FILE,
|
||||
release_version: '1.17.0',
|
||||
size: 1,
|
||||
cached_at: '2026-02-01T10:00:00Z',
|
||||
last_accessed: '2026-02-01T10:00:00Z',
|
||||
download_count: 1,
|
||||
vulnerabilities: {
|
||||
scanned: true,
|
||||
status: 'vulnerable',
|
||||
counts: { critical: 1, high: 0, moderate: 0, low: 0 },
|
||||
total: 1,
|
||||
scannedAt: '2026-02-01T10:05:00Z',
|
||||
isBlocked: false,
|
||||
},
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
vi.mocked(axios.get).mockImplementation(async (url: string) => {
|
||||
if (url.endsWith('/vulnerabilities')) {
|
||||
return { data: { ...VULNERABILITY_REPORT, package: { release_version: '1.17.0' } } } as never
|
||||
}
|
||||
if (url.startsWith('/api/packages')) return { data: { packages: [SIX] } } as never
|
||||
return respond(url) as never
|
||||
})
|
||||
})
|
||||
|
||||
it('Dashboard recent packages', async () => {
|
||||
const { wrapper } = await smoke(Dashboard, '/')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('v1.17.0')
|
||||
expect(wrapper.text()).not.toContain('py2.py3-none-any.whl')
|
||||
})
|
||||
|
||||
it('Dashboard activity feed', async () => {
|
||||
const router = await createTestRouter('/')
|
||||
const pinia = createPinia()
|
||||
setActivePinia(pinia)
|
||||
const rt = useRealtimeStore()
|
||||
vi.spyOn(rt, 'connect').mockImplementation(() => {})
|
||||
rt.events = [{ type: 'package_cached', payload: { name: 'six', version: FILE, release_version: '1.17.0', registry: 'pypi' }, timestamp: Date.now() }]
|
||||
const { wrapper, restore: r } = await mountStrict(Dashboard, { global: { plugins: [pinia, router] } })
|
||||
restore = r
|
||||
await flushPromises()
|
||||
const feed = wrapper.find('[data-testid="ws-event-feed"]').text()
|
||||
expect(feed).toContain('[email protected]')
|
||||
expect(feed).not.toContain('whl')
|
||||
})
|
||||
|
||||
it('VulnerablePackages version column', async () => {
|
||||
const { wrapper } = await smoke(VulnerablePackages, '/vulnerable-packages')
|
||||
await flushPromises()
|
||||
await wrapper.find('button[aria-expanded]').trigger('click')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('v1.17.0')
|
||||
expect(wrapper.text()).not.toContain('py2.py3-none-any.whl')
|
||||
})
|
||||
|
||||
it('PackageDetails header badge', async () => {
|
||||
const { wrapper } = await smoke(PackageDetails, `/package/pypi/six/${FILE}`)
|
||||
const router = (wrapper.vm as unknown as { $router: Awaited<ReturnType<typeof createTestRouter>> }).$router
|
||||
await router.push(`/package/pypi/six/${FILE}`)
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('v1.17.0')
|
||||
expect(wrapper.text()).not.toContain('py2.py3-none-any.whl')
|
||||
})
|
||||
|
||||
it('PackageDetails falls back to the route version without a release version', async () => {
|
||||
vi.mocked(axios.get).mockImplementation(async (url: string) => respond(url) as never)
|
||||
const { wrapper } = await smoke(PackageDetails, '/package/npm/left-pad/1.3.0')
|
||||
const router = (wrapper.vm as unknown as { $router: Awaited<ReturnType<typeof createTestRouter>> }).$router
|
||||
await router.push('/package/npm/left-pad/1.3.0')
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).toContain('v1.3.0')
|
||||
})
|
||||
|
||||
it('bypass form tells PyPI users to use the release version', async () => {
|
||||
const { wrapper } = await smoke(BypassManagementPanel, '/admin/bypasses')
|
||||
await wrapper.findAll('button').find((b) => b.text() === 'Create bypass')!.trigger('click')
|
||||
await flushPromises()
|
||||
const pkg = Array.from(document.body.querySelectorAll<HTMLElement>('button, [role="radio"]')).find((e) => e.textContent?.trim() === 'Package bypass')
|
||||
pkg!.click()
|
||||
await flushPromises()
|
||||
expect(document.body.textContent).toContain('pypi/[email protected]')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,6 +5,7 @@ import { themeBootScript } from '@perfect-design/ui/stores/theme-boot'
|
||||
|
||||
// Get backend URL from environment or use default
|
||||
const BACKEND_URL = process.env.VITE_BACKEND_URL || 'http://localhost:8080'
|
||||
const WS_ORIGIN = process.env.VITE_WS_ORIGIN
|
||||
const FRONTEND_PORT = parseInt(process.env.VITE_PORT || '5173')
|
||||
|
||||
// Applies the saved colour mode before first paint so a dark system never flashes light.
|
||||
@@ -33,6 +34,8 @@ export default defineConfig({
|
||||
target: BACKEND_URL.replace('http', 'ws'),
|
||||
ws: true,
|
||||
changeOrigin: true,
|
||||
// A backend with an origin allowlist refuses the dev server origin; set this to an allowed one.
|
||||
...(WS_ORIGIN ? { headers: { Origin: WS_ORIGIN } } : {}),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -87,7 +87,7 @@ require (
|
||||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/klauspost/compress v1.20.4 // indirect
|
||||
github.com/klauspost/compress v1.20.5 // indirect
|
||||
github.com/lufia/plan9stats v0.0.0-20260802145828-341c2f0c90b5 // indirect
|
||||
github.com/magiconair/properties v1.18.13 // indirect
|
||||
github.com/mattn/go-colorable v0.1.16 // indirect
|
||||
@@ -127,7 +127,7 @@ require (
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
github.com/valyala/fasthttp v1.79.0 // indirect
|
||||
github.com/yusufpapurcu/wmi v1.2.4 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.2 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 // indirect
|
||||
go.opentelemetry.io/otel v1.47.0 // indirect
|
||||
go.opentelemetry.io/otel/log v1.47.0 // indirect
|
||||
|
||||
@@ -149,8 +149,8 @@ github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/klauspost/compress v1.20.4 h1:dD0v/bvxtjCBqQu6sx1TNWkalEY5lNTIe+HY9w8TeNI=
|
||||
github.com/klauspost/compress v1.20.4/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/klauspost/compress v1.20.5 h1:rJj5VjH4xQxbnLphg6eqUcDxRFCw1jpMdDY9qXlrwSs=
|
||||
github.com/klauspost/compress v1.20.5/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -218,8 +218,8 @@ github.com/prometheus/common v0.74.0 h1:6iYW8MsYvmEnXFD9zLGgF0qmReaRhs3OMONu1c/n
|
||||
github.com/prometheus/common v0.74.0/go.mod h1:i/02C+FCst5B1etKgWesNrD49n+onplJCqUCtUKkOeA=
|
||||
github.com/prometheus/procfs v0.23.0 h1:ad+S6FTkzwaMgacKLM5h6bNKExS+DMH0YiUwXItH/o4=
|
||||
github.com/prometheus/procfs v0.23.0/go.mod h1:3AVXO0FqLafyYFU/V/IQRZlC8Rgqz8Dm/x6pKLK+RIk=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI=
|
||||
github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
@@ -278,8 +278,8 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
|
||||
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/auto/sdk v1.2.2 h1:ErNn7NW2t1F9CFBLb9iyPMyLRbcEd07l5m/StCe9AEE=
|
||||
go.opentelemetry.io/auto/sdk v1.2.2/go.mod h1:Ca3X8ec6gdTYjAirla//dnp05ECtQPfN4Ut74OJLVsQ=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
|
||||
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
|
||||
|
||||
+20
-11
@@ -37,6 +37,25 @@ func (a *App) handlePackages(c fiber.Ctx) error {
|
||||
}
|
||||
}
|
||||
|
||||
// packageSummary is the list payload for one package when scan results are attached.
|
||||
func packageSummary(pkg *metadata.Package) map[string]interface{} {
|
||||
summary := map[string]interface{}{
|
||||
"id": pkg.ID,
|
||||
"registry": pkg.Registry,
|
||||
"name": pkg.Name,
|
||||
"version": pkg.Version,
|
||||
"size": pkg.Size,
|
||||
"checksum_sha256": pkg.ChecksumSHA256,
|
||||
"cached_at": pkg.CachedAt,
|
||||
"last_accessed": pkg.LastAccessed,
|
||||
"download_count": pkg.DownloadCount,
|
||||
}
|
||||
if pkg.ReleaseVersion != "" {
|
||||
summary["release_version"] = pkg.ReleaseVersion
|
||||
}
|
||||
return summary
|
||||
}
|
||||
|
||||
// handleListPackages returns list of cached packages
|
||||
func (a *App) handleListPackages(c fiber.Ctx) error {
|
||||
ctx := c.Context()
|
||||
@@ -119,17 +138,7 @@ func (a *App) handleListPackages(c fiber.Ctx) error {
|
||||
enhancedPackages := make([]map[string]interface{}, 0, len(packagesWithNames))
|
||||
for _, entry := range packagesWithNames {
|
||||
pkg := entry.pkg
|
||||
pkgMap := map[string]interface{}{
|
||||
"id": pkg.ID,
|
||||
"registry": pkg.Registry,
|
||||
"name": pkg.Name,
|
||||
"version": pkg.Version,
|
||||
"size": pkg.Size,
|
||||
"checksum_sha256": pkg.ChecksumSHA256,
|
||||
"cached_at": pkg.CachedAt,
|
||||
"last_accessed": pkg.LastAccessed,
|
||||
"download_count": pkg.DownloadCount,
|
||||
}
|
||||
pkgMap := packageSummary(pkg)
|
||||
|
||||
// Add vulnerability info if scanned
|
||||
if pkg.SecurityScanned {
|
||||
|
||||
@@ -45,11 +45,15 @@ func (a *App) handleVulnerabilities(c fiber.Ctx) error {
|
||||
Str("version", version).
|
||||
Msg("Getting vulnerabilities for package")
|
||||
|
||||
pkg, pkgErr := a.metadata.GetPackage(ctx, registry, name, version)
|
||||
releaseVersion := ""
|
||||
if pkgErr == nil && pkg != nil {
|
||||
releaseVersion = pkg.ReleaseVersion
|
||||
}
|
||||
|
||||
// Get scan result from metadata store
|
||||
scanResult, err := a.metadata.GetScanResult(ctx, registry, name, version)
|
||||
if err != nil {
|
||||
// Check if package exists
|
||||
pkg, pkgErr := a.metadata.GetPackage(ctx, registry, name, version)
|
||||
if pkgErr != nil {
|
||||
return c.Status(fiber.StatusNotFound).JSON(fiber.Map{"error": "package not found"})
|
||||
}
|
||||
@@ -57,9 +61,10 @@ func (a *App) handleVulnerabilities(c fiber.Ctx) error {
|
||||
// Package exists but not scanned yet
|
||||
return c.Status(fiber.StatusOK).JSON(fiber.Map{
|
||||
"package": fiber.Map{
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"release_version": releaseVersion,
|
||||
},
|
||||
"scanned": false,
|
||||
"status": "pending",
|
||||
@@ -89,11 +94,15 @@ func (a *App) handleVulnerabilities(c fiber.Ctx) error {
|
||||
}
|
||||
packageKey := registry + "/" + bypassName + "@" + version
|
||||
packageKeyNoVersion := registry + "/" + bypassName
|
||||
releaseKey := ""
|
||||
if releaseVersion != "" {
|
||||
releaseKey = registry + "/" + bypassName + "@" + releaseVersion
|
||||
}
|
||||
bypassedCVEs := make(map[string]*metadata.CVEBypass)
|
||||
for _, bypass := range bypasses {
|
||||
if bypass.Type == metadata.BypassTypeCVE && bypass.Active {
|
||||
// Check if bypass applies to this package
|
||||
if bypass.AppliesTo == "" || bypass.AppliesTo == packageKey || bypass.AppliesTo == packageKeyNoVersion {
|
||||
if bypass.AppliesTo == "" || bypass.AppliesTo == packageKey || bypass.AppliesTo == packageKeyNoVersion || (releaseKey != "" && bypass.AppliesTo == releaseKey) {
|
||||
bypassedCVEs[strings.ToUpper(bypass.Target)] = bypass
|
||||
}
|
||||
}
|
||||
@@ -141,9 +150,10 @@ func (a *App) handleVulnerabilities(c fiber.Ctx) error {
|
||||
// Build response
|
||||
response := fiber.Map{
|
||||
"package": fiber.Map{
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"release_version": releaseVersion,
|
||||
},
|
||||
"scanned": true,
|
||||
"scanner": scanResult.Scanner,
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/lukaszraczylo/gohoarder/pkg/metadata"
|
||||
)
|
||||
|
||||
func TestPackageSummaryCarriesReleaseVersion(t *testing.T) {
|
||||
withRelease := packageSummary(&metadata.Package{Name: "six", Version: "six-1.17.0.tar.gz", ReleaseVersion: "1.17.0"})
|
||||
if got := withRelease["release_version"]; got != "1.17.0" {
|
||||
t.Errorf("release_version = %v, want 1.17.0", got)
|
||||
}
|
||||
if got := withRelease["version"]; got != "six-1.17.0.tar.gz" {
|
||||
t.Errorf("version = %v, want the cache key", got)
|
||||
}
|
||||
if _, ok := packageSummary(&metadata.Package{Name: "left-pad", Version: "1.3.0"})["release_version"]; ok {
|
||||
t.Error("a row without a release version must not send the field")
|
||||
}
|
||||
}
|
||||
Vendored
+12
-4
@@ -313,12 +313,12 @@ func (m *Manager) getOrFetch(ctx context.Context, registry, name, version string
|
||||
// underlying transport is non-blocking. Only emitted on
|
||||
// the cache-hit path — the miss-then-fetch path is
|
||||
// covered by EventPackageCached emitted from store().
|
||||
m.emit(string(websocket.EventPackageDownloaded), map[string]interface{}{
|
||||
m.emit(string(websocket.EventPackageDownloaded), withReleaseVersion(map[string]interface{}{
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"cache_hit": true,
|
||||
})
|
||||
}, pkg.ReleaseVersion))
|
||||
|
||||
// Data is intentionally nil; Get() opens a fresh reader per caller.
|
||||
return &CacheEntry{
|
||||
@@ -602,13 +602,13 @@ func (m *Manager) store(ctx context.Context, registry, name, version, releaseVer
|
||||
scanStatus = "pending"
|
||||
}
|
||||
}
|
||||
m.emit(string(websocket.EventPackageCached), map[string]interface{}{
|
||||
m.emit(string(websocket.EventPackageCached), withReleaseVersion(map[string]interface{}{
|
||||
"registry": registry,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"size": size,
|
||||
"scan_status": scanStatus,
|
||||
})
|
||||
}, releaseVersion))
|
||||
|
||||
// Scan package if scanner is enabled (run in background to not block cache operations)
|
||||
// Skip scanning metadata entries (index pages, lists, etc.)
|
||||
@@ -853,3 +853,11 @@ func (m *Manager) Close() error {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// withReleaseVersion adds release_version to an event payload when the cache key is not a release version.
|
||||
func withReleaseVersion(payload map[string]interface{}, releaseVersion string) map[string]interface{} {
|
||||
if releaseVersion != "" {
|
||||
payload["release_version"] = releaseVersion
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
package cache
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestWithReleaseVersion(t *testing.T) {
|
||||
with := withReleaseVersion(map[string]interface{}{"version": "six-1.17.0.tar.gz"}, "1.17.0")
|
||||
if with["release_version"] != "1.17.0" || with["version"] != "six-1.17.0.tar.gz" {
|
||||
t.Errorf("payload = %v", with)
|
||||
}
|
||||
if _, ok := withReleaseVersion(map[string]interface{}{"version": "1.3.0"}, "")["release_version"]; ok {
|
||||
t.Error("empty release version must not be sent")
|
||||
}
|
||||
}
|
||||
@@ -977,11 +977,7 @@ func (s *GORMStoreV2) SaveCVEBypass(ctx context.Context, bypass *metadata.CVEByp
|
||||
if bypass.ID != "" {
|
||||
id, err := strconv.ParseInt(bypass.ID, 10, 64)
|
||||
if err == nil {
|
||||
model.ID = id
|
||||
if err := s.db.WithContext(ctx).Save(model).Error; err != nil {
|
||||
return errors.Wrap(err, errors.ErrCodeStorageFailure, "failed to update CVE bypass")
|
||||
}
|
||||
return nil
|
||||
return s.updateCVEBypass(ctx, id, model)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -997,6 +993,35 @@ func (s *GORMStoreV2) SaveCVEBypass(ctx context.Context, bypass *metadata.CVEByp
|
||||
return nil
|
||||
}
|
||||
|
||||
// updateCVEBypass rewrites the editable columns only, so created_at and usage counters survive an edit.
|
||||
func (s *GORMStoreV2) updateCVEBypass(ctx context.Context, id int64, model *CVEBypassModel) error {
|
||||
db := s.db.WithContext(ctx)
|
||||
res := db.Model(&CVEBypassModel{}).Where("id = ?", id).Updates(map[string]interface{}{
|
||||
"type": model.Type,
|
||||
"target": model.Target,
|
||||
"reason": model.Reason,
|
||||
"created_by": model.CreatedBy,
|
||||
"expires_at": model.ExpiresAt,
|
||||
"notify_on_expiry": model.NotifyOnExpiry,
|
||||
"active": model.Active,
|
||||
})
|
||||
if res.Error != nil {
|
||||
return errors.Wrap(res.Error, errors.ErrCodeStorageFailure, "failed to update CVE bypass")
|
||||
}
|
||||
if res.RowsAffected > 0 {
|
||||
return nil
|
||||
}
|
||||
// MySQL reports 0 rows for an unchanged row, so tell that apart from a missing one.
|
||||
var count int64
|
||||
if err := db.Model(&CVEBypassModel{}).Where("id = ?", id).Count(&count).Error; err != nil {
|
||||
return errors.Wrap(err, errors.ErrCodeStorageFailure, "failed to update CVE bypass")
|
||||
}
|
||||
if count == 0 {
|
||||
return errors.NotFound("CVE bypass not found")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetActiveCVEBypasses retrieves all active (non-expired) CVE bypasses
|
||||
func (s *GORMStoreV2) GetActiveCVEBypasses(ctx context.Context) ([]*metadata.CVEBypass, error) {
|
||||
var models []CVEBypassModel
|
||||
|
||||
@@ -91,9 +91,20 @@ func (s *MySQLV2IntegrationTestSuite) TearDownTest() {
|
||||
"registries",
|
||||
}
|
||||
|
||||
for _, table := range tables {
|
||||
s.store.db.Exec("TRUNCATE TABLE " + table)
|
||||
}
|
||||
// FOREIGN_KEY_CHECKS is per connection, so truncate on one pinned connection.
|
||||
err := s.store.db.Connection(func(tx *gorm.DB) error {
|
||||
if err := tx.Exec("SET FOREIGN_KEY_CHECKS = 0").Error; err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Exec("SET FOREIGN_KEY_CHECKS = 1")
|
||||
for _, table := range tables {
|
||||
if err := tx.Exec("TRUNCATE TABLE " + table).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
s.Require().NoError(err)
|
||||
|
||||
// Re-seed default registries after truncate
|
||||
defaultRegistries := []RegistryModel{
|
||||
@@ -124,10 +135,11 @@ func TestMySQLV2IntegrationTestSuite(t *testing.T) {
|
||||
// Test_MySQLV2_SpecificFeatures tests MySQL-specific features
|
||||
func (s *MySQLV2IntegrationTestSuite) Test_MySQLV2_SpecificFeatures() {
|
||||
// Test that we're actually using MySQL
|
||||
var version string
|
||||
err := s.store.db.Raw("SELECT VERSION()").Scan(&version).Error
|
||||
// VERSION() is a bare number ("8.0.46"); the server flavour is in version_comment.
|
||||
var comment string
|
||||
err := s.store.db.Raw("SELECT @@version_comment").Scan(&comment).Error
|
||||
s.NoError(err)
|
||||
s.Contains(version, "MySQL")
|
||||
s.Contains(comment, "MySQL")
|
||||
}
|
||||
|
||||
// Test_MySQLV2_NoPartitioning tests that partition manager is nil for MySQL
|
||||
|
||||
@@ -713,6 +713,36 @@ func (s *GORMStoreV2TestSuite) Test_V2_SaveCVEBypass_Update() {
|
||||
s.NoError(err)
|
||||
}
|
||||
|
||||
// Test_V2_SaveCVEBypass_UpdateKeepsCreatedAt guards against an edit zeroing created_at.
|
||||
func (s *GORMStoreV2TestSuite) Test_V2_SaveCVEBypass_UpdateKeepsCreatedAt() {
|
||||
bypass := &metadata.CVEBypass{
|
||||
Type: metadata.BypassTypeCVE, Target: "CVE-2024-0003", Reason: "before",
|
||||
CreatedBy: "[email protected]", ExpiresAt: time.Now().Add(time.Hour), Active: true,
|
||||
}
|
||||
s.Require().NoError(s.store.SaveCVEBypass(s.ctx, bypass))
|
||||
|
||||
var before CVEBypassModel
|
||||
s.Require().NoError(s.store.db.First(&before, bypass.ID).Error)
|
||||
|
||||
bypass.Reason = "after"
|
||||
s.Require().NoError(s.store.SaveCVEBypass(s.ctx, bypass))
|
||||
|
||||
var after CVEBypassModel
|
||||
s.Require().NoError(s.store.db.First(&after, bypass.ID).Error)
|
||||
s.Equal("after", after.Reason)
|
||||
s.False(after.CreatedAt.IsZero())
|
||||
s.WithinDuration(before.CreatedAt, after.CreatedAt, time.Second)
|
||||
}
|
||||
|
||||
// Test_V2_SaveCVEBypass_UpdateMissing tests that editing an unknown bypass fails.
|
||||
func (s *GORMStoreV2TestSuite) Test_V2_SaveCVEBypass_UpdateMissing() {
|
||||
err := s.store.SaveCVEBypass(s.ctx, &metadata.CVEBypass{
|
||||
ID: "999999", Type: metadata.BypassTypeCVE, Target: "CVE-2024-0004", Reason: "x",
|
||||
CreatedBy: "[email protected]", ExpiresAt: time.Now().Add(time.Hour), Active: true,
|
||||
})
|
||||
s.Error(err)
|
||||
}
|
||||
|
||||
// Test_V2_GetActiveCVEBypasses tests retrieving active CVE bypasses
|
||||
func (s *GORMStoreV2TestSuite) Test_V2_GetActiveCVEBypasses() {
|
||||
// Create active bypass with unique target
|
||||
|
||||
+12
-2
@@ -528,6 +528,15 @@ func normalizeBypassPackageName(registry, name string) string {
|
||||
return name
|
||||
}
|
||||
|
||||
// releaseVersionKey returns "registry/name@release_version" for packages keyed by file name (PyPI), else "".
|
||||
func (m *Manager) releaseVersionKey(ctx context.Context, registry, packageName, version, bypassName string) string {
|
||||
pkg, err := m.metadataStore.GetPackage(ctx, registry, packageName, version)
|
||||
if err != nil || pkg == nil || pkg.ReleaseVersion == "" {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%s/%s@%s", registry, bypassName, pkg.ReleaseVersion)
|
||||
}
|
||||
|
||||
// CheckVulnerabilities checks if a package exceeds vulnerability thresholds
|
||||
func (m *Manager) CheckVulnerabilities(ctx context.Context, registry, packageName, version string) (bool, string, error) {
|
||||
if !m.enabled {
|
||||
@@ -545,10 +554,11 @@ func (m *Manager) CheckVulnerabilities(ctx context.Context, registry, packageNam
|
||||
bypassName := normalizeBypassPackageName(registry, packageName)
|
||||
packageKey := fmt.Sprintf("%s/%s@%s", registry, bypassName, version)
|
||||
packageKeyNoVersion := fmt.Sprintf("%s/%s", registry, bypassName)
|
||||
releaseKey := m.releaseVersionKey(ctx, registry, packageName, version, bypassName)
|
||||
|
||||
for _, bypass := range bypasses {
|
||||
if bypass.Type == metadata.BypassTypePackage && bypass.Active {
|
||||
if bypass.Target == packageKey || bypass.Target == packageKeyNoVersion {
|
||||
if bypass.Target == packageKey || bypass.Target == packageKeyNoVersion || (releaseKey != "" && bypass.Target == releaseKey) {
|
||||
log.Info().
|
||||
Str("package", packageKey).
|
||||
Str("bypass_id", bypass.ID).
|
||||
@@ -605,7 +615,7 @@ func (m *Manager) CheckVulnerabilities(ctx context.Context, registry, packageNam
|
||||
for _, bypass := range bypasses {
|
||||
if bypass.Type == metadata.BypassTypeCVE && bypass.Active {
|
||||
// Check if bypass applies to this package (if AppliesTo is set)
|
||||
if bypass.AppliesTo != "" && bypass.AppliesTo != packageKey && bypass.AppliesTo != packageKeyNoVersion {
|
||||
if bypass.AppliesTo != "" && bypass.AppliesTo != packageKey && bypass.AppliesTo != packageKeyNoVersion && (releaseKey == "" || bypass.AppliesTo != releaseKey) {
|
||||
continue // This bypass doesn't apply to this package
|
||||
}
|
||||
bypassedCVEs[strings.ToUpper(bypass.Target)] = bypass
|
||||
|
||||
@@ -453,3 +453,41 @@ func TestScanner_DisabledReportsNotEnabled(t *testing.T) {
|
||||
assert.False(t, mgr.Enabled())
|
||||
assert.True(t, newTestManager(t, &stubMetadataStore{}).Enabled())
|
||||
}
|
||||
|
||||
// releasePackageStore returns a PyPI-style package whose cache key is a file name.
|
||||
type releasePackageStore struct {
|
||||
*stubBypassStore
|
||||
}
|
||||
|
||||
func (m *releasePackageStore) GetPackage(_ context.Context, _, _, version string) (*metadata.Package, error) {
|
||||
return &metadata.Package{Name: "six", Version: version, ReleaseVersion: "1.17.0"}, nil
|
||||
}
|
||||
|
||||
func TestCheckVulnerabilities_PackageBypassMatchesReleaseVersion(t *testing.T) {
|
||||
const file = "six-1.17.0-py2.py3-none-any.whl"
|
||||
cases := []struct {
|
||||
name string
|
||||
target string
|
||||
blocked bool
|
||||
}{
|
||||
{"release version target", "pypi/[email protected]", false},
|
||||
{"file name target", "pypi/six@" + file, false},
|
||||
{"other release", "pypi/[email protected]", true},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
store := &releasePackageStore{&stubBypassStore{
|
||||
stubMetadataStore: &stubMetadataStore{},
|
||||
bypasses: []*metadata.CVEBypass{{ID: "b1", Type: metadata.BypassTypePackage, Target: tc.target, Active: true}},
|
||||
scan: &metadata.ScanResult{
|
||||
ID: "r", Scanner: "stub", ScannedAt: time.Now(), Status: metadata.ScanStatusVulnerable,
|
||||
Vulnerabilities: []metadata.Vulnerability{{ID: "CVE-1", Severity: "HIGH"}},
|
||||
},
|
||||
}}
|
||||
mgr := newTestManager(t, store)
|
||||
blocked, _, err := mgr.CheckVulnerabilities(context.Background(), "pypi", "six", file)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tc.blocked, blocked)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user