Commit Graph

460 Commits (a9aa7c1c083b06241f418648ea59bbeda4272cad)

Author SHA1 Message Date
Simon McVittie 4729ff0812 Exclude working directory from library path (CVE-2016-1238)
Current Perl versions put '.' at the end of the library search path
@INC, although this will be fixed in a future Perl release. This means
that when software loads an optionally-present module, it will be
looked for in the current working directory before giving up. An
attacker could use this to execute arbitrary Perl code from ikiwiki's
current working directory.

Removing '.' from the library search path in Perl is the correct
fix for this vulnerability, but is not trivial to do due to
backwards-compatibility concerns. Mitigate this (even if ikiwiki is run
with a vulnerable Perl version) by explicitly removing '.' from the
search path, and instead looking for ikiwiki's own modules relative
to the absolute path of the executable when run from the source
directory.

In tests that specifically want to use the current working directory,
use "-I".getcwd instead of "-I." so we use its absolute path, which
is immune to the removal of ".".
2016-07-28 09:50:21 +01:00
Simon McVittie 5f6f9a1bea Wrapper: allocate new environment dynamically
Otherwise, if third-party plugins extend newenviron by more than
3 entries, we could overflow the array. It seems unlikely that any
third-party plugin manipulates newenviron in practice, so this
is mostly theoretical. Just in case, I have deliberately avoided
using "i" as the variable name, so that any third-party plugin
that was manipulating newenviron directly will now result in the
wrapper failing to compile.

I have not assumed that realloc(NULL, ...) works as an equivalent of
malloc(...), in case there are still operating systems where that
doesn't work.
2016-05-11 09:18:14 +01:00
Simon McVittie 6879e37828 img test: exercise upper-case extensions for image files 2016-05-09 21:53:10 +01:00
Amitai Schlair e24e6fed62 Fix spelling of "ratio" in test. 2016-05-08 18:31:02 -04:00
Simon McVittie 47b180e35f img: make img_allowed_formats case-insensitive 2016-05-07 23:22:52 +01:00
Joey Hess 21b9b9e306 update test suite for svg passthrough by img directive
Remove build dependency libmagickcore-6.q16-2-extra which was only there
for this test.
2016-05-06 06:58:56 +01:00
Simon McVittie 170cd41489 img: check magic number before giving common formats to ImageMagick
This mitigates CVE-2016-3714 and similar vulnerabilities by
avoiding passing obviously-wrong input to ImageMagick decoders.
2016-05-05 23:43:50 +01:00
Simon McVittie 545a7bbbf0 img: restrict to JPEG, PNG and GIF images by default
This mitigates CVE-2016-3714. Wiki administrators who know that they
have prevented arbitrary code execution via other formats can re-enable
the other formats if desired.
2016-05-05 23:43:50 +01:00
Amitai Schlair b4222955b4 Fix CVS tests by uninverting $installed (cdfb4ab). 2016-02-18 23:25:54 -05:00
Simon McVittie 7aca0d40a3 Compose relative URLs in RSS feeds correctly
If the relative link from the (page generating the) RSS to the target
would start with "./" or "../", just concatenating it with the URL to
the directory containing the RSS is not sufficient. Go via
URI::new_abs to fix this.
2016-01-21 08:40:14 +00:00
Simon McVittie 02a1aa4e49 Don't fail to syslog if the wiki name contains %s
This is a corner case spotted while fixing UTF-8 syslogging.
2016-01-21 07:33:41 +00:00
Simon McVittie b8dbb48fdc Force log messages to be bytestrings
Sys::Syslog is not UTF-8-literate.
2016-01-21 07:33:41 +00:00
Simon McVittie b0627aef10 img test: use the right filenames when testing that deletion occurs
Also use a less misleading name for the sample SVG: it is no longer empty.
Since commit 105f285a it has contained a blue square.
2016-01-19 11:24:18 +00:00
Simon McVittie 5dceeb28d8 img test: skip testing PDFs if unsupported 2016-01-19 11:24:18 +00:00
Simon McVittie b199349ffd Merge remote-tracking branch 'smcv/ready/limit' 2015-11-30 20:55:34 +00:00
Simon McVittie 67906ded04 Add a test for unconfigured git identity 2015-11-30 20:46:58 +00:00
Simon McVittie d90002b8d7 tests: consistently use done_testing instead of no_plan 2015-11-30 18:26:23 +00:00
Simon McVittie 6b322448ca t/img.t: do not spuriously skip 2015-11-30 18:26:23 +00:00
Simon McVittie cdfb4ab1a3 Run autopkgtest tests using autodep8 and the pkg-perl team's infrastructure 2015-11-30 18:26:22 +00:00
Amitai Schlair 09916a90ed Fix [[!meta name=foo]] by closing the open quote. 2015-08-22 22:34:53 -04:00
Amitai Schlair 69f8b6427e Sans ImageMagick, bail gracefully. 2015-08-22 21:50:38 -04:00
Amitai Schlair 7f76e0ccc1 Mark a few straggling test scripts +x. 2015-08-18 07:31:29 -04:00
Amitai Schlair d42ed9bdc3 Test many behaviors of the meta directive. 2015-08-15 23:37:43 -04:00
Amitai Schlair 604d0391ba Squelch regex deprecation warnings from Perl 5.22.
Specifically:

"Unescaped left brace in regex is deprecated, passed through in regex"
2015-06-14 21:35:51 -04:00
Simon McVittie 841a86a4f3 img test: set old timestamp on source file that will change
This is so that the test will pass even if it takes less than 1 second.
2015-06-14 18:13:17 +01:00
Simon McVittie 7a2117bf8c img: stop ImageMagick trying to be clever if filenames contain a colon
$im->Read() takes a filename-like argument with several sets of special
syntax. Most of the possible metacharacters are escaped by the
default `wiki_file_chars` (and in any case not particularly disruptive),
but the colon ":" is not.

