mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #2367
This commit is contained in:
parent
2ddf48f15c
commit
e80d616ef4
@ -60,6 +60,9 @@ class NewFinTSJobHandler implements FinTSConfigurationInterface
|
||||
$config['fints_password'] = (string)(Crypt::encrypt($data['fints_password']) ?? '');
|
||||
$config['apply-rules'] = 1 === (int)$data['apply_rules'];
|
||||
|
||||
// sanitize FinTS URL.
|
||||
$config['fints_url'] = $this->validURI($config['fints_url']) ? $config['fints_url'] : '';
|
||||
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
|
||||
|
||||
@ -108,4 +111,21 @@ class NewFinTSJobHandler implements FinTSConfigurationInterface
|
||||
$this->repository->setUser($importJob->user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fints_url
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function validURI(string $fintsUri): bool
|
||||
{
|
||||
$res = filter_var($fintsUri, FILTER_VALIDATE_URL);
|
||||
if (false === $res) {
|
||||
return false;
|
||||
}
|
||||
$scheme = parse_url($fintsUri, PHP_URL_SCHEME);
|
||||
|
||||
return 'https' === $scheme;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user