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
|
|
2104
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
105
|
|
18
|
3
|
|
|
3
|
|
24
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
93
|
|
19
|
3
|
|
|
3
|
|
18
|
use warnings::register; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
476
|
|
20
|
3
|
|
|
3
|
|
39
|
use parent qw( HTTP::Promise::Headers::ContentSecurityPolicy ); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
23
|
|
21
|
3
|
|
|
3
|
|
345
|
our $VERSION = 'v0.1.0'; |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
3
|
|
24
|
use strict; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
64
|
|
25
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
390
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub init |
28
|
|
|
|
|
|
|
{ |
29
|
2
|
|
|
2
|
1
|
767
|
my $self = shift( @_ ); |
30
|
2
|
50
|
|
|
|
46
|
$self->SUPER::init( @_ ) || return( $self->pass_error ); |
31
|
2
|
|
|
|
|
24
|
$self->_field_name( 'Content-Security-Policy-Report-Only' ); |
32
|
2
|
|
|
|
|
2019
|
return( $self ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
1
|
513
|
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 |