🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.rc
2 messages
2 total messages Started by Niko Tyni Sat, 14 Nov 2026 14:10
Bug#1153977: libcgi-github-webhook-perl: test failures with CGI.pm 5.02
#3138
Author: 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--
Bug#1153977: libcgi-github-webhook-perl: test failures with CGI.pm 5.02
#3192
Author: Niko Tyni
Date: Sun, 15 Nov 2026 09:10
9 lines
1959 bytes
On Sat, Nov 14, 2026 at 04:07:20PM +0200, Niko Tyni wrote:

> My eyes bleed and I'm not sure I'll ever want to look at this stuff again,

Apologies, that came out more snarky than I intended. I was referring
to CGI.pm here rather than libcgi-github-webhook-perl itself. It's 
apparently been 31 years since the first CGI.pm release and it shows.
-- 
Niko
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads