diff --git a/src/Module/WellKnown/SecurityTxt.php b/src/Module/WellKnown/SecurityTxt.php new file mode 100644 index 0000000000..9cdcde0484 --- /dev/null +++ b/src/Module/WellKnown/SecurityTxt.php @@ -0,0 +1,43 @@ +. + * + */ + +namespace Friendica\Module\WellKnown; + +use Friendica\BaseModule; + +/** + * Standardized way of exposing metadata about the project security policy + * @see https://securitytxt.org + */ +class SecurityTxt extends BaseModule +{ + public static function rawContent(array $parameters = []) + { + $name = 'security.txt'; + $fp = fopen($name, 'rt'); + + header('Content-type: text/plain; charset=utf-8'); + header("Content-Length: " . filesize($name)); + + fpassthru($fp); + exit; + } +} diff --git a/static/routes.config.php b/static/routes.config.php index 031f6082b1..1f3e9fa9f0 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -44,6 +44,7 @@ return [ '/.well-known' => [ '/host-meta' => [Module\WellKnown\HostMeta::class, [R::GET]], '/nodeinfo' => [Module\WellKnown\NodeInfo::class, [R::GET]], + '/security.txt' => [Module\WellKnown\SecurityTxt::class, [R::GET]], '/webfinger' => [Module\Xrd::class, [R::GET]], '/x-nodeinfo2' => [Module\NodeInfo210::class, [R::GET]], '/x-social-relay' => [Module\WellKnown\XSocialRelay::class, [R::GET]],