Skip to content

Commit 46dee7c

Browse files
ericfitzclaude
andauthored
fix(api): use userInternalUUID for addon invocation auth context (#112)
The InvokeAddon handler was incorrectly using "userID" from context (which contains the provider user ID string like alice@tmi.local) instead of "userInternalUUID" (which contains the actual UUID). This caused 401 errors with "Invalid authentication context" when users tried to invoke addons. Also updates diagram_model_transform.go to remove SecurityBoundary field references that were removed from MinimalNode and Node_Data types in the OpenAPI spec update. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 91af483 commit 46dee7c

File tree

5 files changed

+875
-952
lines changed

5 files changed

+875
-952
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"major": 0,
33
"minor": 272,
4-
"patch": 0
4+
"patch": 1
55
}

api/addon_invocation_handlers.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ func InvokeAddon(c *gin.Context) {
4141
return
4242
}
4343

44-
// Get user UUID from context (internal ID for rate limiting, etc.)
44+
// Get user's internal UUID from context (for rate limiting, etc.)
4545
var userUUID uuid.UUID
46-
if userIDInterface, exists := c.Get("userID"); exists {
47-
if userIDStr, ok := userIDInterface.(string); ok {
46+
if internalUUIDInterface, exists := c.Get("userInternalUUID"); exists {
47+
if uuidVal, ok := internalUUIDInterface.(uuid.UUID); ok {
48+
userUUID = uuidVal
49+
} else if uuidStr, ok := internalUUIDInterface.(string); ok {
4850
var err error
49-
userUUID, err = uuid.Parse(userIDStr)
51+
userUUID, err = uuid.Parse(uuidStr)
5052
if err != nil {
51-
logger.Error("Invalid user ID in context: %s", userIDStr)
53+
logger.Error("Invalid user internal UUID in context: %s", uuidStr)
5254
HandleRequestError(c, &RequestError{
5355
Status: http.StatusUnauthorized,
5456
Code: "unauthorized",
@@ -59,7 +61,7 @@ func InvokeAddon(c *gin.Context) {
5961
}
6062
}
6163
if userUUID == uuid.Nil {
62-
logger.Error("User ID not found in context for email: %s", userEmail)
64+
logger.Error("User internal UUID not found in context for email: %s", userEmail)
6365
HandleRequestError(c, &RequestError{
6466
Status: http.StatusUnauthorized,
6567
Code: "unauthorized",

0 commit comments

Comments
 (0)