Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf8dd87d

Browse files
committed
[WebProfilerBundle] Fix CORS ajax security issues
1 parent66da91d commitf8dd87d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@
8080
8181
requestStack= [],
8282
83+
extractHeaders=function(xhr,stackElement) {
84+
// Here we avoid to call xhr.getResponseHeader in order to
85+
// prevent polluting the console with CORS security errors
86+
var allHeaders=xhr.getAllResponseHeaders();
87+
var ret;
88+
89+
if (ret=allHeaders.match(/^x-debug-token:\s+(.*)$/im)) {
90+
stackElement.profile= ret[1];
91+
}
92+
if (ret=allHeaders.match(/^x-debug-token-link:\s+(.*)$/im)) {
93+
stackElement.profilerUrl= ret[1];
94+
}
95+
},
96+
8397
renderAjaxRequests=function() {
8498
var requestCounter=document.querySelectorAll('.sf-toolbar-ajax-requests');
8599
if (!requestCounter.length) {
@@ -239,8 +253,8 @@
239253
stackElement.duration=newDate()-stackElement.start;
240254
stackElement.loading=false;
241255
stackElement.error=self.status<200||self.status>=400;
242-
stackElement.profile=self.getResponseHeader("X-Debug-Token");
243-
stackElement.profilerUrl=self.getResponseHeader("X-Debug-Token-Link");
256+
257+
extractHeaders(self, stackElement);
244258
245259
Sfjs.renderAjaxRequests();
246260
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp