Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

The squareconnect.configuration object can become corrupted #40

@GrayHatter

Description

@GrayHatter

Despite what the contribution guidelines say (no issues, pulls, suggestions, or requests) @tristansokol asked me to open this issue for further discussion.

Because the squareconnect.configuration is a library level global. The instance is vulnerable to becoming corrupt. A race condition exists where the access_token could be set, [changed by a different thread], and then accessed causing an error that would be very difficult for clients to track down.

The squareconnect.configuration shouldn't be a library global, shouldn't be coerced into a singleton, and (if a configuration class is really the way you want to handle setup/init), should be internal to each API, or at the very least; a variable held by an additional API wrapper that can be passed to each lower API during creation.

@tristansokol suggested that changing the access_token after setting it is a valid use case you need to support, but I'm unable to think of a use case that won't make me sad to read if I later had to maintain said code.

@robinlinden

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