Skip to content

use HSTS when doing request with the HttpClient - #34553

Closed
rullzer wants to merge 2 commits into
masterfrom
use_HSTS
Closed

use HSTS when doing request with the HttpClient#34553
rullzer wants to merge 2 commits into
masterfrom
use_HSTS

Conversation

@rullzer

Copy link
Copy Markdown
Member

Time to ensure that if a server we talk to supports HSTS we actually store this info and use it.

Help and commits to this branch are appreciated.

TODO

  • cleanup ;)

Future work:

  • Use preload list
  • Extract HSTS logic a bit more (maybe add a public itnerface somewhere?)
  • Use for other clients as well

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzerrullzer added this to the Nextcloud 26 milestone Oct 12, 2022
@rullzerrullzer added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 12, 2022

$expires = $this->timeFactory->getTime() + $maxAge;

$qb = $this->db->getQueryBuilder();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we maybe make hosts unique and if we get an unique exeption when trying to insert then we try updating. Save one DB query in some cases

Also we probably should try to catch data races

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment threadcore/Migrations/Version26000Date20221011203714.php Fixed
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {

Check failure

Code scanning / Psalm

MoreSpecificImplementedParamType

Argument 2 of OC\Core\Migrations\Version26000Date20221011203714::changeSchema has the more specific type 'Closure():OCP\DB\ISchemaWrapper', expecting 'Closure' as defined by OCP\Migration\SimpleMigrationStep::changeSchema
Comment threadcore/Migrations/Version26000Date20221011203714.php Fixed

if ($data !== false
&& $this->timeFactory->getTime() < $data['expires']
&& (!$includeSubdomain || ($includeSubdomain && $data['includeSubdomains']))

Check failure

Code scanning / Psalm

RedundantCondition

Type true for $includeSubdomain is never falsy

$request = $this->handleHSTSRewrite($request);

$this->logger->warning("GONNA REQUEST");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah plenty of those


return $handler($request, $options)
->then(function (ResponseInterface $response) use ($request) {
$this->logger->error("GOT RESPONSE");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug

@blizzzblizzz mentioned this pull request Feb 1, 2023
@skjnldsvskjnldsv mentioned this pull request Feb 23, 2023
@blizzzblizzz mentioned this pull request Mar 7, 2023
@blizzzblizzz modified the milestones: Nextcloud 26, Nextcloud 27Mar 9, 2023
This was referenced May 3, 2023
@skjnldsvskjnldsv mentioned this pull request Nov 1, 2023
This was referenced Nov 6, 2023
This was referenced Nov 14, 2023
@blizzzblizzz modified the milestones: Nextcloud 28, Nextcloud 29Nov 23, 2023
@AltahrimAltahrim mentioned this pull request Mar 12, 2024
This was referenced Mar 14, 2024
@AltahrimAltahrim mentioned this pull request Mar 25, 2024
@skjnldsvskjnldsv mentioned this pull request Mar 28, 2024
81 tasks
This was referenced Jul 30, 2024
@AltahrimAltahrim mentioned this pull request Aug 5, 2024
@skjnldsvskjnldsv removed this from the Nextcloud 31 milestone Aug 14, 2024
@skjnldsv
skjnldsv deleted the use_HSTS branch August 30, 2024 07:30
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@rullzer@nickvergessen@CarlSchwan@github-advanced-security@blizzz@skjnldsv