aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
Commit message (Collapse)AuthorAge
* add and use cgiurl_abs_sameschemeJoey Hess2018-01-05
| | | | | | | | | | | | | | | | * emailauth: Fix cookie problem when user is on https and the cgiurl uses http, by making the emailed login link use https. * passwordauth: Use https for emailed password reset link when user is on https. Not entirely happy with this approach, but I don't currently see a better one. I have not verified that the passwordauth change fixes any problem, other than the user getting a http link when they were using https. The emailauth problem is verified fixed by this commit. This commit was sponsored by Michael Magin.
* improve error message when postsignin is not setJoey Hess2018-01-04
| | | | | | | This can happen if the user goes directly to /ikiwiki.cgi?do=login and logs in, since nothing redirected them to there, there's no postsignin value set. It can also happen when cookies are disabled, or perhaps other problems.
* Pass some git environment variables to the test-receive hookSimon McVittie2017-10-01
| | | | | | | | | | | Since git 2.11, git has stored the proposed push in a "quarantine area" until it is accepted by the pre-receive hook, and passed extra environment variables to the pre-receive hook so that it can read objects from the quarantine area. This fixes untrusted push on modern git versions. Signed-off-by: Simon McVittie <smcv@debian.org>
* IkiWiki::Receive: Avoid using asprintfSimon McVittie2017-10-01
| | | | | | | | | On GNU/Linux, it isn't declared in stdio.h unless we define _GNU_SOURCE, which we don't; using the implicit declaration risks crashes on platforms where sizeof(pointer) != sizeof(int). On other platforms it isn't guaranteed to exist at all. Signed-off-by: Simon McVittie <smcv@debian.org>
* img: resize images in a deterministic manner.intrigeri2017-09-01
|
* emailauth, passwordauth: Avoid leaving cgisess_* files in the system temp ↵Joey Hess2017-08-23
| | | | | | | | | | | | | directory. Due to the use/abuse of CGI::Session to generate a token for the login process, a new session database was created for each login, and left behind afterwards. While each file is small, with many logings this could bloat the size of /tmp significantly. Fixed by making CGI::Session write to /dev/null, since there does not seem to be a way to entirely prevent the writing. This commit was sponsored by Henrik Riomar on Patreon.
* htmlscrubber: Add support for the video tag's loop and muted attributes.Joey Hess2017-07-11
| | | | | | | Those were not in the original html5 spec, but have been added in the whatwg html living standard and have wide browser support. This commit was sponsored by John Peloquin on Patreon.
* osm: Convert savestate hook into a changes hookSimon McVittie2017-06-20
| | | | | | | | | | | | | savestate is not the right place to write wiki content, and in particular this breaks websetup if osm's dependencies are not installed, even if the osm plugin is not actually enabled. (Closes: #719913) This is not a full solution: it should be possible to render the PoI files for only the maps that changed, from the format, changes or rendered hook. However, getting that right would require more understanding of this plugin, and this version is enough to not break websetup. This version is the closest correct hook to the one where this previously took place.
* color: Use markup for the preserved CSS, not character dataSimon McVittie2017-05-16
| | | | | | This still smuggles it past the sanitize step, but avoids having other plugins that want to capture text content without markup (notably toc) see the CSS as if it was text content.
* use heading identifiers in TOC linksAntoine Beaupré2017-05-16
| | | | | | | | | | | reasoning: if headings have identifiers, they are probably more useful anchors than the automatically generated anchors we build in the toc plugin. this can happen if, for example, you use the `multimarkdown` plugin, which inserts `id` tags for every header it encounters. this also leverages the `headinganchors` plugin nicely. keeps backwards-compatibility with old toc-generated #indexXhY anchors.
* mdwn: Don't enable alphabetically labelled ordered lists by defaultSimon McVittie2017-05-16
| | | | | | | | | | | This avoids misinterpreting initials ("C. S. Lewis was an author"), the abbreviation for Monsieur ("M. Descartes was a philosopher") and German page numbering ("S. 42") as ordered lists if they happen to begin a line. This only affects the default Discount implementation: Text::Markdown and Text::MultiMarkdown do not have this feature anyway. A new mdwn_alpha_list option can be used to restore the old interpretation.
* mdwn: Enable footnotes by default when using DiscountSimon McVittie2017-05-14
| | | | | A new mdwn_footnotes option can be used to disable footnotes in MultiMarkdown and Discount.
* mdwn: Don't mangle <style> into <elyts> under some circumstancesSimon McVittie2017-05-14
| | | | | We can ask libdiscount not to elide <style> blocks, which means we don't have to work around them.
* mdwn: Make flags passed to libdiscount explicitSimon McVittie2017-05-14
| | | | | | The Perl binding defaults to MKD_NOHEADER|MKD_NOPANTS anyway, but making them explicit means we can use other flags of our choice, and makes it easier to justify why those flags are appropriate.
* cgierror: When the CGI fails, print the error to stderr, not "Died"Simon McVittie2017-05-14
| | | | | $@ could be clobbered by the "exception handler", and in practice it seems that it is. This can be seen on stderr of t/git-cgi.t.
* Defend against empty session namesSimon McVittie2017-05-14
| | | | | If misconfiguration has resulted in an empty session name, treat the session as having not signed in.
* httpauth: If REMOTE_USER is empty, behave as though it was unsetSimon McVittie2017-05-14
| | | | | | A frequently cut-and-pasted HTTP basic authentication configuration for nginx sets it to the empty string when not authenticated, which is not useful.
* remove: make it clearer that repeated page parameter is OK hereSimon McVittie2017-01-11
| | | | | | ikiwiki's web interface does not currently have UI for removing multiple pages simultaneously, but the remove plugin is robust against doing so. Use a clearer idiom to make that obvious.
* CGI, attachment, passwordauth: harden against repeated parametersSimon McVittie2017-01-11
| | | | | | | | | | These instances of code similar to OVE-20170111-0001 are not believed to be exploitable, because defined(), length(), setpassword(), userinfo_set() and the binary "." operator all have prototypes that force the relevant argument to be evaluated in scalar context. However, using a safer idiom makes mistakes less likely. (cherry picked from commit 69230a2220f673c66b5ab875bfc759b32a241c0d)
* passwordauth: avoid userinfo forgery via repeated email parameterSimon McVittie2017-01-11
| | | | | | OVE-20170111-0001 (cherry picked from commit bffb71d6a7d28f6dd5f0be241f214e79eea7bb91)
* passwordauth: prevent authentication bypass via multiple name parametersSimon McVittie2017-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling CGI::FormBuilder::field with a name argument in list context returns zero or more user-specified values of the named field, even if that field was not declared as supporting multiple values. Passing the result of field as a function parameter counts as list context. This is the same bad behaviour that is now discouraged for CGI::param. In this case we pass the multiple values to CGI::Session::param. That accessor has six possible calling conventions, of which four are documented. If an attacker passes (2*n + 1) values for the 'name' field, for example name=a&name=b&name=c, we end up in one of the undocumented calling conventions for param: # equivalent to: (name => 'a', b => 'c') $session->param('name', 'a', 'b', 'c') and the 'b' session parameter is unexpectedly set to an attacker-specified value. In particular, if an attacker "bob" specifies name=bob&name=name&name=alice, then authentication is carried out for "bob" but the CGI::Session ends up containing {name => 'alice'}, an authentication bypass vulnerability. This vulnerability is tracked as OVE-20170111-0001. (cherry picked from commit e909eb93f4530a175d622360a8433e833ecf0254)
* git: don't redundantly pass "--" to git_sha1Simon McVittie2017-01-09
| | | | | | | | | | | | | | | git_sha1 already puts "--" before its arguments, so git_sha1_file($dir, 'doc/index.mdwn') would have incorrectly invoked git rev-list --max-count=1 HEAD -- -- doc/index.mdwn If there is no file in the wiki named "--", that's harmless, because it merely names the latest revision in which either "--" or "doc/index.mdwn" changed. However, it could return incorrect results if there is somehow a file named "--".
* git: use parameters, not global state, to swap working directorySimon McVittie2017-01-09
|
* Revert "git: Turn $git_dir into a stack"Simon McVittie2017-01-09
| | | | | | | Now that we have avoided using in_git_dir recursively, we don't need the stack any more. This reverts commit 39b8931ad31fe6b48afdc570caa459a0996c2092.
* git: do not mix in_git_dir with eval{}Simon McVittie2017-01-09
| | | | | | | | If we throw an exception (usually from run_or_die), in_git_dir won't unshift the current directory from the stack. That's usually fine, but in rcs_preprevert we catch exceptions and do some cleanup before returning, for which we need the git directory to be the root and not the temporary working tree.
* Use rel=nofollow microformat for dynamic (CGI-related) URLsSimon McVittie2017-01-09
| | | | | | | Some of these might be relatively expensive to dereference or result in messages being logged, and there's no reason why a search engine should need to index them. (In particular, we'd probably prefer search engines to index the rendered page, not its source code.)
* Enquote $background_command as surely intended.Amitai Schleier2017-01-02
|
* git: Do not disable commit hook for temporary working treeSimon McVittie2016-12-29
| | | | | | | | We exclude .git/hooks from symlinking into the temporary working tree, which avoids the commit hook being run for the temporary branch anyway. This avoids the wiki not being updated if an orthogonal change is received in process A, while process B prepares a revert that is subsequently cancelled.
* git: Attribute reverts to the user doing the revert, not the wiki itselfSimon McVittie2016-12-29
|
* git: write proposed attachment to temp file without going via system()Simon McVittie2016-12-28
|
* git: change calling convention of safe_git to have named argumentsSimon McVittie2016-12-28
|
* git: Do the revert operation in a secondary working treeSimon McVittie2016-12-28
| | | | | This avoids leaving the git directory in an inconsistent state if the host system is rebooted while we are processing a revert.
* git: Turn $git_dir into a stackSimon McVittie2016-12-28
| | | | | | This will be necessary when we use a secondary working tree to do reverts without leaving the primary working tree in an inconsistent state.
* Try revert operations (on a branch) before approving themSimon McVittie2016-12-28
| | | | | | | | | | | | | | | | | Otherwise, we have a time-of-check/time-of-use vulnerability: rcs_preprevert previously looked at what changed in the commit we are reverting, not at what would result from reverting it now. In particular, if some files were renamed since the commit we are reverting, a revert of changes that were within the designated subdirectory and allowed by check_canchange() might now affect files that are outside the designated subdirectory or disallowed by check_canchange(). It is not sufficient to disable rename detection, since git older than 2.8.0rc0 (in particular the version in Debian stable) silently accepts and ignores the relevant options. OVE-20161226-0002
* Revert "Tell `git revert` not to follow renames"Simon McVittie2016-12-28
| | | | | | | This doesn't work prior to git 2.8: `git revert` silently ignores the option and succeeds. We will have to fix CVE-2016-10026 some other way. This reverts commit 9cada49ed6ad24556dbe9861ad5b0a9f526167f9.
* Force CGI::FormBuilder->field to scalar context where necessarySimon McVittie2016-12-28
| | | | | | | | | | | | | | | | | | | | | | | | | | CGI::FormBuilder->field has behaviour similar to the CGI.pm misfeature we avoided in f4ec7b0. Force it into scalar context where it is used in an argument list. This prevents two (relatively minor) commit metadata forgery vulnerabilities: * In the comments plugin, an attacker who was able to post a comment could give it a user-specified author and author-URL even if the wiki configuration did not allow for that, by crafting multiple values to other fields. * In the editpage plugin, an attacker who was able to edit a page could potentially forge commit authorship by crafting multiple values for the rcsinfo field. The remaining plugins changed in this commit appear to have been protected by use of explicit scalar prototypes for the called functions, but have been changed anyway to make them more obviously correct. In particular, checkpassword() in passwordauth has a known prototype, so an attacker cannot trick it into treating multiple values of the name field as being the username, password and field to check for. OVE-20161226-0001
* git: do not fail to commit if committer is anonymousSimon McVittie2016-12-28
|
* git: don't issue a warning if rcsinfo is undefinedSimon McVittie2016-12-28
| | | | | | The intention here seems to be that $prev may be undefined, and the only way that can legitimately happen is for $params{token} to be undefined too.
* Make pagestats output more deterministic.intrigeri2016-12-19
| | | | Sort in lexical order the pages that have the same number of hits.
* Tell `git revert` not to follow renamesSimon McVittie2016-12-19
| | | | | | | | | | | | Otherwise, we have an authorization bypass vulnerability: rcs_preprevert looks at what changed in the commit we are reverting, not at what would result from reverting it now. In particular, if some files were renamed since the commit we are reverting, a revert of changes that were within the designated subdirectory and allowed by check_canchange() might now affect files that are outside the designated subdirectory or disallowed by check_canchange(). Signed-off-by: Simon McVittie <smcv@debian.org>
* cgitemplate: actually remove dead codeSimon McVittie2016-12-19
| | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* inline: Prevent creating a file named ".mdwn" when the postform is submitted ↵Joey Hess2016-09-21
| | | | with an empty title.
* Update my surname to its new legal spelling.Amitai Schlair2016-09-14
|
* Use git log --no-renames for recentchangesSimon McVittie2016-09-03
| | | | | | | Otherwise, recent git releases show renames as renames, and we do not see that newdir/test5 was affected. Bug-Debian: https://bugs.debian.org/835612
* improve warning message for multiple sources for pageJoey Hess2016-05-31
|
* Wrapper: allocate new environment dynamicallySimon McVittie2016-05-11
| | | | | | | | | | | | | | 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.
* Detect image type from .JPG just like .jpg (etc.).Amitai Schlair2016-05-08
|
* img: make img_allowed_formats case-insensitiveSimon McVittie2016-05-07
|
* inline: expand show=N backwards compatibility to negative NSimon McVittie2016-05-06
| | | | | [[plugins/contrib]] uses show=-1 to show the post-creation widget without actually inlining anything.
* img: Add back support for SVG images, bypassing ImageMagick and simply ↵Simon McVittie2016-05-06
| | | | | | | | | | | | | | passing the SVG through to the browser SVG scaling by img directives has subtly changed; where before size=wxh would preserve aspect ratio, this cannot be done when passing them through and so specifying both a width and height can change the SVG's aspect ratio. (This patch looks significantly more complex than it was, because a large block of code had to be indented.) [smcv: drop trailing whitespace, fix some spelling]