It seems the way to force ImageMagick to treat colons within the
filename as literal is to prepend a colon, so do that.
2015-06-13 20:00:08 +01:00
Simon McVittie 9497fc1b6c t/inline.t: accept translations of "Add a new post titled:" (Closes: #779365) 2015-03-01 17:15:13 +00:00
Simon McVittie a1fda0b516 Standardize on --long-option instead of -long-option
[[forum/refresh_and_setup]] indicates some confusion between --setup
and -setup. Both work, but it's clearer if we stick to one in
documentation and code.

A 2012 commit to [[plugins/theme]] claims that "-setup" is required
and "--setup" won't work, but I cannot find any evidence in ikiwiki's
source code that this has ever been the case.
2015-03-01 16:15:01 +00:00
Simon McVittie 6b6d330bad textile-double-escape-bug.t: tolerate any valid encoding
Discount in current Debian unstable turns the IURI href into a URI
by encoding the Unicode as UTF-8 and %-escaping each byte.
That is valid, and matches Wikipedia's expectations, but was breaking
this test for me.

It would also be entirely valid (and lead to equivalent parsing) if the
ö was represented as ö, ö or &#xf6 in the text and/or the href.
2015-01-06 00:28:18 +00:00
Simon McVittie 4315581f31 Turn positive test for wrong behaviour into a TODO test for right behaviour
We don't want ikiwiki's tests to stop passing when
Text::Textile is fixed.
2015-01-06 00:28:18 +00:00
Amitai Schlair 97f8b33c1a Document an annoying Text::Textile encoding bug. 2014-12-22 22:43:40 -05:00
Simon McVittie b9596b2049 Add regression test for libdir/libdirs 2014-12-09 22:54:26 +00:00
Simon McVittie 6c51b764bc Merge branch 'ready/html5' 2014-11-26 11:58:05 +00:00
Simon McVittie 105f285a63 Work around Debian #771047: use a non-blank SVG for the regression test
Inkscape loses the bounding box of a SVG with no content when it
converts it to EPS, and ImageMagick does not have a special case for
converting SVG to PNG with Inkscape in one step (which Inkscape can do);
it prefers to convert SVG to EPS with Inkscape, then EPS to whatever.
2014-11-26 11:10:44 +00:00
Simon McVittie b679fc65f5 We no longer have a test for DTD-valid XHTML 1.0, but at least check well-formedness
This means that people can do XSLT nonsense if they want to.

The failures are currently marked TODO because not everything in the
docwiki is in fact well-formed.
2014-10-16 11:25:10 +01:00
Simon McVittie fb7225dbe6 Remove now-redundant test-cases for a non-default html5 setting 2014-10-16 11:08:01 +01:00
Simon McVittie a052771287 Now that we're always using HTML5, <base href> can be relative 2014-10-16 11:05:19 +01:00
Simon McVittie 490a1eca7b Always produce HTML5 doctype and new attributes, but not new elements
According to caniuse.com, a significant fraction of Web users are
still using Internet Explorer versions that do not support HTML5
sectioning elements. However, claiming we're XHTML 1.0 Strict
means we can't use features invented in the last 12 years, even if
they degrade gracefully in older browsers (like the role and placeholder
attributes).

This means our output is no longer valid according to any particular
DTD. Real browsers and other non-validator user-agents have never
cared about DTD compliance anyway, so I don't think this is a real loss.
2014-10-16 11:04:53 +01:00
Amitai Schlair 47fff754c8 Extract test subs for each site. No change meant. 2014-10-12 09:30:31 -04:00
Amitai Schlair 508457fc05 Extract run_cgi(). No functional change intended. 2014-10-12 00:01:09 -04:00
Amitai Schlair 0db1679a3d Extract check_generated_content(). Same output. 2014-10-11 09:52:21 -04:00
Amitai Schlair dc872e42c8 Extract check_cgi_mode_bits(). No change intended. 2014-10-10 21:17:39 -04:00
Amitai Schlair cd9297322a Extract thoroughly_rebuild(), a slight test change.
I didn't try to parameterize when a test should fail when we can't
remove ikiwiki.cgi because there already isn't one. (Hooray, natural
language.) Instead, we stop worrying about it and always tolerate
ENOENT.
2014-10-10 20:40:24 -04:00
Amitai Schlair 7d82570fe0 Extract write_setup_file(). No functional change.
Test output differs only by the line numbers of the TODO items.
2014-10-10 20:25:54 -04:00
Amitai Schlair bb8f15e2a7 simplify IPC::Run check (same behavior) 2014-10-06 16:31:52 -04:00
Simon McVittie 33f60260b2 In html5 mode, generate a host- or protocol-relative <base> for the CGI
This increases the number of situations in which we do the right thing.
2014-10-05 23:49:37 +01:00
Simon McVittie 3b8da667cc Add reverse_proxy option which hard-codes cgiurl in CGI output
This solves several people's issues with the CGI trying to be
too clever when IkiWiki is placed behind a reverse-proxy.
2014-10-05 23:49:37 +01:00
Simon McVittie d712389ae3 Avoid mixed content when cgiurl is https but url is not 2014-10-05 23:49:37 +01:00
Simon McVittie 532f7adfdb Use protocol-relative URIs if cgiurl and url differ only by authority (hostname) 2014-10-05 15:56:19 +01:00
Simon McVittie fe9e94513a Fix a test-case that actually just repeated the previous one instead 2014-10-05 15:49:20 +01:00