Skip to content

Commit 5c4bc0f

Browse files
committed
Merge branch 'release/0.8.12'
2 parents 7fbda67 + 67c69b8 commit 5c4bc0f

8 files changed

Lines changed: 38 additions & 15 deletions

File tree

.version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"strategy": "semver",
33
"major": 0,
44
"minor": 8,
5-
"patch": 11,
5+
"patch": 12,
66
"build": 0
77
}

src/Cli/Commands/Secrets/EditCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ public function execute(): int
5757
$configPath = $this->input->getOption( 'config', 'config' );
5858
$env = $this->input->getOption( 'env' );
5959

60+
// Validate environment name to prevent path traversal
61+
if( $env && !preg_match( '/^[a-zA-Z0-9_-]+$/', $env ) )
62+
{
63+
$this->output->error( "Invalid environment name. Only letters, numbers, hyphens, and underscores are allowed." );
64+
return 1;
65+
}
66+
6067
// Handle editor option - could be null, true (flag without value), or a string
6168
$editorOption = $this->input->getOption( 'editor' );
6269
if( is_string( $editorOption ) && $editorOption !== '' )
@@ -71,8 +78,8 @@ public function execute(): int
7178
// Determine paths based on environment
7279
if( $env )
7380
{
74-
$credentialsPath = $configPath . '/secrets/' . $env . '.yml.enc';
75-
$keyPath = $configPath . '/secrets/' . $env . '.key';
81+
$credentialsPath = $configPath . '/environments/' . $env . '.secrets.yml.enc';
82+
$keyPath = $configPath . '/environments/' . $env . '.key';
7683
$this->output->info( "Editing {$env} environment secrets..." );
7784
}
7885
else

src/Cli/Commands/Secrets/Key/GenerateCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,17 @@ public function execute(): int
6060
$force = $this->input->hasOption( 'force' );
6161
$show = $this->input->hasOption( 'show' );
6262

63+
// Validate environment name to prevent path traversal
64+
if( $env && !preg_match( '/^[a-zA-Z0-9_-]+$/', $env ) )
65+
{
66+
$this->output->error( "Invalid environment name. Only letters, numbers, hyphens, and underscores are allowed." );
67+
return 1;
68+
}
69+
6370
// Determine key path based on environment
6471
if( $env )
6572
{
66-
$keyPath = $configPath . '/secrets/' . $env . '.key';
73+
$keyPath = $configPath . '/environments/' . $env . '.key';
6774
$keyName = $env . ' environment key';
6875

6976
// Ensure directory exists

src/Cli/Commands/Secrets/ShowCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ public function execute(): int
6161
$specificKey = $this->input->getOption( 'key' );
6262
$force = $this->input->hasOption( 'force' );
6363

64+
// Validate environment name to prevent path traversal
65+
if( $env && !preg_match( '/^[a-zA-Z0-9_-]+$/', $env ) )
66+
{
67+
$this->output->error( "Invalid environment name. Only letters, numbers, hyphens, and underscores are allowed." );
68+
return 1;
69+
}
70+
6471
// Security confirmation for production
6572
if( !$force && $env === 'production' )
6673
{
@@ -76,8 +83,8 @@ public function execute(): int
7683
// Determine paths based on environment
7784
if( $env )
7885
{
79-
$credentialsPath = $configPath . '/secrets/' . $env . '.yml.enc';
80-
$keyPath = $configPath . '/secrets/' . $env . '.key';
86+
$credentialsPath = $configPath . '/environments/' . $env . '.secrets.yml.enc';
87+
$keyPath = $configPath . '/environments/' . $env . '.key';
8188
$title = ucfirst( $env ) . " Environment Secrets";
8289
}
8390
else

tests/Cli/Commands/Secrets/EditCommandTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ public function testExecuteWithEnvironment(): void
143143
$result = $this->command->execute();
144144
$outputContent = ob_get_clean();
145145

146-
$keyPath = $this->testConfigPath . '/secrets/production.key';
147-
$credentialsPath = $this->testConfigPath . '/secrets/production.yml.enc';
146+
$keyPath = $this->testConfigPath . '/environments/production.key';
147+
$credentialsPath = $this->testConfigPath . '/environments/production.secrets.yml.enc';
148148

149149
// Execute should succeed
150150
$this->assertEquals( 0, $result );
@@ -185,9 +185,9 @@ public function testExecuteCreatesEnvironmentDirectory(): void
185185
$result = $this->command->execute();
186186
$outputContent = ob_get_clean();
187187

188-
$secretsDir = $this->testConfigPath . '/secrets';
188+
$secretsDir = $this->testConfigPath . '/environments';
189189
$keyPath = $secretsDir . '/staging.key';
190-
$credentialsPath = $secretsDir . '/staging.yml.enc';
190+
$credentialsPath = $secretsDir . '/staging.secrets.yml.enc';
191191

192192
// Execute should succeed
193193
$this->assertEquals( 0, $result );

tests/Cli/Commands/Secrets/Key/GenerateCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public function testExecuteGeneratesEnvironmentKey(): void
113113
$this->assertEquals( 0, $result );
114114

115115
// Directory and key file should exist
116-
$this->assertDirectoryExists( $this->testConfigPath . '/secrets' );
117-
$keyPath = $this->testConfigPath . '/secrets/production.key';
116+
$this->assertDirectoryExists( $this->testConfigPath . '/environments' );
117+
$keyPath = $this->testConfigPath . '/environments/production.key';
118118
$this->assertFileExists( $keyPath );
119119

120120
// Check output contains success message

tests/Cli/Commands/Secrets/ShowCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ public function testExecuteShowsSpecificKey(): void
142142
public function testExecuteProductionConfirmation(): void
143143
{
144144
// Create test secrets for production environment
145-
mkdir( $this->testConfigPath . '/secrets', 0755, true );
146-
$keyPath = $this->testConfigPath . '/secrets/production.key';
147-
$credentialsPath = $this->testConfigPath . '/secrets/production.yml.enc';
145+
mkdir( $this->testConfigPath . '/environments', 0755, true );
146+
$keyPath = $this->testConfigPath . '/environments/production.key';
147+
$credentialsPath = $this->testConfigPath . '/environments/production.secrets.yml.enc';
148148

149149
$key = $this->secretManager->generateKey( $keyPath );
150150

versionlog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 0.8.12 2026-01-12
2+
13
## 0.8.11 2026-01-06
24

35
## 0.8.10 2026-01-06

0 commit comments

Comments
 (0)