SecurityTxtHandler.php 993 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Settings\WellKnown;
  8. use OCP\AppFramework\Http\TextPlainResponse;
  9. use OCP\Http\WellKnown\GenericResponse;
  10. use OCP\Http\WellKnown\IHandler;
  11. use OCP\Http\WellKnown\IRequestContext;
  12. use OCP\Http\WellKnown\IResponse;
  13. class SecurityTxtHandler implements IHandler {
  14. public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse {
  15. if ($service !== 'security.txt') {
  16. return $previousResponse;
  17. }
  18. $response = "Contact: https://hackerone.com/nextcloud
  19. Expires: 2024-08-31T23:00:00.000Z
  20. Acknowledgments: https://hackerone.com/nextcloud/thanks
  21. Acknowledgments: https://github.com/nextcloud/security-advisories/security/advisories
  22. Policy: https://hackerone.com/nextcloud
  23. Preferred-Languages: en
  24. ";
  25. return new GenericResponse(new TextPlainResponse($response, 200));
  26. }
  27. }