File: taint_storage.t

package info (click to toggle)
libcgi-session-perl 4.48-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 616 kB
  • sloc: perl: 1,920; makefile: 5
file content (34 lines) | stat: -rw-r--r-- 757 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl -T

# https://rt.cpan.org/Public/Bug/Display.html?id=80346

use strict;
use warnings;
use CGI::Session;
use Scalar::Util qw(tainted);
use Test::More tests => 6;

my $sid;

my $session = CGI::Session->new( "driver:file;serializer:storable", undef, {Directory=>'t'});
ok($session, "new() with file+storable");

$session->param('a', 1 );

$sid = $session->id;
ok(!tainted $sid, "sid not tainted after new");

$session->flush;
$session = CGI::Session->load( "driver:file;serializer:storable", $sid, {Directory=>'t'});

ok($session, "load() with file+storable");
$sid = $session->id;
ok(!tainted $sid, "sid not tainted after load");

is($session->param('a'), 1, "parameter stored");

$session->flush;

ok(1, "survived flush");

$session->delete;