🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.rc
Article #3138

Bug#1153977: libcgi-github-webhook-perl: test failures with CGI.pm 5.02

#3138
From: Niko Tyni
Date: Sat, 14 Nov 2026 14:10
162 lines
6605 bytes
--U9YQth1oPQduuDxh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Source: libcgi-github-webhook-perl
Version: 0.06-1.1
Severity: serious
Tags: upstream ftbfs patch

This package is failing its test suite on current sid.

 t/basic-functionality.t .. 
 1..12
 not ok 1 - system exited with zero
 
 #   Failed test 'system exited with zero'
 #   at t/basic-functionality.t line 30.
 #          got: '256'
 #     expected: '0'
 not ok 2 - CGI output as expected
 [...]

It was broken by libcgi-pm-perl 5.02-1, which is a rather extensive
security update. Clearly the libcgi-github-webhook-perl package needs
to adapt.

All the failures pretty much come down to this and its variations:

  perl -MTest::More=no_plan -MCGI -E 'is(CGI->new->param("POSTDATA"), "foobar")' POSTDATA=foobar

and are fallout from upstream commit

 https://github.com/leejo/CGI.pm/commit/bc4022f553301014e522133ba1e1f4e49e3bef08

  commit bc4022f553301014e522133ba1e1f4e49e3bef08
  Author: Lee Johnson <lee@payprop.com>
  Date:   Mon Nov 2 16:24:16 2026 +0100
  
      security: don't let clients set POSTDATA/PUTDATA/PATCHDATA/XForms:Model

My eyes bleed and I'm not sure I'll ever want to look at this stuff again,
but patch attached. This seems to work for me with the libcgi-pm-perl
versions from all of trixie, forky and sid (but I only tested lightly.)

These are all test-only fixes, so no Breaks are needed AFAICS.

As for runtime, I see CGI::Github::Webhook::_build_payload() looks at
$q->param('POSTDATA') but I *think* that's OK. It's just pulling it out
of the CGI request it's about to send to calculate a signature.

Not tagging 'forky sid' as Salvatore indicated we'll probably want to
update libcgi-pm-perl in trixie too and this will be needed there too.
Feel free to adjust of course.
-- 
Niko

--U9YQth1oPQduuDxh
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Fix-tests-for-compatibility-with-CGI.pm-5.02.patch"

From 11c0074f3bfc7bed5168ee5f9d58f1ea5ff44aa7 Mon Sep 17 00:00:00 2001
From: Niko Tyni <ntyni@debian.org>
Date: Sat, 14 Nov 2026 13:06:00 +0000
Subject: [PATCH] Fix tests for compatibility with CGI.pm 5.02

As of https://github.com/leejo/CGI.pm/commit/bc4022f553301014e522133ba1e1f4e49e3bef08
CGI.pm does not allow clients setting POSTDATA via the query string
or a form field. They must be set by the application if necessary.
---
 t/cgi-test.t         | 3 ++-
 t/cgi/basic.pl       | 7 +++++++
 t/methods-non-json.t | 2 +-
 t/methods.t          | 3 ++-
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/t/cgi-test.t b/t/cgi-test.t
index d0e2660..9866dfa 100644
--- a/t/cgi-test.t
+++ b/t/cgi-test.t
@@ -24,7 +24,8 @@ my $ct = CGI::Test->new(
     );
 
 my $pr = CGI::Test::Input::URL->new();
-$pr->add_field('POSTDATA', $json);
+$pr->set_raw_data($json);
+$pr->set_mime_type('application/json');
 
 my $page = $ct->POST("http://webhook.example.org/cgi-bin/cgitest.pl", $pr);
 like($page->content_type, qr:text/plain\b:, "Content type");
diff --git a/t/cgi/basic.pl b/t/cgi/basic.pl
index 9238fe0..9795582 100755
--- a/t/cgi/basic.pl
+++ b/t/cgi/basic.pl
@@ -25,6 +25,13 @@ my $ghwh = CGI::Github::Webhook->new(
     cgi => $cgi,
     ($ARGV[3] ? (badge_to => $ARGV[3]."/badge.svg") : ()),
     );
