Fix PR review comments on SCIM surfaces
- Return valid JSON (null) in `prb scim view --json` when no SCIM configuration exists - Remove organization ID from MCP not-found error to prevent identifier disclosure in multi-tenant paths - Use nullable GID refs for bridge_id and connector_id in MCP specification for correct generated ID typing Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -149,6 +149,9 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if resp.Node.ScimConfiguration == nil {
|
if resp.Node.ScimConfiguration == nil {
|
||||||
|
if *flagOutput == cmdutil.OutputJSON {
|
||||||
|
return cmdutil.PrintJSON(f.IOStreams.Out, nil)
|
||||||
|
}
|
||||||
_, _ = fmt.Fprintln(f.IOStreams.Out, "No SCIM configuration found.")
|
_, _ = fmt.Fprintln(f.IOStreams.Out, "No SCIM configuration found.")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5115,7 +5115,7 @@ func (r *Resolver) GetSCIMConfigurationTool(ctx context.Context, req *mcp.CallTo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
var errNotFound *iam.ErrNoSCIMConfigurationFound
|
var errNotFound *iam.ErrNoSCIMConfigurationFound
|
||||||
if errors.As(err, &errNotFound) {
|
if errors.As(err, &errNotFound) {
|
||||||
return nil, types.GetSCIMConfigurationOutput{}, fmt.Errorf("SCIM configuration not found for organization %s", input.OrganizationID)
|
return nil, types.GetSCIMConfigurationOutput{}, fmt.Errorf("SCIM configuration not found")
|
||||||
}
|
}
|
||||||
panic(fmt.Errorf("cannot get SCIM configuration: %w", err))
|
panic(fmt.Errorf("cannot get SCIM configuration: %w", err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9929,9 +9929,9 @@ components:
|
|||||||
$ref: "#/components/schemas/GID"
|
$ref: "#/components/schemas/GID"
|
||||||
description: Organization ID
|
description: Organization ID
|
||||||
bridge_id:
|
bridge_id:
|
||||||
type:
|
anyOf:
|
||||||
- string
|
- $ref: "#/components/schemas/GID"
|
||||||
- "null"
|
- type: "null"
|
||||||
description: Associated SCIM bridge ID, if any
|
description: Associated SCIM bridge ID, if any
|
||||||
created_at:
|
created_at:
|
||||||
type: string
|
type: string
|
||||||
@@ -9964,9 +9964,9 @@ components:
|
|||||||
$ref: "#/components/schemas/GID"
|
$ref: "#/components/schemas/GID"
|
||||||
description: SCIM configuration ID
|
description: SCIM configuration ID
|
||||||
connector_id:
|
connector_id:
|
||||||
type:
|
anyOf:
|
||||||
- string
|
- $ref: "#/components/schemas/GID"
|
||||||
- "null"
|
- type: "null"
|
||||||
description: Connector ID, if any
|
description: Connector ID, if any
|
||||||
type:
|
type:
|
||||||
$ref: "#/components/schemas/SCIMBridgeType"
|
$ref: "#/components/schemas/SCIMBridgeType"
|
||||||
|
|||||||
@@ -20,33 +20,21 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewSCIMConfiguration(c *coredata.SCIMConfiguration) *SCIMConfiguration {
|
func NewSCIMConfiguration(c *coredata.SCIMConfiguration) *SCIMConfiguration {
|
||||||
var bridgeID *string
|
|
||||||
if c.BridgeID != nil {
|
|
||||||
s := c.BridgeID.String()
|
|
||||||
bridgeID = &s
|
|
||||||
}
|
|
||||||
|
|
||||||
return &SCIMConfiguration{
|
return &SCIMConfiguration{
|
||||||
ID: c.ID,
|
ID: c.ID,
|
||||||
OrganizationID: c.OrganizationID,
|
OrganizationID: c.OrganizationID,
|
||||||
BridgeID: bridgeID,
|
BridgeID: c.BridgeID,
|
||||||
CreatedAt: c.CreatedAt,
|
CreatedAt: c.CreatedAt,
|
||||||
UpdatedAt: c.UpdatedAt,
|
UpdatedAt: c.UpdatedAt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSCIMBridge(b *coredata.SCIMBridge) *SCIMBridge {
|
func NewSCIMBridge(b *coredata.SCIMBridge) *SCIMBridge {
|
||||||
var connectorID *string
|
|
||||||
if b.ConnectorID != nil {
|
|
||||||
s := b.ConnectorID.String()
|
|
||||||
connectorID = &s
|
|
||||||
}
|
|
||||||
|
|
||||||
return &SCIMBridge{
|
return &SCIMBridge{
|
||||||
ID: b.ID,
|
ID: b.ID,
|
||||||
OrganizationID: b.OrganizationID,
|
OrganizationID: b.OrganizationID,
|
||||||
ScimConfigurationID: b.ScimConfigurationID,
|
ScimConfigurationID: b.ScimConfigurationID,
|
||||||
ConnectorID: connectorID,
|
ConnectorID: b.ConnectorID,
|
||||||
Type: b.Type,
|
Type: b.Type,
|
||||||
State: b.State,
|
State: b.State,
|
||||||
ExcludedUserNames: b.ExcludedUserNames,
|
ExcludedUserNames: b.ExcludedUserNames,
|
||||||
|
|||||||
Reference in New Issue
Block a user