Skip to content

[vendored] RRConfig.h setX: mutators take unannotated NSString — please add explicit nonnull/nullable per parameter #1189

Description

@dariusta

Source

Filed from a downstream consumer (Straton-Labs-LLC/stratton-internal, vendoring WebDriverAgentLib.xcframework).
Tracking ID in our audit: ocr-prelim-06897.

Affected file

WebDriverAgentLib/RodmanRunnerLib/RRConfig.h (vendored header at native/runner/Frameworks/WebDriverAgentLib.xcframework/ios-arm64/RodmanRunnerLib.framework/Headers/RRConfig.h)

Defect

Under the file-wide NS_ASSUME_NONNULL_BEGIN, every NSString * parameter is implicitly nonnull. Several mutators take a string the caller might reasonably want to pass as nil (e.g. clearing a setting) but the header forbids it:

+ (void)setElementResponseAttributes:(NSString *)value;          // should be nullable for "clear"
+ (NSString *)elementResponseAttributes;                        // returns "" or nil?

+ (void)setAcceptAlertButtonSelector:(NSString *)classChainSelector;   // doc says "Setting this value to nil or an empty string" — header lies
+ (NSString *)acceptAlertButtonSelector;

+ (void)setDismissAlertButtonSelector:(NSString *)classChainSelector;
+ (NSString *)dismissAlertButtonSelector;

+ (BOOL)setScreenshotOrientation:(NSString *)orientation error:(NSError **)error;  // see also #06896
+ (NSString *)humanReadableScreenshotOrientation;

The doc-comment for setAcceptAlertButtonSelector: even contradicts the header: it explicitly documents that passing nil or an empty string is the supported way to reset to default behaviour. The compiler is forced to treat that as a contract violation.

Suggested fix

Add explicit per-parameter annotations:

+ (void)setElementResponseAttributes:(nullable NSString *)value;
+ (nullable NSString *)elementResponseAttributes;

+ (void)setAcceptAlertButtonSelector:(nullable NSString *)classChainSelector;
+ (nullable NSString *)acceptAlertButtonSelector;

+ (void)setDismissAlertButtonSelector:(nullable NSString *)classChainSelector;
+ (nullable NSString *)dismissAlertButtonSelector;

For setScreenshotOrientation:error:, orientation is documented as required (case-insensitive portrait/landscape*/auto), so keep it nonnull; only the error parameter is the nullability miss (tracked in a separate issue).

For the accessors, return nullable NSString * so callers can distinguish "set to nil" from "set to empty string" from "never set".

Why this matters downstream

Static analysers (clang's -Wnullable-to-nonnull-conversion, Swift's bridging) flag every nil call to these setters as a warning. Either the framework pins nullability properly or downstream has to disable the diagnostic globally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions