Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fields in a Serializable class must be transient or Serializable #2676

Closed
bencomp opened this issue Oct 22, 2015 · 1 comment
Closed

Fields in a Serializable class must be transient or Serializable #2676

bencomp opened this issue Oct 22, 2015 · 1 comment

Comments

@bencomp
Copy link
Contributor

bencomp commented Oct 22, 2015

SonarQube found (as of commit a0bc225) 374 violations of the rule "Fields in a Serializable class should either be transient or serializable", marking these violations as critical issues.

Rationale:

Fields in a Serializable class must themselves be either Serializable or transient even if the class is never explicitly serialized or deserialized. That's because under load, most J2EE application frameworks flush objects to disk, and an allegedly Serializable object with non-transient, non-serializable data members could cause program crashes, and open the door to attackers.

I recognise the described J2EE application framework behaviour, as at times our DVN 3.6 installation, that also has plenty of violations like these, tries to serialise the EntityManager to disk and then complains in lots of log lines that it's not serializable.

Serializable classes should also have a private static final long serialVersionUID, but that is only a 'minor' issue in SonarQube's default quality profile, not a critical one.

@mercecrosas mercecrosas modified the milestone: In Review Nov 30, 2015
@mheppler mheppler added the Component: Code Infrastructure formerly "Feature: Code Infrastructure" label Jan 28, 2016
@scolapasta scolapasta modified the milestone: Not Assigned to a Release Jan 28, 2016
@pdurbin
Copy link
Member

pdurbin commented Jun 29, 2017

Closing to consolidate into #3950.

@pdurbin pdurbin closed this as completed Jun 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants