File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments