Back to all reviewers

minimize public API exposure

facebook/react-native
Based on 1 comments
Other

Keep internal implementation details private to reduce security attack surface. Public properties in header files can be accessed and potentially manipulated by external code, creating security vulnerabilities. Store internal state using private instance variables in the implementation file instead of exposing them through public properties.

Security Other

Reviewer Prompt

Keep internal implementation details private to reduce security attack surface. Public properties in header files can be accessed and potentially manipulated by external code, creating security vulnerabilities. Store internal state using private instance variables in the implementation file instead of exposing them through public properties.

Example of the security issue:

// โŒ Bad - exposes internal state publicly
@property (nonatomic, assign) BOOL isFirstRender;
@property (nonatomic, strong) NSArray<UIBarButtonItemGroup *> *initialValueLeadingBarButtonGroups;

Secure alternative:

// โœ… Good - keep internal state private
@implementation ClassName {
    BOOL isFirstRender;
    NSArray<UIBarButtonItemGroup *> *initialValueLeadingBarButtonGroups;
}

This follows the principle of least privilege by only exposing what external consumers actually need to access, reducing the potential for security exploits through API misuse.

1
Comments Analyzed
Other
Primary Language
Security
Category

Source Discussions