unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
	Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH 11/11] nmweb: handle non-numeric timestamp inputs
Date: Sat, 17 Mar 2018 09:57:18 -0300	[thread overview]
Message-ID: <87bmfmoo5t.fsf@tethera.net> (raw)
In-Reply-To: <20180205041959.22066-12-dkg@fifthhorseman.net>

[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> Without this check, it's trivial to crash the nmweb daemon with a
> ValueError by putting a non-numeric value in befores or afters.

I don't really understand what's going on here enough to comment on this
patch. Perhaps Brian can confirm. I notice currently the web page is
generating URL's like

           https://nmbug.notmuchmail.org/btsmail/search/crash+date%3A%401516161600..%401520910000000

and those in turn are causing internal server errors (at least on the
instance on nmbug.

> ---
>  contrib/notmuch-web/nmweb.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/contrib/notmuch-web/nmweb.py b/contrib/notmuch-web/nmweb.py
> index eaeeb507..21276b66 100755
> --- a/contrib/notmuch-web/nmweb.py
> +++ b/contrib/notmuch-web/nmweb.py
> @@ -65,9 +65,12 @@ class search:
>        befores = web.input(befores=None).befores
>      else:
>        befores = '4294967296' # 2^32
> -    if int(afters) > 0 or int(befores) < 4294967296:
> -      redir = True
> -      terms += ' %s..%s' % (afters, befores)
> +    try:
> +      if int(afters) > 0 or int(befores) < 4294967296:
> +        redir = True
> +        terms += ' %s..%s' % (afters, befores)
> +    except ValueError:
> +      pass
>      if redir:
>        raise web.seeother('/search/%s' % quote_plus(terms))
>      web.header('Content-type', 'text/html')
> -- 
> 2.15.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  reply	other threads:[~2018-03-17 12:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05  4:19 clean up for nmweb/btsmail Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 01/11] nmweb: (pylint) use __future__.absolute_import Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 02/11] nmweb: (pylint) use replace() function directly on string object Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 03/11] nmweb: (pylint) use spaces instead of tabs Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 04/11] nmweb: (pylint) normalize whitespace Daniel Kahn Gillmor
2018-03-17 12:37   ` David Bremner
2018-02-05  4:19 ` [PATCH 05/11] nmweb: (pylint) import built-in modules before third-party modules Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 06/11] nmweb: (pylint) put if clause on separate line from predicate Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 07/11] nmweb: shim for launching from gunicorn Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 08/11] nmweb: use urllib.quote_plus() as plain quote_plus() Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 09/11] nmweb: explicitly move to python3 Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 10/11] nmweb: hide numeric date fields' Daniel Kahn Gillmor
2018-02-05  4:19 ` [PATCH 11/11] nmweb: handle non-numeric timestamp inputs Daniel Kahn Gillmor
2018-03-17 12:57   ` David Bremner [this message]
2018-03-24 23:05 ` clean up for nmweb/btsmail David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmfmoo5t.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=dkg@fifthhorseman.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).