Skip to content

Commit a17c165

Browse files
committed
Fix typo
1 parent d5ad8cd commit a17c165

File tree

8 files changed

+27
-19
lines changed

8 files changed

+27
-19
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
4.4.0
5+
-----
6+
7+
* Added secrets management.
8+
49
4.3.0
510
-----
611

@@ -32,7 +37,6 @@ CHANGELOG
3237
* Added a `InMemoryTransport` to Messenger. Use it with a DSN starting with `in-memory://`.
3338
* Added `framework.property_access.throw_exception_on_invalid_property_path` config option.
3439
* Added `cache:pool:list` command to list all available cache pools.
35-
* Added secrets management.
3640

3741
4.2.0
3842
-----

src/Symfony/Bundle/FrameworkBundle/Command/SecretsAddCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5454
try {
5555
$this->secretsStorage->putSecret($key, $secret);
5656
} catch (EncryptionKeyNotFoundException $e) {
57-
throw new \LogicException(sprintf('No encryption key found. You should call the command "%s"', SecretsGenerateKeyCommand::getDefaultName()));
57+
throw new \LogicException(sprintf('No encryption keys found. You should call the "%s" command.', SecretsGenerateKeyCommand::getDefaultName()));
5858
}
5959
}
6060

@@ -66,7 +66,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
6666
while (empty($key)) {
6767
$key = $io->askQuestion(new Question('Key of the secret'));
6868
if (empty($key)) {
69-
$io->warning('The "key" should not be empty.');
69+
$io->warning('The "key" cannot be empty.');
7070
}
7171
}
7272
$input->setArgument('key', $key);
@@ -75,7 +75,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
7575
if (empty($secret)) {
7676
$question = new Question('Plaintext secret value', $input->getArgument('secret'));
7777
$question->setHidden(true);
78-
$secret = $io->askQuestion((new Question('Plaintext secret value'))->setHidden(true));
78+
$secret = $io->askQuestion($question);
7979
$input->setArgument('secret', (string) $secret);
8080
}
8181
}

src/Symfony/Bundle/FrameworkBundle/Command/SecretsGenerateKeyCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function configure()
4141
{
4242
$this
4343
->setDescription('Generate a new secret key.')
44-
->addOption('force', 'f', InputOption::VALUE_NONE, 'override previous key.');
44+
->addOption('force', 'f', InputOption::VALUE_NONE, 'Override previous key.');
4545
}
4646

4747
protected function execute(InputInterface $input, OutputInterface $output)

