diff options
Diffstat (limited to 'tests/substitute.scm')
| -rw-r--r-- | tests/substitute.scm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/substitute.scm b/tests/substitute.scm index 6837e7e868e..8f32bfa7281 100644 --- a/tests/substitute.scm +++ b/tests/substitute.scm | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> | 2 | ;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org> |
| 3 | ;;; Copyright © 2014-2015, 2017-2019, 2021-2023 Ludovic Courtès <ludo@gnu.org> | 3 | ;;; Copyright © 2014-2015, 2017-2019, 2021-2023, 2026 Ludovic Courtès <ludo@gnu.org> |
| 4 | ;;; | 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; | 6 | ;;; |
| @@ -333,6 +333,30 @@ Deriver: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo.drv") | |||
| 333 | (lambda () | 333 | (lambda () |
| 334 | (guix-substitute "--query"))))))))) | 334 | (guix-substitute "--query"))))))))) |
| 335 | 335 | ||
| 336 | (test-equal "query narinfo that contains invalid store path" | ||
| 337 | ;; The signature covers the StorePath/NarHash/References tuple, so it is | ||
| 338 | ;; valid, but the 'StorePath' field is invalid (contains forbidden | ||
| 339 | ;; characters). | ||
| 340 | "" | ||
| 341 | |||
| 342 | (let ((prefix (string-append "StorePath: " (%store-prefix) | ||
| 343 | "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo/../../../etc/passwd | ||
| 344 | NarHash: sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | ||
| 345 | References: bar baz\n"))) | ||
| 346 | (with-narinfo (string-append prefix | ||
| 347 | "Signature: " (signature-field prefix) " | ||
| 348 | URL: example.nar | ||
| 349 | Compression: none | ||
| 350 | NarSize: 42 | ||
| 351 | Deriver: foo.drv") | ||
| 352 | (string-trim-both | ||
| 353 | (with-output-to-string | ||
| 354 | (lambda () | ||
| 355 | (with-input-from-string (string-append "have " (%store-prefix) | ||
| 356 | "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") | ||
| 357 | (lambda () | ||
| 358 | (guix-substitute "--query"))))))))) | ||
| 359 | |||
| 336 | (test-equal "query narinfo signed with authorized key" | 360 | (test-equal "query narinfo signed with authorized key" |
| 337 | (string-append (%store-prefix) "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") | 361 | (string-append (%store-prefix) "/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-foo") |
| 338 | 362 | ||
