Skip to content

Commit 5d09ea7

Browse files
committed
Merge branch '5.x' into 6.x
# Conflicts: # CHANGELOG.md
2 parents 01f8320 + 2e9e4ac commit 5d09ea7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/Facades/Endpoint/Parse.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ public function config($value)
109109
return preg_replace_callback('/\{\{\s*config[\.:]([\w\.\:]+)\s*\}\}/', function ($matches) {
110110
$key = str_replace(':', '.', $matches[1]);
111111

112+
if (strtolower($key) === 'app.key') {
113+
return '';
114+
}
115+
112116
return config($key, '');
113117
}, $value);
114118
}

tests/Facades/ParseTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,18 @@ public static function configPlaceholdersDataProvider(): array
6767
'null passthrough' => [null, null],
6868
];
6969
}
70+
71+
#[Test]
72+
public function app_key_is_banned_from_config_parsing()
73+
{
74+
config([
75+
'app.key' => 'secret',
76+
'foo.bar' => 'baz',
77+
]);
78+
79+
$this->assertSame('', Parse::config('{{ config:app:key }}'));
80+
$this->assertSame('', Parse::config('{{ config.app.key }}'));
81+
$this->assertSame('', Parse::config('{{ config.app:key }}'));
82+
$this->assertSame('prefix baz suffix', Parse::config('prefix {{ config:app:key }} {{ config:foo:bar }} suffix'));
83+
}
7084
}

0 commit comments

Comments
 (0)