Summary
Under taint mode (-T), PerlOnJava returns the value of Cwd::getcwd() as a clean scalar. Standard Perl marks this operating-system-derived value as tainted.
This affects both PerlOnJava backends and causes Data::Compare 1.29's taint test to enter plugin discovery when it should disable plugins.
Minimal reproducer
use strict;
use warnings;
use Scalar::Util qw(tainted);
use Cwd qw(getcwd);
print tainted(getcwd()) ? "tainted\n" : "clean\n";
Run with taint mode enabled:
perl -T reproducer.pl
jperl -T reproducer.pl
jperl --interpreter -T reproducer.pl
Results:
- system Perl:
tainted - PerlOnJava JVM backend:
clean - PerlOnJava interpreter backend:
clean
CPAN integration evidence
CPAN random-tester run 20260825-173145-22349 tested the pure-Perl Data::Compare 1.29 distribution.
- System Perl: all 17 test files and 77 assertions pass.
- PerlOnJava: the other 16 test files pass with 76 assertions;
t/taint.t exits before producing its assertion. - Running
t/realtainttest directly fails on both PerlOnJava backends with Insecure dependency in chdir while running with -T switch from File::Find.
Data::Compare intentionally guards plugin discovery with logic equivalent to:
register_plugins() unless tainted(getcwd()) || !chdir($cwd);
Because PerlOnJava reports getcwd() as clean, it scans plugin directories through File::Find. That later reaches a correctly enforced taint check and aborts. Standard Perl skips plugin discovery as intended.
Expected behavior
Cwd::getcwd() should return a tainted scalar while -T is active, matching standard Perl.
Acceptance criteria
- Add a focused project regression test, validated first with standard Perl, for
tainted(Cwd::getcwd()) under -T. - Make the regression pass on both the JVM and interpreter backends.
- Make Data::Compare 1.29's unchanged
t/taint.t pass. - Preserve current behavior when taint mode is not enabled.
Summary
Under taint mode (
-T), PerlOnJava returns the value ofCwd::getcwd()as a clean scalar. Standard Perl marks this operating-system-derived value as tainted.This affects both PerlOnJava backends and causes Data::Compare 1.29's taint test to enter plugin discovery when it should disable plugins.
Minimal reproducer
Run with taint mode enabled:
Results:
taintedcleancleanCPAN integration evidence
CPAN random-tester run
20260825-173145-22349tested the pure-Perl Data::Compare 1.29 distribution.t/taint.texits before producing its assertion.t/realtainttestdirectly fails on both PerlOnJava backends withInsecure dependency in chdir while running with -T switchfrom File::Find.Data::Compare intentionally guards plugin discovery with logic equivalent to:
Because PerlOnJava reports
getcwd()as clean, it scans plugin directories through File::Find. That later reaches a correctly enforced taint check and aborts. Standard Perl skips plugin discovery as intended.Expected behavior
Cwd::getcwd()should return a tainted scalar while-Tis active, matching standard Perl.Acceptance criteria
tainted(Cwd::getcwd())under-T.t/taint.tpass.