* [bug#64119] [PATCH] services: shepherd: Sanitize 'provision' field.
@ 2023-06-16 20:25 Bruno Victal
2023-06-25 21:08 ` bug#64119: " Ludovic Courtès
2023-06-25 21:44 ` bug#63979: " Ludovic Courtès
0 siblings, 2 replies; 3+ messages in thread
From: Bruno Victal @ 2023-06-16 20:25 UTC (permalink / raw)
To: 64119; +Cc: Bruno Victal, ludo, attila
Fixes <https://issues.guix.gnu.org/63979>.
* gnu/services/shepherd.scm (<shepherd-service>)[provision]: Set field
sanitizer.
(sanitize-shepherd-service-provision): New procedure.
---
gnu/services/shepherd.scm | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm
index de40454f7d..1333067817 100644
--- a/gnu/services/shepherd.scm
+++ b/gnu/services/shepherd.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2018 Carlo Zancanaro <carlo@zancanaro.id.au>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +22,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu services shepherd)
+ #:use-module (guix diagnostics)
#:use-module (guix ui)
#:use-module (guix sets)
#:use-module (guix gexp)
@@ -186,12 +188,21 @@ (define %default-modules
((guix build utils) #:hide (delete))
(guix build syscalls)))
+(define (sanitize-shepherd-service-provision expr)
+ (match expr
+ (((? symbol?) ..1) expr)
+ (_
+ (raise
+ (formatted-message
+ (G_ "'provision' must be a non-empty list of symbols"))))))
+
(define-record-type* <shepherd-service>
shepherd-service make-shepherd-service
shepherd-service?
(documentation shepherd-service-documentation ;string
(default "[No documentation.]"))
- (provision shepherd-service-provision) ;list of symbols
+ (provision shepherd-service-provision ;list of symbols
+ (sanitize sanitize-shepherd-service-provision))
(requirement shepherd-service-requirement ;list of symbols
(default '()))
(one-shot? shepherd-service-one-shot? ;Boolean
base-commit: 31336e9f5d68512a9c1c6826bce9f17c892a2125
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.
2023-06-16 20:25 [bug#64119] [PATCH] services: shepherd: Sanitize 'provision' field Bruno Victal
@ 2023-06-25 21:08 ` Ludovic Courtès
2023-06-25 21:44 ` bug#63979: " Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2023-06-25 21:08 UTC (permalink / raw)
To: Bruno Victal; +Cc: attila, 64119-done
Hi Bruno,
Bruno Victal <mirai@makinata.eu> skribis:
> Fixes <https://issues.guix.gnu.org/63979>.
>
> * gnu/services/shepherd.scm (<shepherd-service>)[provision]: Set field
> sanitizer.
> (sanitize-shepherd-service-provision): New procedure.
Applied, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#63979: bug#64119: [PATCH] services: shepherd: Sanitize 'provision' field.
2023-06-16 20:25 [bug#64119] [PATCH] services: shepherd: Sanitize 'provision' field Bruno Victal
2023-06-25 21:08 ` bug#64119: " Ludovic Courtès
@ 2023-06-25 21:44 ` Ludovic Courtès
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2023-06-25 21:44 UTC (permalink / raw)
To: Bruno Victal; +Cc: attila, 64119, 63979-done
Bruno Victal <mirai@makinata.eu> skribis:
> +(define (sanitize-shepherd-service-provision expr)
> + (match expr
> + (((? symbol?) ..1) expr)
> + (_
> + (raise
> + (formatted-message
> + (G_ "'provision' must be a non-empty list of symbols"))))))
Actually I figured we could do as in other areas of the code in a way
that reports error location, so I came up with a different patch.
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-25 21:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-16 20:25 [bug#64119] [PATCH] services: shepherd: Sanitize 'provision' field Bruno Victal
2023-06-25 21:08 ` bug#64119: " Ludovic Courtès
2023-06-25 21:44 ` bug#63979: " Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.