src/Symfony/Bundle/FrameworkBundle/Command/SecretsListCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ final class SecretsListCommand extends Command
2727
{
2828
protected static $defaultName = 'secrets:list';
2929

30-
/**
31-
* @var SecretStorageInterface
32-
*/
3330
private $secretStorage;
3431

3532
public function __construct(SecretStorageInterface $secretStorage)
@@ -43,7 +40,7 @@ protected function configure()
4340
{
4441
$this
4542
->setDescription('Lists all secrets.')
46-
->addOption('reveal', 'r', InputOption::VALUE_NONE, 'display plain text value alongside keys');
43+
->addOption('reveal', 'r', InputOption::VALUE_NONE, 'Display plain text value along side keys');
4744
}
4845

4946
protected function execute(InputInterface $input, OutputInterface $output)

src/Symfony/Bundle/FrameworkBundle/Exception/SecretNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class SecretNotFoundException extends \RuntimeException
1818
public function __construct(string $name)
1919
{
2020
$this->name = $name;
21-
parent::__construct(\sprintf('The secret "%s" does not exists', $name));
21+
parent::__construct(\sprintf('The secret "%s" does not exist.', $name));
2222
}
2323

2424
public function getName(): string

src/Symfony/Bundle/FrameworkBundle/Secret/FilesSecretStorage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FilesSecretStorage implements MutableSecretStorageInterface
2929

3030
public function __construct(string $secretsFolder, EncoderInterface $encoder)
3131
{
32-
$this->secretsFolder = rtrim($secretsFolder, \DIRECTORY_SEPARATOR);
32+
$this->secretsFolder = rtrim($secretsFolder, '\\/');
3333
$this->encoder = $encoder;
3434
$this->filesystem = new Filesystem();
3535
}
@@ -40,7 +40,7 @@ public function __construct(string $secretsFolder, EncoderInterface $encoder)
4040
public function listSecrets(bool $reveal = false): iterable
4141
{
4242
if (!$this->filesystem->exists($this->secretsFolder)) {
43-
return;
43+
return [];
4444
}
4545

4646
foreach ((new Finder())->in($this->secretsFolder)->depth(0)->name('*'.self::FILE_SUFFIX)->files() as $file) {

src/Symfony/Bundle/FrameworkBundle/Secret/SecretStorageInterface.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,22 @@
2121
interface SecretStorageInterface
2222
{
2323
/**
24-
* @param string $name
24+
* Retrieves a plain text secret from the storage.
25+
*
26+
* @param string $name name of the secret
2527
*
2628
* @return string
2729
*
2830
* @throws SecretNotFoundException
2931
*/
3032
public function getSecret(string $name): string;
3133

34+
/**
35+
* Returns a list of all secrets indexed by their name.
36+
*
37+
* @param bool $reveal when true, returns the plain text secret, null otherwise.
38+
*
39+
* @return iterable
40+
*/
3241
public function listSecrets(bool $reveal = false): iterable;
3342
}

src/Symfony/Bundle/FrameworkBundle/Secret/SodiumEncoder.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function generateKeys(bool $override = false): array
3939
{
4040
$path = $this->getKeyPath();
4141
if (!$override && \is_file($path)) {
42-
throw new \LogicException('A key already exist in '.$path);
42+
throw new \LogicException(sprintf('A key already exist in "%s".', $path));
4343
}
4444

4545
$this->encryptionKey = null;
@@ -69,9 +69,7 @@ public function encrypt(string $message): string
6969
private function getKeyPath(): ?string
7070
{
7171
if (null === @\is_file($this->encryptionKeyOrPath)) {
72-
throw new \InvalidArgumentException(
73-
'The path to the encryption key is not valid. Did you configured the framework with the content of key instead of it location?'
74-
);
72+
throw new \InvalidArgumentException('The path to the encryption key is not valid. Did you configured the framework with the content of key instead of its location?');
7573
}
7674

7775
return $this->encryptionKeyOrPath;
@@ -89,7 +87,7 @@ private function getKey(): string
8987
if (true === $isFile) {
9088
return $this->encryptionKey = \file_get_contents($this->encryptionKeyOrPath);
9189
}
92-
// if `encryptionKeyOrPath` is a valid string with the exact length of a KEY, and the file does not exists, we presume it's the key itself
90+
// if `encryptionKeyOrPath` is a valid string with the exact length of a KEY, and the file does not exist, we presume it's the key itself
9391
if (\SODIUM_CRYPTO_STREAM_KEYBYTES === \strlen($this->encryptionKeyOrPath)) {
9492
return $this->encryptionKey = $this->encryptionKeyOrPath;
9593
}
@@ -119,7 +117,7 @@ public function decrypt(string $encryptedText): string
119117
private function decode(string $message): array
120118
{
121119
if (\strlen($message) < \SODIUM_CRYPTO_STREAM_NONCEBYTES) {
122-
throw new \UnexpectedValueException(sprintf('Invalid encryptedText. Message should nbe at lease %d char long.', \SODIUM_CRYPTO_STREAM_NONCEBYTES));
120+
throw new \UnexpectedValueException(sprintf('Invalid encrypted text, message should be at least %s chars long.', \SODIUM_CRYPTO_STREAM_NONCEBYTES));
123121
}
124122

125123
$nonce = substr($message, 0, \SODIUM_CRYPTO_STREAM_NONCEBYTES);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy