From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id INukAEWmT2CeQAAA0tVLHw (envelope-from ) for ; Mon, 15 Mar 2021 18:24:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id yFcMOESmT2BWTwAA1q6Kng (envelope-from ) for ; Mon, 15 Mar 2021 18:24:04 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 84E6EACBD for ; Mon, 15 Mar 2021 19:24:04 +0100 (CET) Received: from localhost ([::1]:42322 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLrsp-0001gN-Kn for larch@yhetil.org; Mon, 15 Mar 2021 14:24:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLrUe-0007ZY-Sk for guix-patches@gnu.org; Mon, 15 Mar 2021 13:59:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53568) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLrUe-0007Dw-Ih for guix-patches@gnu.org; Mon, 15 Mar 2021 13:59:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLrUe-0004Rb-GE for guix-patches@gnu.org; Mon, 15 Mar 2021 13:59:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44492] [PATCH v7 06/51] gnu: Add rust-comrak-0.7. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Mar 2021 17:59: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.161583114217046 (code B ref 44492); Mon, 15 Mar 2021 17:59:04 +0000 Received: (at 44492) by debbugs.gnu.org; 15 Mar 2021 17:59:02 +0000 Received: from localhost ([127.0.0.1]:36868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLrUY-0004QJ-O3 for submit@debbugs.gnu.org; Mon, 15 Mar 2021 13:59:02 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:31558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLrUV-0004Q1-Ov for 44492@debbugs.gnu.org; Mon, 15 Mar 2021 13:58:56 -0400 Received: from localhost.localdomain (217-149-164-20.nat.highway.telekom.at [217.149.164.20]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Dzkgc6CwDz3xC9 for <44492@debbugs.gnu.org>; Mon, 15 Mar 2021 18:58:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1615831132; bh=BANHk/7UjZAO/b0D9GLAqC2uMAXluMt1uvjRrXkfN3A=; h=From:To:Subject:Date:In-Reply-To:References; b=Oq13y2hSM3ertx44yPbWfBoxvnNZIAbjYim9uIU0ZkJ58oHDV6uu4AZVwNYWQXdcQ ZnvOFHDa3tKt3yy/3WYn5RlPLNsRVg/wPpTuNyZ6oBJzctXgItwnEhlhKXOVw9SE2+ bnCEiCoDKrqR+dLAGgay0PK4NARtzpOkElLyZcXU= From: Leo Prikler Date: Mon, 15 Mar 2021 18:57:53 +0100 Message-Id: <20210315175838.1931-6-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315175838.1931-1-leo.prikler@student.tugraz.at> References: <20210315175838.1931-1-leo.prikler@student.tugraz.at> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615832644; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BANHk/7UjZAO/b0D9GLAqC2uMAXluMt1uvjRrXkfN3A=; b=iB2o+JlboX3MqoFrwUEoyqga41p0DYd4F/qZ8nH9fLu5ArTzqX9CAowe1W59fIMAeZlTiF ciN3RAUX4TPrao8tBYA5bMGY7eWiKHrsBlMKknfQ8gu9NQbw7B9RaHXI9gKmb/K5lpzkl/ gfg4FESR34JVsEBoBF9ai5lwvicVdvhCkrW8ZqvaLTiE6PtamS95CHAHtwZ5NxHsXin7mi uVeim/yGx4lxWjluaoJAnDOLTETrkf4Jt2+rJmGUHHvD2RI6pepNEyOHnPllb8vVm+rrR/ vcmXbt2UdYZxD1vGprZh8Fe9xrih77miNlfE4JhwocPxJY6gvfsVV67kR06PGg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615832644; a=rsa-sha256; cv=none; b=BsATRS+0AA8PlrTxPXQzNW3kFJXyu4SxoqU3aDDyc2k3zYo4CTD4lGvL0rnPgd9BbeBQnA 7cn4cf6JCZNa4fPz29XMxMiP7D1C+ipZGBqbt0T6YFHe1nluh9HdE7iwvUIPRXnbl1lSku OFJ8hzTDiz1Qj9PT6Sfrer0YiQQb0zxP7wUYY/o2h5ZJWi3E4DZUFzqiHIv5sENQD4YNcD MupKZM0jyjbdKnSFVqQ0ipaXC0sc4BTUhLfqFHEwl2/eMH4+k0ZZiBRspVQLX6hb+48wV3 Lar2AEdJX6NGedzJMHOlXOIPhvCjr32+dtThn1b3W2muLwrWoJv1whQUOctXIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=Oq13y2hS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 3.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=Oq13y2hS; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 84E6EACBD X-Spam-Score: 3.70 X-Migadu-Scanner: scn0.migadu.com X-TUID: nQ4TZT+PqnTD * 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 cf8849cf59..d07aaeb90b 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1642,6 +1642,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 91bcbacfae..17ac4a08b4 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -7766,6 +7766,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 -- 2.30.2