Add assert to check for organization plan name - #31
Merged
Conversation
Alex (alxhotel)
requested review from
Douglas (dacoburn),
John Hiesey (jhiesey) and
André Staltz (staltz)
and removed request for
a team
October 6, 2025 15:53
André Staltz (staltz)
approved these changes
Aug 24, 2026
Alex (alxhotel)
force-pushed
the
alex/fix-plan
branch
from
August 24, 2026 22:32
7e7d641 to
d08c3d7
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Null plan crashes enterprise assert
- Added a None check before calling .lower() on org_plan, treating None as non-enterprise to raise the intended Exception instead of AttributeError.
Or push these changes by commenting:
@cursor push 2eed708b51
Preview (2eed708b51)
diff --git a/socketsync/core.py b/socketsync/core.py
--- a/socketsync/core.py
+++ b/socketsync/core.py
@@ -175,7 +175,7 @@
:return: None
:raises Exception: if the organization is not on the Enterprise plan
"""
- is_enterprise = "enterprise" in org_plan.lower()
+ is_enterprise = org_plan is not None and "enterprise" in org_plan.lower()
if not is_enterprise:
raise Exception("This script requires an Enterprise plan organization")You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit d08c3d7. Configure here.
The actions/checkout SHA 34e114876b0b11c390a56381ad16ebd13914f8d5 is tagged v4.3.1, not v4 (v4 points at 11d5960a3267). zizmor's ref-version-mismatch audit flags all three occurrences at medium severity, which fails the workflow audit at --min-severity medium and blocks every open pull request. Only the trailing comments change; the pinned SHAs are untouched, so no action version changes. Repinning to the v4 tag's current target was the alternative, but that would silently move the action version and drift again on the next v4 release. Co-Authored-By: Claude <noreply@anthropic.com>
get_org_id_slug_plan leaves the plan as None when the token does not map to exactly one organization, or when the org payload has no plan field. assert_enterprise_plan then called .lower() on it and died with AttributeError, so a common setup mistake surfaced as a confusing crash instead of the intended message. Check the plan is a non-empty string first and raise the fail-fast Exception explaining the token must reach exactly one organization. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Adds an assert to verify that the organization is inside a an enterprise plan
cc Douglas (@dacoburn)
Note
Medium Risk
Startup now hard-fails for non-Enterprise orgs; if
planis missing from the API response,org_plan.lower()could raise instead of the intended error message.Overview
This PR gates socketsync startup on an Enterprise organization plan. During
set_org_vars(), the client now loads the org plan from the Socket API (alongside id and slug) and immediately validates it.get_org_id_slug()is replaced byget_org_id_slug_plan(), which readsplanfrom the org payload. A newassert_enterprise_plan()treats the plan as Enterprise when"enterprise"appears in the plan name (case-insensitive) and raises with a clear message if not, so non-Enterprise tokens fail fast before scans or sync run.Reviewed by Cursor Bugbot for commit d08c3d7. Configure here.