summaryrefslogtreecommitdiffstats
path: root/bin/gen-DSA
diff options
context:
space:
mode:
authorRaphael Geissert <geissert@debian.org>2012-11-01 01:32:50 +0000
committerRaphael Geissert <geissert@debian.org>2012-11-01 01:32:50 +0000
commit393df97ba0a37da6e6b1b5fd3a2a6a82c7c50329 (patch)
treec62c73729f64b2e81ddf457ab99cd488a446dc32 /bin/gen-DSA
parentd1843d0dcb6e7bba657cbfa58fb641211f420ef9 (diff)
check and automagically cleanup the vulnerability summary
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@20429 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'bin/gen-DSA')
-rwxr-xr-xbin/gen-DSA53
1 files changed, 52 insertions, 1 deletions
diff --git a/bin/gen-DSA b/bin/gen-DSA
index 565f01f8c0..bc2287b1a2 100755
--- a/bin/gen-DSA
+++ b/bin/gen-DSA
@@ -77,6 +77,48 @@ check_spelling() {
fi
}
+cleanup_vulnerability() {
+ lastw=
+ add_space=false
+
+ for word in $@; do
+ if [ -n "$lastw" ]; then
+ add_space=true
+ fi
+
+ case $word in
+ D[Oo]S)
+ word="denial of service"
+ ;;
+ CSRF)
+ word="cross-site request forgery"
+ ;;
+ XSS)
+ word="cross-site scripting"
+ ;;
+ site)
+ if [ "$lastw" = cross ]; then
+ add_space=false
+ word="-site"
+ fi
+ ;;
+ [Nn]ull)
+ word=NULL
+ ;;
+ out-of-bound|bound)
+ word="${word}s"
+ ;;
+ esac
+
+ if $add_space; then
+ printf ' '
+ fi
+
+ lastw="$word"
+ printf '%s' "$word"
+ done
+}
+
setvar() {
local var="$1" value="$2"
@@ -106,7 +148,7 @@ if printf '%s' "$1" | grep -Eq '^(DSA-|)[0-9]+(-[0-9]+|)$'; then
fi
PACKAGE="$(tolower "$1")"
-VULNERABILITY="$2"
+VULNERABILITY="$(cleanup_vulnerability "$2")"
CVE="$(toupper "$3")"
BUGNUM="${4#\#}"
REFERENCES=0
@@ -162,6 +204,15 @@ if dsa_exists "$DSAID"; then
exit 1
fi
+if echo "$VULNERABILITY" | grep -iq vulnerab; then
+ warn "redundant vulnerability adjective/noun in vuln. summary" >&2
+fi
+
+if [ "$VULNERABILITY" = remote ] || [ "$VULNERABILITY" = local ]; then
+ error "'$VULNERABILITY' is not a vulnerability summary" >&2
+ exit 1
+fi
+
echo "$VULNERABILITY" | check_spelling |
while read word; do
# Frequent exceptions:

© 2014-2024 Faster IT GmbH | imprint | privacy policy