+
+while (@ARGV > 4) {
+    my $paramspec = pop @ARGV;
+    my ($param, $value) = split(/=/, $paramspec);
+    $cgi->param($param, $value);
+}
+
 my $rc = $ghwh->run();
 
 if ($rc) {
diff --git a/t/methods-non-json.t b/t/methods-non-json.t
index 577dcdc..6003612 100644
--- a/t/methods-non-json.t
+++ b/t/methods-non-json.t
@@ -33,7 +33,6 @@ use_ok('CGI::Github::Webhook');
 
 # Non-JSON payload
 $ENV{HTTP_X_HUB_SIGNATURE} = $signature_non_json;
-$ENV{QUERY_STRING} = "POSTDATA=$non_json";
 
 my $ghwh = CGI::Github::Webhook->new(
     trigger => 'echo foo',
@@ -42,6 +41,7 @@ my $ghwh = CGI::Github::Webhook->new(
     log => $tmplog,
     badge_to => $badge,
     );
+$ghwh->cgi->param("POSTDATA", $non_json);
 
 is($ghwh->header(),
    "Content-Type: text/plain; charset=utf-8\r\n\r\n",
diff --git a/t/methods.t b/t/methods.t
index 2002727..5419dd6 100644
--- a/t/methods.t
+++ b/t/methods.t
@@ -45,7 +45,6 @@ is($ghwh->header(),
 ok(!$ghwh->authenticated, 'Authentication failed');
 
 $ENV{HTTP_X_HUB_SIGNATURE} = $signature;
-$ENV{QUERY_STRING} = "POSTDATA=$json";
 
 # Successful authentication
 $ghwh = CGI::Github::Webhook->new(
@@ -55,6 +54,7 @@ $ghwh = CGI::Github::Webhook->new(
     log => $tmplog,
     badge_to => $badge,
     );
+$ghwh->cgi->param("POSTDATA", $json);
 
 is($ghwh->header(),
    "Content-Type: text/plain; charset=utf-8\r\n\r\n",
@@ -80,6 +80,7 @@ $ghwh = CGI::Github::Webhook->new(
     log => $tmplog,
     badge_to => $badge,
     );
+$ghwh->cgi->param("POSTDATA", $json);
 
 is($ghwh->header(),
    "Content-Type: text/plain; charset=utf-8\r\n\r\n",
-- 
2.55.0


--U9YQth1oPQduuDxh--
Technical Details
Message-ID: <NZmC5-bQLE-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-fra.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!bofh.it!news.nic.it!robomod
From: Niko Tyni <ntyni@debian.org>
Newsgroups: linux.debian.bugs.rc
Subject: Bug#1153977: libcgi-github-webhook-perl: test failures with CGI.pm 5.02
Date: Sat, 14 Nov 2026 15:10:01 +0100
Message-ID: <NZmC5-bQLE-7@gated-at.bofh.it>
X-Mailbox-Line: From debian-bugs-rc-request@lists.debian.org  Sat Nov 14 14:09:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.7
Reply-To: Niko Tyni <ntyni@debian.org>, 1153977@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: abe@debian.org
X-Debian-Pr-Message: report 1153977
X-Debian-Pr-Package: src:libcgi-github-webhook-perl
X-Debian-Pr-Keywords: ftbfs patch upstream
X-Debian-Pr-Source: libcgi-github-webhook-perl
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="U9YQth1oPQduuDxh"
Content-Disposition: inline
X-Debian-User: ntyni
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-rc@lists.debian.org> archive/latest/838194
List-ID: <debian-bugs-rc.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-rc/>
Approved: robomod@news.nic.it
Lines: 162
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Sat, 14 Nov 2026 16:07:20 +0200
X-Original-Message-ID: <avhrGD0EoY3bdB0J@app-dd>