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

Fix singleton functionality of Asana_Interface::get_client() #143

Open
MichelleBlanchette opened this issue Apr 27, 2023 · 1 comment
Open
Labels
cleanup Improves code organization and usability performance Changes related to performance optimization security Security vulnerability or tightening

Comments

@MichelleBlanchette
Copy link
Collaborator

Asana_Interface should instead maintain a map of its "instances" rather than having separate, individual static member variables. Additionally, I think get_client() and its counterparts should explicitly require a user ID be passed to it.

When authenticating multiple users within one session, such as when retrieving and testing "connected users", the authentication is lost each time the singleton loads a new client and user identity. This gets incredibly confusing and insecure as authentication happens across PHP files, function calls, and even processes (such as AJAX functionality).

This has been a problem I've repeatedly tried to fix, but it involves a massive amount of regression testing since this basically the core functionality.

While it's tempting to simply create an Asana_User instantiation class, you should keep in mind that an authenticated Asana client is often passed around between scripts. This is why a singleton was initially decided on being used, because it stores its instances in memory by default.

Additionally, I don't like all the uncaught exceptions, though it is important to distinguish errors (and their associated codes and messages) from actually empty or null data returns.

@MichelleBlanchette MichelleBlanchette added bug Something isn't working cleanup Improves code organization and usability performance Changes related to performance optimization and removed bug Something isn't working labels Apr 27, 2023
@MichelleBlanchette
Copy link
Collaborator Author

This would be a good opportunity to refactor/rewrite all Asana client-related code anyways since #217 and the PHP SDK seems to no longer be actively maintained...

@MichelleBlanchette MichelleBlanchette added the security Security vulnerability or tightening label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Improves code organization and usability performance Changes related to performance optimization security Security vulnerability or tightening
Projects
None yet
Development

No branches or pull requests

1 participant