fix(ci): resolve default org by slug, not display name#1354
Merged
Conversation
getDefaultOrgSlug exported the org's display name as SOCKET_ORG_SLUG for the Coana CLI, but Coana resolves the org by its URL-safe slug. The display name can differ from the slug and may be null, producing a wrong or empty org identifier (and a hard failure for tokens that can only see one org). Use the slug field instead and add unit coverage.
Benjamin Barslev Nielsen (barslev)
approved these changes
Jun 5, 2026
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.
Problem
getDefaultOrgSlug()exported the org's display name asSOCKET_ORG_SLUGfor the Coana CLI, but Coana resolves the org by its URL-safe slug. The display name can differ from the slug and may benull, producing a wrong or empty org identifier — and a hard failure for tokens that can only ever see a single org.This surfaced for repository-scoped tokens running
socket manifest gradle: the org-list lookup would403(fixed backend-side in SocketDev/depscan#21010), and even once that call succeeds the wrong field was being forwarded to Coana.Fix
Use the
slugfield instead ofname, and drop the unnecessaryas anyindex. Add unit coverage:nulldefaultOrgconfig value without calling the APIRelated
403): SocketDev/depscan#21010Note
Low Risk
Small, targeted fix to org resolution for CI env export plus tests; no auth or broad behavioral surface beyond correct slug forwarding.
Overview
Fixes wrong org identifier for Coana / CI:
getDefaultOrgSlug()now reads the first org’s URL-safesluginstead of its displaynamewhen building the value exported asSOCKET_ORG_SLUG. Display names can differ from slugs or benull, which previously yielded incorrect or empty org IDs for the Coana CLI (which resolves orgs by slug). Selection is simplified toorganizations[0]?.slugon the array-shaped org list, removing theas anyobject-key/namepath.Tests: New Vitest coverage for slug vs display name, null display name,
defaultOrgconfig short-circuit, and empty org list failure.Reviewed by Cursor Bugbot for commit 0c0ff74. Configure here.