Skip to content

Commit 248a9c4

Browse files
author
Arnoldas Grigutis
committed
Protection against rosetta flash attacks
1 parent 0b10231 commit 248a9c4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Controller/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function indexAction(Request $request, $_format)
108108
throw new HttpException(400, 'Invalid JSONP callback value');
109109
}
110110

111-
$content = $callback.'('.$content.');';
111+
$content = '/**/' . $callback . '(' . $content . ');';
112112
}
113113

114114
$response = new Response($content, 200, array('Content-Type' => $request->getMimeType($_format)));

Tests/Controller/ControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testGenerateWithCallback($callback)
9494
$response = $controller->indexAction($this->getRequest('/', 'GET', array('callback' => $callback)), 'json');
9595

9696
$this->assertEquals(
97-
sprintf('%s({"base_url":"","routes":[],"prefix":"","host":"","scheme":""});', $callback),
97+
sprintf('/**/%s({"base_url":"","routes":[],"prefix":"","host":"","scheme":""});', $callback),
9898
$response->getContent()
9999
);
100100
}

0 commit comments

Comments
 (0)