Skip to content
This repository was archived by the owner on Jan 13, 2022. It is now read-only.

Commit 810c127

Browse files
committed
Merge pull request #582 from facebook/fix-object-injection
Avoids using unserialize to prevent Object Injection security issue.
2 parents c51f90d + 3279e1b commit 810c127

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ Starting with version 5, the Facebook PHP SDK follows [SemVer](http://semver.org
66
## 5.0.x
77

88
Version 5 of the Facebook PHP SDK is a complete refactor of version 4. It comes loaded with lots of new features and a friendlier API.
9-
9+
- 5.1.4
10+
- Breaking changes
11+
- Changes the serialization method of FacebookApp
12+
- FacebookApps serialized by versions prior 5.1.4 cannot be unserialized by this version
1013
- 5.0 (2015-??-??)
1114
- New features
1215
- Added the `Facebook\Facebook` super service for an easier API
@@ -22,8 +25,8 @@ Version 5 of the Facebook PHP SDK is a complete refactor of version 4. It comes
2225
- Many improvements to the Graph node subtypes
2326
- New injectable interfaces
2427
- Added a `PersistentDataInterface` for custom persistent data handling
25-
- Added a `PseudoRandomStringGeneratorInterface` for customizable CSPRNG's
26-
- Added a `UrlDetectionInterface` for custom URL-detection logic
28+
- Added a `PseudoRandomStringGeneratorInterface` for customizable CSPRNG's
29+
- Added a `UrlDetectionInterface` for custom URL-detection logic
2730
- Codebase changes
2831
- Moved exception classes to `Exception\*` directory
2932
- Moved response collection objects to `GraphNodes\*` directory

src/Facebook/FacebookApp.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function getAccessToken()
8484
*/
8585
public function serialize()
8686
{
87-
return serialize([$this->id, $this->secret]);
87+
return implode('|', [$this->id, $this->secret]);
8888
}
8989

9090
/**
@@ -94,7 +94,7 @@ public function serialize()
9494
*/
9595
public function unserialize($serialized)
9696
{
97-
list($id, $secret) = unserialize($serialized);
97+
list($id, $secret) = explode('|', $serialized);
9898

9999
$this->__construct($id, $secret);
100100
}

0 commit comments

Comments
 (0)