From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] xbps-src: pre-pkg: allow only white-listed directories.
Date: Wed, 20 May 2020 01:23:22 +0200 [thread overview]
Message-ID: <20200519232322.M6g_tFm5n1IhOMAat71rclstZBqYGDizynEkJucyIAk@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-22035@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
There is an updated pull request by sgn against master on the void-packages repository
https://github.com/sgn/void-packages pkg-lint-allow-only-whitelist
https://github.com/void-linux/void-packages/pull/22035
xbps-src: pre-pkg: allow only white-listed directories.
A patch file from https://github.com/void-linux/void-packages/pull/22035.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pkg-lint-allow-only-whitelist-22035.patch --]
[-- Type: text/x-diff, Size: 3152 bytes --]
From fa66e6ec74f1a91888a4039b0ad57d606d32a35c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx+sgn@gmail.com>
Date: Sun, 17 May 2020 18:42:43 +0700
Subject: [PATCH 1/2] xbps-src: pre-pkg: allow only white-listed directories.
---
common/hooks/pre-pkg/99-pkglint.sh | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh
index d2c281e39db..9410d0847ef 100644
--- a/common/hooks/pre-pkg/99-pkglint.sh
+++ b/common/hooks/pre-pkg/99-pkglint.sh
@@ -21,13 +21,37 @@ hook() {
fi
done
- for f in sys dev home root run var/run tmp usr/local destdir; do
+ for f in var/run usr/local; do
if [ -d ${PKGDESTDIR}/${f} ]; then
msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
error=1
fi
done
+ for f in "$PKGDESTDIR"/*; do
+ f="${f##*/}"
+ case "$f" in
+ '*') # The filename is exactly '*'
+ if [ -f "${PKGDESTDIR}/*" ]; then
+ msg_red "${pkgver}: File /${f} is not allowed\n"
+ error=1
+ fi
+ # Empty meta package is fine
+ ;;
+ lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv) ;;
+ INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides)
+ if [ ! -f "${PKGDESTDIR}/$f" ]; then
+ msg_red "${pkgver}: /${f} is not allowed\n"
+ error=1
+ fi
+ ;;
+ *)
+ msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
+ error=1
+ ;;
+ esac
+ done
+
# Check that configuration files really exist.
for f in $(expand_destdir "${conf_files}"); do
if [ ! -f "${PKGDESTDIR}/${f}" ]; then
From 50e3f4b97088eba6c24cdb984ba1a7f83f1f1156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx+sgn@gmail.com>
Date: Wed, 20 May 2020 06:12:02 +0700
Subject: [PATCH 2/2] fixup! xbps-src: pre-pkg: allow only white-listed
directories.
---
common/hooks/pre-pkg/99-pkglint.sh | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh
index 9410d0847ef..472a7f634b7 100644
--- a/common/hooks/pre-pkg/99-pkglint.sh
+++ b/common/hooks/pre-pkg/99-pkglint.sh
@@ -35,8 +35,11 @@ hook() {
if [ -f "${PKGDESTDIR}/*" ]; then
msg_red "${pkgver}: File /${f} is not allowed\n"
error=1
+ elif [ "$build_style" != "meta" ]; then
+ # Forbid empty packages unless build_style=meta
+ msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
+ error=1
fi
- # Empty meta package is fine
;;
lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv) ;;
INSTALL|INSTALL.msg|REMOVE|REMOVE.msg|rdeps|shlib-requires|shlib-provides)
@@ -113,14 +116,6 @@ hook() {
fi
done
- # Forbid empty packages unless build_style=meta
- if [ "$build_style" != "meta" ]; then
- if [ "$(find $PKGDESTDIR/* -maxdepth 1 -type d 2>/dev/null)" = "" ]; then
- msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
- error=1
- fi
- fi
-
if [ $error -gt 0 ]; then
msg_error "${pkgver}: cannot continue with installation!\n"
fi
next prev parent reply other threads:[~2020-05-19 23:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-17 11:44 [PR PATCH] " sgn
2020-05-17 12:08 ` [PR PATCH] [Updated] " sgn
2020-05-19 22:50 ` sgn
2020-05-19 22:56 ` Chocimier
2020-05-19 23:07 ` [PR PATCH] [Updated] " sgn
2020-05-19 23:12 ` sgn
2020-05-19 23:12 ` sgn
2020-05-19 23:15 ` jnbr
2020-05-19 23:19 ` q66
2020-05-19 23:23 ` sgn [this message]
2020-05-19 23:26 ` sgn
2020-05-19 23:27 ` sgn
2020-05-21 15:33 ` [PR PATCH] [Updated] " sgn
2020-05-22 17:35 ` Chocimier
2020-05-23 11:48 ` [PR PATCH] [Updated] " sgn
2020-05-23 11:56 ` sgn
2020-05-31 2:11 ` [PR PATCH] [Merged]: " sgn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200519232322.M6g_tFm5n1IhOMAat71rclstZBqYGDizynEkJucyIAk@z \
--to=sgn@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).