Skip to content

Commit c304da2

Browse files
feat: encrypt *_token secrets
1 parent c245156 commit c304da2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Console/EnvironmentEncryptCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EnvironmentEncryptCommand extends BaseEncryptCommand
1818
{--env= : The environment to be encrypted}
1919
{--force : Overwrite the existing encrypted environment file}
2020
{--only-values : Encrypt only the values to keep the file readable}
21-
{--only=**_KEY,*_SECRET,*_PASSWORD : Encrypt only variables that match provided comma-separated patterns, by default values with *_KEY, *_SECRET and *_PASSWORD will be encrypted}
21+
{--only=**_KEY,*_SECRET,*_PASSWORD,*_TOKEN : Encrypt only variables that match provided comma-separated patterns, by default values with *_KEY, *_SECRET, *_TOKEN and *_PASSWORD will be encrypted}
2222
{--all : Ignore the --only flag and default patterns to encrypt all variables}';
2323

2424
public function handle()

tests/Integration/EnvironmentEncryptCommandTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
APP_ENV=local
2525
APP_DEBUG=true
2626
APP_URL=http://localhost
27+
API_TOKEN=secret
2728
Text;
2829

2930
$this->filesystem->shouldReceive('exists')
@@ -43,10 +44,10 @@
4344
$this->assertStringContainsString('APP_DEBUG', $contents);
4445
$this->assertStringContainsString('APP_URL', $contents);
4546
$this->assertStringContainsString('APP_KEY', $contents);
47+
$this->assertStringContainsString('http://localhost', $contents);
4648

4749
$this->assertEquals('1234', $encrypter->decrypt(Str::betweenFirst($contents, '=', "\n")));
48-
49-
$this->assertEquals('http://localhost', Str::afterLast($contents, '='));
50+
$this->assertEquals('secret', $encrypter->decrypt(Str::afterLast($contents, '=')));
5051

5152
return true;
5253
})->andReturn(true);

0 commit comments

Comments
 (0)