From patchwork Sun Feb 28 18:46:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Prikler X-Patchwork-Id: 27337 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8721B27BC4D; Sun, 28 Feb 2021 18:48:45 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F1B1527BC4C for ; Sun, 28 Feb 2021 18:48:44 +0000 (GMT) Received: from localhost ([::1]:45608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGR7U-0006Zt-3c for patchwork@mira.cbaines.net; Sun, 28 Feb 2021 13:48:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGR6q-0006MD-Hv for guix-patches@gnu.org; Sun, 28 Feb 2021 13:48:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lGR6q-0007tG-9w for guix-patches@gnu.org; Sun, 28 Feb 2021 13:48:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lGR6q-0003BA-Ap for guix-patches@gnu.org; Sun, 28 Feb 2021 13:48:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44492] [PATCH v2 07/52] gnu: Add rust-comrak-0.7. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Feb 2021 18:48:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44492 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: moreinfo To: 44492@debbugs.gnu.org Received: via spool by 44492-submit@debbugs.gnu.org id=B44492.161453807412140 (code B ref 44492); Sun, 28 Feb 2021 18:48:04 +0000 Received: (at 44492) by debbugs.gnu.org; 28 Feb 2021 18:47:54 +0000 Received: from localhost ([127.0.0.1]:47227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGR6f-00039e-MT for submit@debbugs.gnu.org; Sun, 28 Feb 2021 13:47:54 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:14330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGR6T-000396-Qn for 44492@debbugs.gnu.org; Sun, 28 Feb 2021 13:47:42 -0500 Received: from localhost.localdomain (217-149-164-20.nat.highway.telekom.at [217.149.164.20]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4DpXSq3GTSz3xdy for <44492@debbugs.gnu.org>; Sun, 28 Feb 2021 19:47:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1614538059; bh=tZoBYoIokB4J3ukuQQmfmrp+7IBEFRSbJ0noHdyWOdY=; h=From:To:Subject:Date:In-Reply-To:References; b=Y1Wcpn+YEg5KVt0mXsBBUqRKnNHjC8zBb7FCYRu1F1viwDk2jCtPx/p2gJlr6qzCC p3AVaZWE0Rog8GgT6v1TTz9NzLOiSgRDZ60g3X8zG4Bopu4dgDtAqFnm+CuUyZ1TJW FdvnW3kip6D8k0583tMIzhD/SaFBAdmm68Add79E= From: Leo Prikler Date: Sun, 28 Feb 2021 19:46:53 +0100 Message-Id: <20210228184655.5159-8-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.1 In-Reply-To: <87sg5lhemw.fsf@nicolasgoaziou.fr> References: <87sg5lhemw.fsf@nicolasgoaziou.fr> MIME-Version: 1.0 X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it here. * gnu/packages/crates-io.scm (rust-comrak-0.7): New variable. --- gnu/local.mk | 1 + gnu/packages/crates-io.scm | 44 +++++++++++++++++++ .../rust-comrak-0.7-rustsec-2021-0026.patch | 41 +++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 gnu/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch diff --git a/gnu/local.mk b/gnu/local.mk index 83753e6b4e..4f6b85c69c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1604,6 +1604,7 @@ dist_patch_DATA = \ %D%/packages/patches/rust-1.45-linker-locale.patch \ %D%/packages/patches/rust-1.48-linker-locale.patch \ %D%/packages/patches/rust-bootstrap-stage0-test.patch \ + %D%/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch \ %D%/packages/patches/rust-coresimd-doctest.patch \ %D%/packages/patches/rust-ndarray-remove-blas-src-dep.patch \ %D%/packages/patches/rust-nettle-disable-vendor.patch \ diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm index e40862aa70..2c39c8249e 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -7601,6 +7601,50 @@ harness.") ("rust-rustc-serialize" ,rust-rustc-serialize-0.3) ("rust-tempdir" ,rust-tempdir-0.3)))))) +(define-public rust-comrak-0.7 + (package + (name "rust-comrak") + (version "0.7.0") + (source + (origin + (method url-fetch) + (uri (crate-uri "comrak" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "07026j0ghwgv5z61fc4l893wwc30krxpsy487rb91wkcag65hw71")) + (patches + (search-patches + "rust-comrak-0.7-rustsec-2021-0026.patch")) + (modules '((guix build utils))) + (snippet + '(begin + (substitute* "src/tests.rs" + (("data:(png|jpeg|gif|webp)" all what) + (string-append "data:image/" what))) + #t)))) + (build-system cargo-build-system) + (arguments + `(#:cargo-inputs + (("rust-clap" ,rust-clap-2) + ("rust-entities" ,rust-entities-1) + ("rust-lazy-static" ,rust-lazy-static-1) + ("rust-pest" ,rust-pest-2) + ("rust-pest-derive" ,rust-pest-derive-2) + ("rust-regex" ,rust-regex-1) + ("rust-twoway" ,rust-twoway-0.2) + ("rust-typed-arena" ,rust-typed-arena-1) + ("rust-unicode-categories" + ,rust-unicode-categories-0.1)) + #:cargo-development-inputs + (("rust-timebomb" ,rust-timebomb-0.1)))) + (home-page "https://github.com/kivikakk/comrak") + (synopsis "Markdown parser and formatter") + (description "This package provides a parser and formatter for Github +Flavored Markdown, that is compatible with CommonMark.") + (license license:bsd-2))) + (define-public rust-concurrent-queue-1 (package (name "rust-concurrent-queue") diff --git a/gnu/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch b/gnu/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch new file mode 100644 index 0000000000..9a74b7b971 --- /dev/null +++ b/gnu/packages/patches/rust-comrak-0.7-rustsec-2021-0026.patch @@ -0,0 +1,41 @@ +From 285e9647c6d2f90d8cb7af543b14c986a8efa631 Mon Sep 17 00:00:00 2001 +From: Asherah Connor +Date: Fri, 12 Feb 2021 21:15:29 +1100 +Subject: [PATCH] SECURITY: match unsafe prefixes case-insensitively + +Many thanks to Kouhei Morita for reporting this. + +Co-authored-by: Kouhei Morita +--- + src/lexer.pest | 2 +- + src/tests.rs | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 147 insertions(+), 1 deletion(-) + +diff --git a/src/lexer.pest b/src/lexer.pest +index e97647c..7f6cd3f 100644 +--- a/src/lexer.pest ++++ b/src/lexer.pest +@@ -55,4 +55,4 @@ table_start = { "|"? ~ table_marker ~ ("|" ~ table_marker)* ~ "|"? ~ table_space + table_cell_end = { "|" ~ table_spacechar* ~ table_newline? } + table_row_end = { table_spacechar* ~ table_newline } + +-dangerous_url = { "data:" ~ !("png" | "gif" | "jpeg" | "webp") | "javascript:" | "vbscript:" | "file:" } ++dangerous_url = { ^"data:" ~ !(^"image/" ~ (^"png" | ^"gif" | ^"jpeg" | ^"webp")) | ^"javascript:" | ^"vbscript:" | ^"file:" } +diff --git a/src/tests.rs b/src/tests.rs +index c61a493..5f3e0cc 100644 +--- a/src/tests.rs ++++ b/src/tests.rs +@@ -998,3 +998,11 @@ fn description_lists() { + ), + ); + } ++ ++#[test] ++fn case_insensitive_safety() { ++ html( ++ "[a](javascript:a) [b](Javascript:b) [c](jaVascript:c) [d](data:xyz) [e](Data:xyz) [f](vbscripT:f) [g](FILE:g)\n", ++ "

a b c d e f g

\n", ++ ); ++} +-- +2.30.1