-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add security.txt #27628
Merged
Merged
Add security.txt #27628
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright 2021 Lukas Reschke <lukas@statuscode.ch> | ||
* | ||
* @author 2021 Lukas Reschke <lukas@statuscode.ch> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace OCA\Settings\WellKnown; | ||
|
||
use OCP\AppFramework\Http\TextPlainResponse; | ||
use OCP\Http\WellKnown\GenericResponse; | ||
use OCP\Http\WellKnown\IHandler; | ||
use OCP\Http\WellKnown\IRequestContext; | ||
use OCP\Http\WellKnown\IResponse; | ||
|
||
class SecurityTxtHandler implements IHandler { | ||
public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse { | ||
if ($service !== 'security.txt') { | ||
return $previousResponse; | ||
} | ||
|
||
$response = "Contact: https://hackerone.com/nextcloud | ||
Expires: 2021-12-31T23:00:00.000Z | ||
Acknowledgments: https://hackerone.com/nextcloud/thanks | ||
Acknowledgments: https://github.com/nextcloud/security-advisories/security/advisories | ||
Policy: https://hackerone.com/nextcloud"; | ||
|
||
return new GenericResponse(new TextPlainResponse($response, 200)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright 2021 Lukas Reschke <lukas@statuscode.ch> | ||
* | ||
* @author 2021 Lukas Reschke <lukas@statuscode.ch> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace OCP\AppFramework\Http; | ||
|
||
use OCP\AppFramework\Http; | ||
|
||
/** | ||
* A renderer for text responses | ||
* @since 22.0.0 | ||
*/ | ||
class TextPlainResponse extends Response { | ||
/** @var string */ | ||
private $text = ''; | ||
|
||
/** | ||
* constructor of TextPlainResponse | ||
* @param string $text The text body | ||
* @param int $statusCode the Http status code, defaults to 200 | ||
* @since 22.0.0 | ||
*/ | ||
public function __construct(string $text = '', int $statusCode = Http::STATUS_OK) { | ||
parent::__construct(); | ||
|
||
$this->text = $text; | ||
$this->setStatus($statusCode); | ||
$this->addHeader('Content-Type', 'text/plain'); | ||
} | ||
|
||
|
||
/** | ||
* Returns the text | ||
* @return string | ||
* @since 22.0.0 | ||
* @throws \Exception If data could not get encoded | ||
*/ | ||
public function render() : string { | ||
return $this->text; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you plan to extend this manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Dynamic also seems a bit dishonest in case this ever gets changed 🙈 (I was thinking of making each end-of-year release extend this for a year or such)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also always extend it when a new stable branch is branched of and up it to "in 1 year"
Then it matches the EOL of the major version?