]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
repo_atom: add comments around string eval usage
authorEric Wong <e@80x24.org>
Tue, 29 Apr 2025 20:47:45 +0000 (20:47 +0000)
committerEric Wong <e@80x24.org>
Thu, 1 May 2025 21:29:48 +0000 (21:29 +0000)
Readers unfamiliar with the code may see a code injection
vulnerability here, so try to reassure them that we're using
`--perl'-escaped output from git-for-each-ref(1) that ought
to be safe to run through `eval'.

lib/PublicInbox/RepoAtom.pm

index eb0ed3c7786dc9c166055246c7ca833256aeab34..2e5c3d7649ce647a059c310425e3f48023fd70d9 100644 (file)
@@ -52,8 +52,8 @@ sub translate {
        while ($lbuf =~ s/\A([^\0]+)\0\n//s) {
                utf8_maybe($bdy = $1);
                if ($is_tag) {
-                       my %r;
-                       eval "$bdy";
+                       my %r; # filled by eval:
+                       eval "$bdy"; # `git for-each-ref --perl' output
                        for (qw(contents:subject contents:body)) {
                                $r{$_} =~ /\S/ or delete($r{$_})
                        }