-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcspreflect.php
More file actions
35 lines (28 loc) · 897 Bytes
/
cspreflect.php
File metadata and controls
35 lines (28 loc) · 897 Bytes
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
<?php
########################################################
# A PHP tool to serve CSP headers, #
# to use for testing arbitrary policies on #
# online evaluators like: https://csper.io/evaluator #
# Written by Andy Tyler (@ticarpi) #
# Software URL: https://github.com/ticarpi/ticwebtools #
########################################################
$filename = 'csp.txt';
if (file_exists($filename)) {
$cspdata = file_get_contents($filename);
} else {
$cspdata = "example policy not provided";
}
header('Content-Security-Policy: ' . $cspdata);
if ( isset($_POST['csp']) ) {
$csp = $_POST['csp'];
file_put_contents($filename, $csp);
}
?>
<html>
<body>
<form actions="cspreflect.php" method="post">
CSP: <input type="text" name="csp" size=70 /><br /><br />
<input type="submit" value="Submit" />
</form>
</body>
</html>