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 *flagOutput == cmdutil.OutputJSON {
|
||||
return cmdutil.PrintJSON(f.IOStreams.Out, nil)
|
||||
}
|
||||
_, _ = fmt.Fprintln(f.IOStreams.Out, "No SCIM configuration found.")
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -5115,7 +5115,7 @@ func (r *Resolver) GetSCIMConfigurationTool(ctx context.Context, req *mcp.CallTo
|
||||
if err != nil {
|
||||
var errNotFound *iam.ErrNoSCIMConfigurationFound
|
||||
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))
|
||||
}
|
||||
|
||||
@@ -9929,9 +9929,9 @@ components:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: Organization ID
|
||||
bridge_id:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
anyOf:
|
||||
- $ref: "#/components/schemas/GID"
|
||||
- type: "null"
|
||||
description: Associated SCIM bridge ID, if any
|
||||
created_at:
|
||||
type: string
|
||||
@@ -9964,9 +9964,9 @@ components:
|
||||
$ref: "#/components/schemas/GID"
|
||||
description: SCIM configuration ID
|
||||
connector_id:
|
||||
type:
|
||||
- string
|
||||
- "null"
|
||||
anyOf:
|
||||
- $ref: "#/components/schemas/GID"
|
||||
- type: "null"
|
||||
description: Connector ID, if any
|
||||
type:
|
||||
$ref: "#/components/schemas/SCIMBridgeType"
|
||||
|
||||
@@ -20,33 +20,21 @@ import (
|
||||
)
|
||||
|
||||
func NewSCIMConfiguration(c *coredata.SCIMConfiguration) *SCIMConfiguration {
|
||||
var bridgeID *string
|
||||
if c.BridgeID != nil {
|
||||
s := c.BridgeID.String()
|
||||
bridgeID = &s
|
||||
}
|
||||
|
||||
return &SCIMConfiguration{
|
||||
ID: c.ID,
|
||||
OrganizationID: c.OrganizationID,
|
||||
BridgeID: bridgeID,
|
||||
BridgeID: c.BridgeID,
|
||||
CreatedAt: c.CreatedAt,
|
||||
UpdatedAt: c.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
func NewSCIMBridge(b *coredata.SCIMBridge) *SCIMBridge {
|
||||
var connectorID *string
|
||||
if b.ConnectorID != nil {
|
||||
s := b.ConnectorID.String()
|
||||
connectorID = &s
|
||||
}
|
||||
|
||||
return &SCIMBridge{
|
||||
ID: b.ID,
|
||||
OrganizationID: b.OrganizationID,
|
||||
ScimConfigurationID: b.ScimConfigurationID,
|
||||
ConnectorID: connectorID,
|
||||
ConnectorID: b.ConnectorID,
|
||||
Type: b.Type,
|
||||
State: b.State,
|
||||
ExcludedUserNames: b.ExcludedUserNames,
|
||||
|
||||
Reference in New Issue
Block a user