Skip to content

Commit d66890a

Browse files
committed
Merge branch 'preserve_entropy' into 1.3.x
2 parents 79b6f29 + 9944873 commit d66890a

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

Changelog.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
Changelog
22
=========
33

4+
### 1.3.5 (2014-09-04)
5+
6+
This release fixes a security issue. You are encouraged to update
7+
as soon as possible.
8+
9+
BC break: The characters used in generated tokens have changed. They
10+
now include dashes and underscores as well. Any routing requirement
11+
matching them should be updated to ``[\w\-]+``.
12+
13+
* Fixed the TokenGenerator to preserve entropy.
14+
415
### 1.3.4 (2014-06-13)
516

617
* Fixed the compatibility with FrameworkBundle 2.5

Upgrade.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ Upgrade instruction
44
This document describes the changes needed when upgrading because of a BC
55
break. For the full list of changes, please look at the Changelog file.
66

7+
## 1.3.4 to 1.3.5
8+
9+
The characters used in generated tokens have changed. They now include dashes
10+
and underscores as well. Any routing requirement matching them should be
11+
updated to ``[\w\-]+``.
12+
13+
Before:
14+
15+
```yaml
16+
my_route:
17+
path: /{token}
18+
requirement:
19+
token: \w+
20+
```
21+
22+
After:
23+
24+
```yaml
25+
my_route:
26+
path: /{token}
27+
requirement:
28+
token: '[\w\-]+'
29+
```
30+
731
## 1.2 to 1.3
832
933
### Forms

Util/TokenGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function __construct(LoggerInterface $logger = null)
3737

3838
public function generateToken()
3939
{
40-
return base_convert(bin2hex($this->getRandomNumber()), 16, 36);
40+
return rtrim(strtr(base64_encode($this->getRandomNumber()), '+/', '-_'), '=');
4141
}
4242

4343
private function getRandomNumber()

0 commit comments

Comments
 (0)