File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,11 +37,15 @@ private function getTrustBoundary(
3737 return null ;
3838 }
3939
40+ if (array_key_exists ('x-allowed-locations ' , $ headers )) {
41+ // If the headers are already set, do not set them
42+ return null ;
43+ }
44+
4045 // Return cached value if it exists
4146 if ($ cached = $ this ->getCachedValue ($ this ->getCacheKey () . ':trustboundary ' )) {
4247 return $ cached ;
4348 }
44-
4549 if (!array_key_exists ('authorization ' , $ headers )) {
4650 // If we don't have an authorization token we can't look up the trust boundary
4751 return null ;
Original file line number Diff line number Diff line change @@ -144,6 +144,19 @@ public function testSkipLookupOutsideDefaultUniverseDomain()
144144 $ this ->assertNull ($ result1 );
145145 }
146146
147+ public function testSkipLookupIfXAllowedLocationsAreAlreadySet ()
148+ {
149+ // First call, should fetch and cache
150+ $ result1 = $ this ->impl ->getTrustBoundary (
151+ 'universe.domain ' ,
152+ fn () => throw new \Exception ('Should not be called ' ),
153+ 'default ' ,
154+ ['authorization ' => ['xyz ' ], ['x-allowed-locations ' => 'abc ' ]]
155+ );
156+
157+ $ this ->assertNull ($ result1 );
158+ }
159+
147160 public function testLookupIsFailOpen ()
148161 {
149162 $ mock = new MockHandler ([
You can’t perform that action at this time.
0 commit comments