Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0472dbf

Browse files
committed
bug #34145 [FrameworkBundle] make SodiumVault report bad decryption key accurately (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] make SodiumVault report bad decryption key accurately | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- d9d16d2 [FrameworkBundle] make SodiumVault report bad decryption key accurately
2 parents 0a1de38 + d9d16d2 commit 0472dbf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,13 @@ public function reveal(string $name): ?string
115115
return null;
116116
}
117117

118-
return sodium_crypto_box_seal_open(include $file, $this->decryptionKey);
118+
if (false === $value = sodium_crypto_box_seal_open(include $file, $this->decryptionKey)) {
119+
$this->lastMessage = sprintf('Secrets cannot be revealed as the wrong decryption key was provided for "%s".', $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
120+
121+
return null;
122+
}
123+
124+
return $value;
119125
}
120126

121127
public function remove(string $name): bool

0 commit comments

Comments
 (0)