Skip to content

Security: Restrict allowed classes in Sequence::getUnSerializeGraph()#8579

Merged
AngelFQC merged 1 commit into
masterfrom
security/auto-fix-GHSA-2c5g-hrhg-44vg
Jun 11, 2026
Merged

Security: Restrict allowed classes in Sequence::getUnSerializeGraph()#8579
AngelFQC merged 1 commit into
masterfrom
security/auto-fix-GHSA-2c5g-hrhg-44vg

Conversation

@AngelFQC

@AngelFQC AngelFQC commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

Sequence::getUnSerializeGraph() (src/CoreBundle/Entity/Sequence.php) called bare unserialize() on the sequence.graph column with no class restriction, allowing any autoloadable PHP class to be instantiated during deserialization — a PHP Object Injection sink (CWE-502).

Refs GHSA-2c5g-hrhg-44vg

Fix

Route the call through the codebase's canonical helper UnserializeApi::unserialize() (public/main/inc/lib/UnserializeApi.php) using the existing 'sequence_graph' type, which already defines the allowlist for serialized sequence graphs:

  • Graph, VerticesMap, Vertices, Edges, Vertex, Edge\Base, Directed, Undirected

This reuses the same allowlisted-deserialization mechanism applied elsewhere in the project (course backups, LP, ExternalTool) instead of inlining a per-call allowlist, keeping the policy centralized.

Invariant now enforced

Deserializing sequence.graph can only instantiate the whitelisted Fhaculty\Graph classes. Any other serialized class (e.g. a gadget-chain payload) is decoded to __PHP_Incomplete_Class and its __destruct/__wakeup never runs — closing the object-injection path regardless of how the column was written.

OWASP control

A08:2021 — Software and Data Integrity Failures (insecure deserialization).

🤖 Generated with Claude Code

Refs GHSA-2c5g-hrhg-44vg

Route Sequence::getUnSerializeGraph() through UnserializeApi::unserialize()
with the existing 'sequence_graph' type, which restricts instantiation to
the Fhaculty\Graph classes that legitimately compose a serialized sequence
graph. This closes the PHP Object Injection path that allowed arbitrary
class instantiation from the sequence.graph column, reusing the codebase's
canonical allowlisted-deserialization helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AngelFQC AngelFQC force-pushed the security/auto-fix-GHSA-2c5g-hrhg-44vg branch from e46758a to 1dfe99f Compare June 11, 2026 19:42
@AngelFQC AngelFQC merged commit 0b6679a into master Jun 11, 2026
0 of 11 checks passed
@AngelFQC AngelFQC deleted the security/auto-fix-GHSA-2c5g-hrhg-44vg branch June 11, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant