From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 8OvhAMNmUmBGWQAA0tVLHw (envelope-from ) for ; Wed, 17 Mar 2021 20:29:55 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qOk6OMJmUmBdHwAAB5/wlQ (envelope-from ) for ; Wed, 17 Mar 2021 20:29:54 +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 879E818D32 for ; Wed, 17 Mar 2021 21:29:54 +0100 (CET) Received: from localhost ([::1]:49826 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMcnh-0003qS-Nu for larch@yhetil.org; Wed, 17 Mar 2021 16:29:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMcmt-0002Yg-Ie for guix-patches@gnu.org; Wed, 17 Mar 2021 16:29:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60796) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMcmt-000192-9t for guix-patches@gnu.org; Wed, 17 Mar 2021 16:29:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lMcmt-0000rS-7O for guix-patches@gnu.org; Wed, 17 Mar 2021 16:29:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44492] [PATCH v8 06/51] gnu: Add rust-comrak-0.7. Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Mar 2021 20:29:03 +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.16160128953096 (code B ref 44492); Wed, 17 Mar 2021 20:29:03 +0000 Received: (at 44492) by debbugs.gnu.org; 17 Mar 2021 20:28:15 +0000 Received: from localhost ([127.0.0.1]:44071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMcm3-0000nc-UN for submit@debbugs.gnu.org; Wed, 17 Mar 2021 16:28:15 -0400 Received: from mailrelay.tugraz.at ([129.27.2.202]:2488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMcm2-0000nR-MN for 44492@debbugs.gnu.org; Wed, 17 Mar 2021 16:28:11 -0400 Received: from localhost.localdomain (194-96-13-79.adsl.highway.telekom.at [194.96.13.79]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4F11tq1fmnz1LB20 for <44492@debbugs.gnu.org>; Wed, 17 Mar 2021 21:28:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4F11tq1fmnz1LB20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1616012883; bh=ydSyEdMFcya8DJB2DwKafVizhbakW4IoUBcjUPBBmgU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dTFxWValLGWHu/tKy1TB0U1F1Lf2V3vGvwL/VF0u/UVvVvi/5+898VosKH2VCB9ru /Xbna9iVJE4bgh8dNCWvX5wY4CdISqu7cJtlKHuKnrG9XEcp8rz9GGRb6AAcEXbPcs OHnkfDev5SCXUuFwKXcoSiVpmQLS1v1+j6dXb8Fs= From: Leo Prikler Date: Wed, 17 Mar 2021 21:26:50 +0100 Message-Id: <20210317202735.14024-6-leo.prikler@student.tugraz.at> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210317202735.14024-1-leo.prikler@student.tugraz.at> References: <20210317202735.14024-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=1616012994; 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=ydSyEdMFcya8DJB2DwKafVizhbakW4IoUBcjUPBBmgU=; b=F1YnJSQaoef0jecM0xKBHoE+Sf8TclhAI9QD/zGsJ/qu8KiOGNDs/9V4Yh9QPZNai76ZFu v2E6qmjw9fBaNuJgSyU7XRMlWBqhM1sdbnvV/4EdCg6Q/2w49VlCGJM/Qtc4m82JvJIY9y VYPbTDOofby4qoVBpKsAjXt3sTXr5p/mdI3dy4bIloP9qh9Wf+w6YJpJCqgZeBsJt79bjc Q0Smbb3Eo+Iv7l1szX0Qsm7QSpbpJPeO/WTEUZHuvbBlkAJyGq7NZu/VIpxerdB3g88O3K xlcF9peXD4ImoSal9jrQ/SfW2nmMMLMWn8dvPtlT/wt5OWNAJLDnWMOtswUz2w== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616012994; a=rsa-sha256; cv=none; b=StblyFab1iBkjrJY2sw1Rnz/Y1HMjMHhfz9E1mu4tytxRv+EKvKNvHUcKdguAOINVEFHsg JySz9GScYFNGzOvmUYs/Ng9yrOUVlr6vHH45oFbRdJJzeiDwrXz/lbI8PYGJEhylvR4YG4 7OJPcJzPTQvhfSoj6KjnfS5KPNi9NseC8dSSGf5C6I8uezJUBosx46j0GDCl+JiDgGeO8G iZsFszLlhPjPP58bNQ20rkQiXZpm19U4gtQNl9qF6NNamj6SvYPKN2Rle+zywX24bG2C+1 HMCNgqv/ao6qcDGcZ1RXFd5PcGEt7ppiziUmrWWcgJ+kbwaZhKS5WuK5tIc9Wg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=tugraz.at header.s=mailrelay header.b=dTFxWVal; 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=dTFxWVal; 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: 879E818D32 X-Spam-Score: 3.70 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2IwESP83k/Wu * 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 0422beac82..3fb496a771 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 cf015f52fb..7e07a9b8e7 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.31.0