Commit | Line | Data |
f54428ab |
1 | #!/usr/bin/env perl -T |
83542a7d |
2 | |
3 | # the above line forces Test::Harness into taint-mode |
f54428ab |
4 | # DO NOT REMOVE |
83542a7d |
5 | |
6 | use strict; |
7 | use warnings; |
8 | |
91b0ad0b |
9 | use Test::More; |
f54428ab |
10 | use Test::Exception; |
11 | use lib qw(t/lib); |
83542a7d |
12 | |
f54428ab |
13 | throws_ok ( |
14 | sub { $ENV{PATH} . (kill (0)) }, |
15 | qr/Insecure dependency in kill/, |
16 | 'taint mode active' |
17 | ); |
83542a7d |
18 | |
f54428ab |
19 | { |
20 | package DBICTest::Taint::Classes; |
83542a7d |
21 | |
f54428ab |
22 | use Test::More; |
23 | use Test::Exception; |
91b0ad0b |
24 | |
f54428ab |
25 | use base qw/DBIx::Class::Schema/; |
91b0ad0b |
26 | |
f54428ab |
27 | lives_ok (sub { |
28 | __PACKAGE__->load_classes(qw/Manual/); |
29 | ok( __PACKAGE__->source('Manual'), 'The Classes::Manual source has been registered' ); |
30 | __PACKAGE__->_unregister_source (qw/Manual/); |
31 | }, 'Loading classes with explicit load_classes worked in taint mode' ); |
91b0ad0b |
32 | |
f54428ab |
33 | lives_ok (sub { |
34 | __PACKAGE__->load_classes(); |
35 | ok( __PACKAGE__->source('Auto'), 'The Classes::Auto source has been registered' ); |
36 | ok( __PACKAGE__->source('Auto'), 'The Classes::Manual source has been re-registered' ); |
37 | }, 'Loading classes with Module::Find/load_classes worked in taint mode' ); |
38 | } |
83542a7d |
39 | |
f54428ab |
40 | { |
41 | package DBICTest::Taint::Namespaces; |
83542a7d |
42 | |
f54428ab |
43 | use Test::More; |
44 | use Test::Exception; |
91b0ad0b |
45 | |
f54428ab |
46 | use base qw/DBIx::Class::Schema/; |
83542a7d |
47 | |
f54428ab |
48 | lives_ok (sub { |
49 | __PACKAGE__->load_namespaces(); |
50 | ok( __PACKAGE__->source('Test'), 'The Namespaces::Test source has been registered' ); |
51 | }, 'Loading classes with Module::Find/load_namespaces worked in taint mode' ); |
52 | } |
91b0ad0b |
53 | |
f54428ab |
54 | done_testing; |