Skip to content

Firewall ContextListener Ignores #Ignore Attribute During Serialization #59094

@tugrul

Description

@tugrul

Symfony version(s) affected

6.4.15

Description

The ContextListener in Symfony uses the native PHP serializer, which does not respect the #Ignore attribute on user object fields. This results in the entire user object, including sensitive fields, being serialized into the session.

How to reproduce

Just put a breakpoint at line 172 and see $token variable on inspector.

https://github.com/symfony/security-http/blob/7.2/Firewall/ContextListener.php#L172

Possible Solution

The session storage should respect the #Ignore attribute to avoid serializing unnecessary or sensitive fields.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions