line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/ContentSecurityPolicyReportOnly.pm |
3
|
|
|
|
|
|
|
## Version v0.1.0 |
4
|
|
|
|
|
|
|
## Copyright(c) 2022 DEGUEST Pte. Ltd. |
5
|
|
|
|
|
|
|
## Author: Jacques Deguest <jack@deguest.jp> |
6
|
|
|
|
|
|
|
## Created 2022/05/07 |
7
|
|
|
|
|
|
|
## Modified 2022/05/07 |
8
|
|
|
|
|
|
|
## All rights reserved. |
9
|
|
|
|
|
|
|
## |
10
|
|
|
|
|
|
|
## |
11
|
|
|
|
|
|
|
## This program is free software; you can redistribute it and/or modify it |
12
|
|
|
|
|
|
|
## under the same terms as Perl itself. |
13
|
|
|
|
|
|
|
##---------------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
package HTTP::Promise::Headers::ContentSecurityPolicyReportOnly; |
15
|
|
|
|
|
|
|
BEGIN |
16
|
|
|
|
|
|
|
{ |
17
|
3
|
|
|
3
|
|
2134
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
113
|
|
18
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
97
|
|
19
|
3
|
|
|
3
|
|
23
|
use warnings::register; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
455
|
|
20
|
3
|
|
|
3
|
|
18
|
use parent qw( HTTP::Promise::Headers::ContentSecurityPolicy ); |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
32
|
|
21
|
3
|
|
|
3
|
|
344
|
our $VERSION = 'v0.1.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
59
|
|
25
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
359
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
2
|
|
|
2
|
1
|
781
|
my $self = shift( @_ ); |
30
|
2
|
50
|
|
|
|
31
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
31
|
2
|
|
|
|
|
29
|
$self->_field_name( 'Content-Security-Policy-Report-Only' ); |
32
|
2
|
|
|
|
|
1614
|
return( $self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
1
|
491
|
sub report_uri { return( shift->_set_get_property_value( 'report-uri', @_ ) ); } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
# NOTE: POD |
39
|
|
|
|
|
|
|
__END__ |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding utf-8 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
HTTP::Promise::Headers::ContentSecurityPolicyReportOnly - Content-Security-Policy-Report-Only Header Field |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
use HTTP::Promise::Headers::ContentSecurityPolicyReportOnly; |
50
|
|
|
|
|
|
|
my $this = HTTP::Promise::Headers::ContentSecurityPolicyReportOnly->new || die( HTTP::Promise::Headers::ContentSecurityPolicyReportOnly->error, "\n" ); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 VERSION |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
v0.1.0 |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 DESCRIPTION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The following description is taken from Mozilla documentation. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This class inherits all the method from L<HTTP::Promise::Headers::ContentSecurityPolicy> and implements the additional following ones. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
The CSP L</report_uri> method should be used with this header, otherwise this class will be an expensive no-op interface. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Content-Security-Policy-Report-Only: default-src https:; report-uri /csp-violation-report-endpoint/ |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 report_uri |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This takes an uri where the report will be sent. See L<this Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri> for an example php script to use to get those reports. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 AUTHOR |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 SEE ALSO |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only> and also L<this documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri> |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L<HTTP::Promise>, L<HTTP::Promise::Request>, L<HTTP::Promise::Response>, L<HTTP::Promise::Message>, L<HTTP::Promise::Entity>, L<HTTP::Promise::Headers>, L<HTTP::Promise::Body>, L<HTTP::Promise::Body::Form>, L<HTTP::Promise::Body::Form::Data>, L<HTTP::Promise::Body::Form::Field>, L<HTTP::Promise::Status>, L<HTTP::Promise::MIME>, L<HTTP::Promise::Parser>, L<HTTP::Promise::IO>, L<HTTP::Promise::Stream>, L<HTTP::Promise::Exception> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright(c) 2022 DEGUEST Pte. Ltd. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
All rights reserved. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |