From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 4GcbLiiVSmAMeAAA0tVLHw (envelope-from ) for ; Thu, 11 Mar 2021 22:09:44 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qIbjKSiVSmCLIgAAB5/wlQ (envelope-from ) for ; Thu, 11 Mar 2021 22:09:44 +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 aspmx2.migadu.com (Postfix) with ESMTPS id 605A118288 for ; Thu, 11 Mar 2021 23:09:44 +0100 (CET) Received: from localhost ([::1]:39118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lKTV1-0003p3-Il for larch@yhetil.org; Thu, 11 Mar 2021 17:09:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lKTUP-000366-0I for guix-patches@gnu.org; Thu, 11 Mar 2021 17:09:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:43563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lKTUO-0007oz-Oz for guix-patches@gnu.org; Thu, 11 Mar 2021 17:09:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lKTUO-0005g1-K2 for guix-patches@gnu.org; Thu, 11 Mar 2021 17:09:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#44492] [PATCH v4 06/47] gnu: Add rust-comrak-0.7. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Mar 2021 22:09: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.161550053921740 (code B ref 44492); Thu, 11 Mar 2021 22:09:04 +0000 Received: (at 44492) by debbugs.gnu.org; 11 Mar 2021 22:08:59 +0000 Received: from localhost ([127.0.0.1]:55097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKTUI-0005eZ-LG for submit@debbugs.gnu.org; Thu, 11 Mar 2021 17:08:59 -0500 Received: from mailrelay.tugraz.at ([129.27.2.202]:40067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lKTUG-0005eM-VE for 44492@debbugs.gnu.org; Thu, 11 Mar 2021 17:08:57 -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 4DxNPy1WGnz3wZ9 for <44492@debbugs.gnu.org>; Thu, 11 Mar 2021 23:08:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1615500534; bh=q2yI11rPh9Q5aarERB6fNUZMIY9GNqgwGB4Dh8fCc+I=; h=From:To:Subject:Date:In-Reply-To:References; b=VtnmcD6bW2oq32zdWh9GcdCxjR/EwsSb1Q9jOG9tYXtDIhupeGje13A8LDZhApvaC wZpxcDT5fQD5xkDVPH9KCgQ0J6SqCdo7ZinmYPQF7tAgAEQAUiTTjfWToC0uRfSqsR DpcaPzHbAJgFA+NcVxmdlFDMRcnAfmAnfkSmBVYA= From: Leo Prikler Date: Thu, 11 Mar 2021 23:07:15 +0100 Message-Id: <20210311220756.23132-6-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210311220756.23132-1-leo.prikler@student.tugraz.at> References: <20210311220756.23132-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=1615500584; 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=q2yI11rPh9Q5aarERB6fNUZMIY9GNqgwGB4Dh8fCc+I=; b=OO1Zhy3cMvTx5lesxyyQb3gHjIrGbCX+4+qG5d4SP4oAiq34KF92YAdqdXtM/FNmwob2RC FZiVQ6CXmElV4o1KpJQUoaxcpTA27+MUymyHxth3K1m78u87sMB07afIxupr6L6my+H0ox 5vosCFdmNpqWvk621PKBKkD/BEP/8RyCAvt6CZjgKKjpKIymIFsdezajJhP1nFhNSXDk2z jyRrfiJ9PFr60BRlwFlaiftOqe6d0gc32a0O7+tV2emJ4vPxGlt2pVBnDkPHyzkdtpdVx5 ngESkqSAfhxro1j4pimur73QOf4vRhsCUFjH3V+uV+XPrPKzSS8EIVY1ltk3iw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615500584; a=rsa-sha256; cv=none; b=pKtQDlrsrPl8MmRXJ+fbgiH6um25XmmRMX9J/m3fHCDxw0B6465dtnO/uB1hXfh5xIAwOF EoTE2JgE/LWH6F3GHTabemLgoDZeitI1V3u39TMcVqxAzJc44rejmXqBojav8PqT/kyfgW HPXv8dFS1GMIiV236oH+XTxEfV2+S8UF++TGfJ6MaD3cmp3nNu8fJQaFIk4mC2yFrQka6E SXcrzi7OcH8a6msqjpyEgnJsPEuCFycJXPRPzCnLCujZ66tld1G2cJho3GKN93mhRIORw9 YfK246hqVWWh3J/U0XBp8A1s5xCeP+NUnY3BtESzAAa8aDPbtV0N/NKxEzhNhw== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=VtnmcD6b; spf=pass (aspmx2.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.71 Authentication-Results: aspmx2.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=VtnmcD6b; dmarc=fail reason="SPF not aligned (relaxed)" header.from=student.tugraz.at (policy=none); spf=pass (aspmx2.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: 605A118288 X-Spam-Score: 3.71 X-Migadu-Scanner: scn0.migadu.com X-TUID: yJCso/EsQgm6 * 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 39037d3499..b879131131 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1608,6 +1608,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 162617c7aa..77f88dff21 100644 --- a/gnu/packages/crates-io.scm +++ b/gnu/packages/crates-io.scm @@ -7655,6 +7655,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.1