]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Merge commit 'intrigeri/po' into po
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 19 May 2009 17:06:35 +0000 (13:06 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 19 May 2009 17:06:35 +0000 (13:06 -0400)
IkiWiki/Plugin/po.pm
doc/plugins/po/discussion.mdwn [moved from doc/plugins/po/security.mdwn with 93% similarity]

index 3503fabc4ae85ec65a7788c8c3345cca955adacf..d26c4ab4e071916cb63e9f4be7cc9e4927378187 100644 (file)
@@ -32,7 +32,7 @@ sub import {
        hook(type => "getsetup", id => "po", call => \&getsetup);
        hook(type => "checkconfig", id => "po", call => \&checkconfig);
        hook(type => "needsbuild", id => "po", call => \&needsbuild);
-       hook(type => "scan", id => "po", call => \&scan, last =>1);
+       hook(type => "scan", id => "po", call => \&scan, last => 1);
        hook(type => "filter", id => "po", call => \&filter);
        hook(type => "htmlize", id => "po", call => \&htmlize);
        hook(type => "pagetemplate", id => "po", call => \&pagetemplate, last => 1);
@@ -141,9 +141,7 @@ sub checkconfig () {
            ! defined $config{po_link_to}) {
                $config{po_link_to}='default';
        }
-       elsif (! grep {
-                       $config{po_link_to} eq $_
-               } ('default', 'current', 'negotiated')) {
+       elsif ($config{po_link_to} !~ /^(default|current|negotiated)$/) {
                warn(sprintf(gettext('%s is not a valid value for po_link_to, falling back to po_link_to=default'),
                             $config{po_link_to}));
                $config{po_link_to}='default';
@@ -290,7 +288,7 @@ sub pagetemplate (@) {
 } # }}}
 
 # Add the renamed page translations to the list of to-be-renamed pages.
-sub renamepages(@) {
+sub renamepages (@) {
        my %params = @_;
 
        my %torename = %{$params{torename}};
@@ -326,13 +324,13 @@ sub renamepages(@) {
        return @ret;
 }
 
-sub mydelete(@) {
+sub mydelete (@) {
        my @deleted=@_;
 
        map { deletetranslations($_) } grep istranslatablefile($_), @deleted;
 }
 
-sub change(@) {
+sub change (@) {
        my @rendered=@_;
 
        # All meta titles are first extracted at scan time, i.e. before we turn
@@ -340,14 +338,14 @@ sub change(@) {
        # PO files breaks the meta plugin's parsing enough to save ugly titles
        # to %pagestate at this time.
        #
-       # Then, at render time, every page's passes on row through the Great
+       # Then, at render time, every page passes in turn through the Great
        # Rendering Chain (filter->preprocess->linkify->htmlize), and the meta
        # plugin's preprocess hook is this time in a position to correctly
        # extract the titles from slave pages.
        #
-       # This is, unfortunately, too late: if the page A, linking to the page B,
-       # is rendered before B, it will display the wrongly-extracted meta title
-       # as the link text to B.
+       # This is, unfortunately, too late: if the page A, linking to the page
+       # B, is rendered before B, it will display the wrongly-extracted meta
+       # title as the link text to B.
        #
        # On the one hand, such a corner case only happens on rebuild: on
        # refresh, every rendered page is fixed to contain correct meta titles.
@@ -786,9 +784,10 @@ sub refreshpot ($) {
        $doc->{TT}{file_in_charset} = 'utf-8';
        $doc->{TT}{file_out_charset} = 'utf-8';
        $doc->read($masterfile);
-       # let's cheat a bit to force porefs option to be passed to Locale::Po4a::Po;
-       # this is undocument use of internal Locale::Po4a::TransTractor's data,
-       # compulsory since this module prevents us from using the porefs option.
+       # let's cheat a bit to force porefs option to be passed to
+       # Locale::Po4a::Po; this is undocument use of internal
+       # Locale::Po4a::TransTractor's data, compulsory since this module
+       # prevents us from using the porefs option.
        $doc->{TT}{po_out}=Locale::Po4a::Po->new({ 'porefs' => 'none' });
        $doc->{TT}{po_out}->set_charset('utf-8');
        # do the actual work
similarity index 93%
rename from doc/plugins/po/security.mdwn
rename to doc/plugins/po/discussion.mdwn
index d1bbf6c056119c76700ab9a99e99e37c281ad5bd..570b2a6ef8be72b762cc6a8415fc98e9aec1302b 100644 (file)
@@ -1,12 +1,14 @@
-[[!toc levels=2]]
+[[!toc ]]
 
 ----
 
-# Probable holes
+# Security review
+
+## Probable holes
 
 _(The list of things to fix.)_
 
-## po4a-gettextize
+### po4a-gettextize
 
 * po4a CVS 2009-01-16
 * Perl 5.10.0
@@ -40,12 +42,12 @@ nothing about the place where the crash happens.
 
 ----
 
-# Potential gotchas
+## Potential gotchas
 
 _(Things not to do.)_
 
 
-## Blindly activating more po4a format modules
+### Blindly activating more po4a format modules
 
 The format modules we want to use have to be checked, as not all are
 safe (e.g. the LaTeX module's behaviour is changed by commands
@@ -54,19 +56,19 @@ the content.
 
 ----
 
-# Hopefully non-holes
+## Hopefully non-holes
 
 _(AKA, the assumptions that will be the root of most security holes...)_
 
-## PO file features
+### PO file features
 
 No [documented](http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files)
 directive that can be put in po files is supposed to cause mischief
 (ie, include other files, run commands, crash gettext, whatever).
 
-## gettext
+### gettext
 
-### Security history
+#### Security history
 
 The only past security issue I could find in GNU gettext is
 [CVE-2004-0966](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-0966),
@@ -81,14 +83,14 @@ use, either directly or indirectly, the faulty scripts.
 Note: the lack of found security issues can either indicate that there
 are none, or reveal that no-one ever bothered to find or publish them.
 
-### msgmerge
+#### msgmerge
 
 `refreshpofiles()` runs this external program.
 
 * I was not able to crash it with `zzuf`.
 * I could not find any past security hole.
 
-### msgfmt
+#### msgfmt
 
 `isvalidpo()` runs this external program.
 
@@ -96,9 +98,9 @@ are none, or reveal that no-one ever bothered to find or publish them.
   when too many errors are detected.
 * I could not find any past security hole.
 
-## po4a
+### po4a
 
-### Security history
+#### Security history
 
 The only past security issue I could find in po4a is
 [CVE-2007-4462](http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2007-4462):
@@ -112,7 +114,7 @@ use, either directly or indirectly, the faulty `gettextize` function.
 Note: the lack of found security issues can either indicate that there
 are none, or reveal that no-one ever bothered to find or publish them.
 
-### General feeling
+#### General feeling
 
 Are there any security issues on running po4a on untrusted content?
 
@@ -126,7 +128,7 @@ a convincing manner, stating that processing untrusted content was not
 an initial goal, and analysing in detail the possible issues.
 The following analysis was done with his help.
 
-### Details
+#### Details
 
 * the core (`Po.pm`, `Transtractor.pm`) should be safe
 * po4a source code was fully checked for other potential symlink
@@ -141,14 +143,14 @@ The following analysis was done with his help.
   input charset (`file_in_charset`) before asking `TransTractor` to
   read any file. NB: this hack depends on po4a internals.
 
-#### Locale::Po4a::Text
+##### Locale::Po4a::Text
 
 * does not run any external program
 * only `do_paragraph()` builds regexp's that expand untrusted
   variables; according to [[Joey]], this is "Freaky code, but seems ok
   due to use of `quotementa`".
 
-#### Text::WrapI18N
+##### Text::WrapI18N
 
 `Text::WrapI18N` can cause DoS
 ([Debian bug #470250](http://bugs.debian.org/470250)).
@@ -158,7 +160,7 @@ If a recent enough po4a (>=0.35) is installed, this module's use is
 fully disabled. Else, the wiki administrator is warned about this
 at runtime.
 
-#### Term::ReadKey
+##### Term::ReadKey
 
 `Term::ReadKey` is not a hard dependency in our case, *i.e.* po4a
 works nicely without it. But the po4a Debian package recommends
@@ -171,9 +173,9 @@ be able to guarantee anything wrt. security.
 If a recent enough po4a (>=2009-01-15 CVS, which will probably be
 released as 0.35) is installed, this module's use is fully disabled.
 
-#### Fuzzing input
+##### Fuzzing input
 
-##### po4a-translate
+###### po4a-translate
 
 * po4a CVS 2009-01-16
 * Perl 5.10.0
@@ -202,5 +204,5 @@ section.
 
 ----
 
-# Fixed holes
+## Fixed holes