mask passphrases in logs for PHP < 8.2

This commit is contained in:
the-djmaze 2024-02-20 11:22:28 +01:00
parent 479452ad7b
commit ec0d92bfac
2 changed files with 11 additions and 6 deletions

View file

@ -113,10 +113,10 @@ trait Pgp
return $this->FalseResponse();
}
$GPG->addDecryptKey(
$this->GetActionParam('keyId', ''),
$this->GetActionParam('passphrase', '')
);
$sPassphrase = $this->GetActionParam('passphrase', '');
$this->logMask($sPassphrase);
$GPG->addDecryptKey($this->GetActionParam('keyId', ''), $sPassphrase);
$sData = $this->GetActionParam('data', '');
$oPart = null;
@ -160,10 +160,12 @@ trait Pgp
public function DoGnupgExportKey() : array
{
$sPassphrase = $this->GetActionParam('passphrase', '');
$this->logMask($sPassphrase);
$GPG = $this->GnuPG();
return $this->DefaultResponse($GPG ? $GPG->export(
$this->GetActionParam('keyId', ''),
$this->GetActionParam('passphrase', '')
$sPassphrase
) : false);
}
@ -174,9 +176,11 @@ trait Pgp
if ($GPG) {
$sName = $this->GetActionParam('name', '');
$sEmail = $this->GetActionParam('email', '');
$sPassphrase = $this->GetActionParam('passphrase', '');
$this->logMask($sPassphrase);
$fingerprint = $GPG->generateKey(
$sName ? "{$sName} <{$sEmail}>" : $sEmail,
$this->GetActionParam('passphrase', '')
$sPassphrase
);
}
return $this->DefaultResponse($fingerprint);

View file

@ -62,6 +62,7 @@ trait SMime
$sName = $this->GetActionParam('name', '') ?: $oAccount->Name();
$sEmail = $this->GetActionParam('email', '') ?: $oAccount->Email();
$sPassphrase = $this->GetActionParam('passphrase', '');
$this->logMask($sPassphrase);
$cert = new Certificate();
$cert->distinguishedName['commonName'] = $sName;