Skip to content

Restrict access to clone #20

@broneill

Description

@broneill

The Object.clone method poses a security risk when a subclass enables cloning. It allows superclass fields to be shared by multiple instances when they might not be sharable. Consider thread-safety, for example.

One possible solution: The clone method should be denied as if a checked deny action was defined for it. If the object isn't an instance of Cloneable, then allow the operation because it cannot call the default clone implementation. If all superclasses (other than Object) are defined in the caller module, or if the clone method isn't the default Object.clone method, then allow the operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions