Skip to content

feat: adds SCIM provisioning fields and tightens attribute mapping schemas in config - #4332

Merged
akshaydeo merged 2 commits into
devfrom
06-12-feat_config.schema.json_changes
Jun 12, 2026
Merged

feat: adds SCIM provisioning fields and tightens attribute mapping schemas in config#4332
akshaydeo merged 2 commits into
devfrom
06-12-feat_config.schema.json_changes

Conversation

@roroghost17

@roroghost17 roroghost17 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR tightens the JSON schema definitions for SSO attribute mapping configurations and adds SCIM provisioning support to the OIDC/JWT mapping blocks that previously lacked it.

Changes

  • Added attributeType ("user" | "group") and attributeValue fields to the SAML/SCIM attributeRoleMappings items, enabling SCIM-aware role assignment.
  • Expanded the previously untyped ("type": "object") Keycloak attributeRoleMappings, attributeTeamMappings, and attributeBusinessUnitMappings items with fully typed property definitions, required constraints, and additionalProperties: false.
  • Added top-level attributeRoleMappings, attributeTeamMappings, and attributeBusinessUnitMappings arrays to the Azure AD / OIDC provider config block, mirroring the Keycloak equivalents and including SCIM attributeType/attributeValue fields.
  • Made business_unit optional in attributeBusinessUnitMappings (removed from required) to support wildcard "*" pass-through mappings where the claim value itself becomes the business unit name.
  • Clarified descriptions for team, value, and business_unit fields to document wildcard "*" behaviour and when fields should be left empty.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

Validate the schema against existing and new SSO configuration fixtures:

# Validate schema syntax
npx ajv compile -s transports/config.schema.json

# Run transport tests
go test ./transports/...

Verify that:

  • A Keycloak config with attributeRoleMappings containing attribute, value, and role passes validation.
  • An Azure AD config with attributeTeamMappings using value: "*" and no team field passes validation.
  • An attributeBusinessUnitMappings entry with value: "*" and no business_unit field passes validation.
  • Any mapping item with unknown extra properties fails validation (additionalProperties: false).

Breaking changes

  • Yes
  • No

The Keycloak attributeRoleMappings, attributeTeamMappings, and attributeBusinessUnitMappings items now enforce additionalProperties: false and explicit required fields. Any existing config that passes undeclared properties in these arrays will fail schema validation.

Related issues

Security considerations

The attributeType/attributeValue fields are used during SCIM provisioning to match users or groups. Ensure that group displayName values used in mappings are controlled and cannot be spoofed by end-users through SCIM payloads.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

Summary by CodeRabbit

  • Configuration Updates

    • Enhanced identity provider mapping schema with new optional attributes for role mappings and richer mapping options.
    • Relaxed validation for team and business-unit mappings so they no longer require target fields, making mappings more flexible.
  • Documentation

    • Clarified descriptions for wildcard behavior and mapping semantics to reduce ambiguity.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d72558da-f3c5-4af2-be5c-6f6d5e7cc63b

📥 Commits

Reviewing files that changed from the base of the PR and between 7da2309 and 4da321e.

📒 Files selected for processing (1)
  • transports/config.schema.json

📝 Walkthrough

Walkthrough

This PR refines the identity provider attribute mapping schemas in transports/config.schema.json across Okta, Entra, and Keycloak. It adds optional properties to role mappings, improves documentation for wildcard behavior, and relaxes requirements so team and business_unit fields are no longer mandatory in their respective mappings.

Changes

Attribute Mapping Schema Refinements

Layer / File(s) Summary
Schema formatting and baseline updates
transports/config.schema.json
complexity_analyzer_keywords required array and base_key model_family enum are reformatted into multi-line structures without semantic changes.
Okta attribute mapping enhancements
transports/config.schema.json
Okta attributeRoleMappings adds optional attributeType and attributeValue properties; team and business-unit mapping descriptions clarify wildcard ("*") behavior; business_unit is no longer required.
Entra attribute mapping expansion
transports/config.schema.json
Entra role, team, and business-unit mappings are expanded with richer descriptions and optional properties; team and business-unit fields are no longer required, only attribute and value.
Keycloak attribute mapping expansion
transports/config.schema.json
Keycloak role, team, and business-unit mappings are expanded with explicit field schemas and documented wildcard behavior; team and business-unit fields are no longer required.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • maximhq/bifrost#3974: Introduces attributeType/attributeValue and related schema changes for attribute mappings that overlap these edits.
  • maximhq/bifrost#3857: Modifies Okta SCIM mapping schemas; overlaps with required/optional field updates here.
  • maximhq/bifrost#4214: Related Okta SCIM docs and examples covering attribute-based mappings and attributeValue usage.

Suggested reviewers

  • akshaydeo
  • danpiths

Poem

🐰 Schemas hop through JSON light,
Wildcards whisper, fields take flight,
Roles and teams in tidy rows,
Optional petals softly grow,
Configs clearer as the rabbit knows.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main changes: adding SCIM provisioning fields and tightening attribute mapping schemas in the configuration file.
Description check ✅ Passed The description is comprehensive and well-structured, covering all major template sections including summary, changes, type of change, affected areas, testing instructions, breaking changes, and security considerations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 06-12-feat_config.schema.json_changes

Comment @coderabbitai help to get the list of available commands and usage tips.

roroghost17 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

@CLAassistant

CLAassistant commented Jun 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@roroghost17 roroghost17 changed the title feat: config.schema.json changes feat: adds SCIM provisioning fields and tightens attribute mapping schemas in config Jun 12, 2026
@roroghost17
roroghost17 marked this pull request as ready for review June 12, 2026 08:48
@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The schema changes are additive and isolated to config.schema.json; the Okta attributeTeamMappings required mismatch with its updated wildcard description and the absent SCIM fields in the newly tightened Keycloak items are the two defects that need resolution before merge.

Both defects are in transports/config.schema.json: Okta attributeTeamMappings still requires team while the updated description says to omit it for wildcard mappings, and the Keycloak mapping items (the only ones with additionalProperties: false and no SCIM fields) will silently break any existing or future Keycloak SCIM config. All other changes — new Entra arrays, SAML SCIM fields, business_unit demotion — look correct and consistent.

transports/config.schema.json — specifically the Okta attributeTeamMappings required array and the Keycloak mapping item definitions

Important Files Changed

Filename Overview
transports/config.schema.json Adds SCIM provisioning fields (attributeType/attributeValue) to Okta and SAML role-mapping items, adds full mapping arrays to the Entra/Azure AD block, and tightens Keycloak mapping items from bare "type": "object" to fully-typed with required/additionalProperties — but two schema inconsistencies remain: Okta attributeTeamMappings still requires team despite the updated wildcard description, and Keycloak mapping items lack the SCIM fields present in every other provider.

Reviews (2): Last reviewed commit: "feat: config.schema.json changes" | Re-trigger Greptile

Comment thread transports/config.schema.json
@roroghost17
roroghost17 force-pushed the 06-12-feat_config.schema.json_changes branch from 7da2309 to 4da321e Compare June 12, 2026 09:03
@roroghost17
roroghost17 force-pushed the 06-12-feat_adds_pubsub_kafka_to_config_json_with_plugin_span_filter branch from 44f14ea to 2b9a709 Compare June 12, 2026 09:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@transports/config.schema.json`:
- Around line 4689-4705: The Keycloak schema definition for
keycloak_config.attributeRoleMappings is missing the optional fields
attributeType and attributeValue required by the SCIM/OIDC mapping contract;
update the object under attributeRoleMappings to include optional properties
"attributeType" (string, description e.g. "type of attribute like 'string' or
'array'") and "attributeValue" (string, description e.g. "normalized/expected
attribute value"), ensure they are not added to the "required" array and keep
additionalProperties false so the schema matches Okta/Entra and accepts valid
Keycloak SCIM role-mapping configs.
- Around line 1906-1951: The schema currently allows sasl_enabled: true without
providing a sasl object; add a JSON Schema conditional so SASL validation fails
closed: add an if/then block that checks if "sasl_enabled" is true (if: {
"properties": { "sasl_enabled": { "const": true } }, "required":
["sasl_enabled"] }) and in the then require the "sasl" property (then: {
"required": ["sasl"], "properties": { "sasl": { "required":
["mechanism","username","password"] } } }), ensuring the existing "sasl" object
shape (mechanism, username, password) is enforced when sasl_enabled is true;
keep additionalProperties:false for the "sasl" object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d72558da-f3c5-4af2-be5c-6f6d5e7cc63b

📥 Commits

Reviewing files that changed from the base of the PR and between 7da2309 and 4da321e.

📒 Files selected for processing (1)
  • transports/config.schema.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@transports/config.schema.json`:
- Around line 4689-4705: The Keycloak schema definition for
keycloak_config.attributeRoleMappings is missing the optional fields
attributeType and attributeValue required by the SCIM/OIDC mapping contract;
update the object under attributeRoleMappings to include optional properties
"attributeType" (string, description e.g. "type of attribute like 'string' or
'array'") and "attributeValue" (string, description e.g. "normalized/expected
attribute value"), ensure they are not added to the "required" array and keep
additionalProperties false so the schema matches Okta/Entra and accepts valid
Keycloak SCIM role-mapping configs.
- Around line 1906-1951: The schema currently allows sasl_enabled: true without
providing a sasl object; add a JSON Schema conditional so SASL validation fails
closed: add an if/then block that checks if "sasl_enabled" is true (if: {
"properties": { "sasl_enabled": { "const": true } }, "required":
["sasl_enabled"] }) and in the then require the "sasl" property (then: {
"required": ["sasl"], "properties": { "sasl": { "required":
["mechanism","username","password"] } } }), ensuring the existing "sasl" object
shape (mechanism, username, password) is enforced when sasl_enabled is true;
keep additionalProperties:false for the "sasl" object.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d72558da-f3c5-4af2-be5c-6f6d5e7cc63b

📥 Commits

Reviewing files that changed from the base of the PR and between 7da2309 and 4da321e.

📒 Files selected for processing (1)
  • transports/config.schema.json
🛑 Comments failed to post (2)
transports/config.schema.json (2)

1906-1951: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make Kafka SASL validation fail-closed when SASL is enabled.

With current schema, sasl_enabled: true can pass without a sasl object or credentials. That permits insecure/accidental plaintext operation despite an explicit SASL toggle.

Suggested fix
                 "config": {
                   "type": "object",
                   "description": "Configuration for the Kafka traces plugin (Enterprise). Publishes completed traces as JSON messages to a Kafka topic, keyed by trace ID.",
                   "properties": {
@@
                     "sasl": {
                       "type": "object",
                       "description": "SASL credentials, used when sasl_enabled is true",
                       "properties": {
@@
                         "password": {
@@
                         }
                       },
+                      "required": ["mechanism", "username", "password"],
                       "additionalProperties": false
                     },
@@
                     "plugin_span_filter": {
                       "$ref": "`#/`$defs/plugin_span_filter"
                     }
                   },
+                  "allOf": [
+                    {
+                      "if": {
+                        "properties": {
+                          "sasl_enabled": { "const": true }
+                        },
+                        "required": ["sasl_enabled"]
+                      },
+                      "then": {
+                        "required": ["sasl"]
+                      }
+                    }
+                  ],
                   "required": ["brokers", "topic"],
                   "additionalProperties": false
                 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@transports/config.schema.json` around lines 1906 - 1951, The schema currently
allows sasl_enabled: true without providing a sasl object; add a JSON Schema
conditional so SASL validation fails closed: add an if/then block that checks if
"sasl_enabled" is true (if: { "properties": { "sasl_enabled": { "const": true }
}, "required": ["sasl_enabled"] }) and in the then require the "sasl" property
(then: { "required": ["sasl"], "properties": { "sasl": { "required":
["mechanism","username","password"] } } }), ensuring the existing "sasl" object
shape (mechanism, username, password) is enforced when sasl_enabled is true;
keep additionalProperties:false for the "sasl" object.

Source: Coding guidelines


4689-4705: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add missing SCIM role-mapping fields to Keycloak schema.

keycloak_config.attributeRoleMappings is missing the new optional attributeType and attributeValue fields that are present for Okta/Entra and required by the SCIM/OIDC mapping contract. This creates provider-specific schema drift and rejects valid Keycloak SCIM role mapping configs.

Suggested fix
         "attributeRoleMappings": {
           "type": "array",
           "description": "Ordered list of attribute -> role mappings (first match wins).",
           "items": {
             "type": "object",
             "properties": {
               "attribute": {
                 "type": "string",
                 "description": "JWT claim name (supports dot paths, e.g. 'realm_access.roles')"
               },
               "value": {
                 "type": "string",
                 "description": "Claim value to match (case-insensitive)"
               },
               "role": {
                 "type": "string",
                 "description": "Bifrost role to assign on match"
+              },
+              "attributeType": {
+                "type": "string",
+                "enum": ["user", "group"],
+                "description": "SCIM provisioning type: 'user' matches SCIM User attributes, 'group' matches SCIM Group displayName"
+              },
+              "attributeValue": {
+                "type": "string",
+                "description": "SCIM attribute value to match (for attributeType 'user': the SCIM user attribute value; for 'group': the SCIM group displayName, auto-set to 'displayName')"
               }
             },
             "required": ["attribute", "value", "role"],
             "additionalProperties": false
           }
         },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

            "type": "object",
            "properties": {
              "attribute": {
                "type": "string",
                "description": "JWT claim name (supports dot paths, e.g. 'realm_access.roles')"
              },
              "value": {
                "type": "string",
                "description": "Claim value to match (case-insensitive)"
              },
              "role": {
                "type": "string",
                "description": "Bifrost role to assign on match"
              },
              "attributeType": {
                "type": "string",
                "enum": ["user", "group"],
                "description": "SCIM provisioning type: 'user' matches SCIM User attributes, 'group' matches SCIM Group displayName"
              },
              "attributeValue": {
                "type": "string",
                "description": "SCIM attribute value to match (for attributeType 'user': the SCIM user attribute value; for 'group': the SCIM group displayName, auto-set to 'displayName')"
              }
            },
            "required": ["attribute", "value", "role"],
            "additionalProperties": false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@transports/config.schema.json` around lines 4689 - 4705, The Keycloak schema
definition for keycloak_config.attributeRoleMappings is missing the optional
fields attributeType and attributeValue required by the SCIM/OIDC mapping
contract; update the object under attributeRoleMappings to include optional
properties "attributeType" (string, description e.g. "type of attribute like
'string' or 'array'") and "attributeValue" (string, description e.g.
"normalized/expected attribute value"), ensure they are not added to the
"required" array and keep additionalProperties false so the schema matches
Okta/Entra and accepts valid Keycloak SCIM role-mapping configs.

Source: Coding guidelines

akshaydeo commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jun 12, 9:11 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 12, 9:12 AM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo changed the base branch from 06-12-feat_adds_pubsub_kafka_to_config_json_with_plugin_span_filter to graphite-base/4332 June 12, 2026 09:11
@akshaydeo
akshaydeo changed the base branch from graphite-base/4332 to dev June 12, 2026 09:12
@akshaydeo
akshaydeo requested a review from a team as a code owner June 12, 2026 09:12
@akshaydeo
akshaydeo merged commit f96f43b into dev Jun 12, 2026
10 of 11 checks passed
@akshaydeo
akshaydeo deleted the 06-12-feat_config.schema.json_changes branch June 12, 2026 09:12
akshaydeo pushed a commit that referenced this pull request Jun 12, 2026
…hemas in config (#4332)

## Summary

This PR tightens the JSON schema definitions for SSO attribute mapping configurations and adds SCIM provisioning support to the OIDC/JWT mapping blocks that previously lacked it.

## Changes

- Added `attributeType` (`"user"` | `"group"`) and `attributeValue` fields to the SAML/SCIM `attributeRoleMappings` items, enabling SCIM-aware role assignment.
- Expanded the previously untyped (`"type": "object"`) Keycloak `attributeRoleMappings`, `attributeTeamMappings`, and `attributeBusinessUnitMappings` items with fully typed property definitions, `required` constraints, and `additionalProperties: false`.
- Added top-level `attributeRoleMappings`, `attributeTeamMappings`, and `attributeBusinessUnitMappings` arrays to the Azure AD / OIDC provider config block, mirroring the Keycloak equivalents and including SCIM `attributeType`/`attributeValue` fields.
- Made `business_unit` optional in `attributeBusinessUnitMappings` (removed from `required`) to support wildcard `"*"` pass-through mappings where the claim value itself becomes the business unit name.
- Clarified descriptions for `team`, `value`, and `business_unit` fields to document wildcard `"*"` behaviour and when fields should be left empty.

## Type of change

- [ ] Bug fix
- [ ] Feature
- [x] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [ ] Core (Go)
- [x] Transports (HTTP)
- [ ] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

Validate the schema against existing and new SSO configuration fixtures:

```sh
# Validate schema syntax
npx ajv compile -s transports/config.schema.json

# Run transport tests
go test ./transports/...
```

Verify that:
- A Keycloak config with `attributeRoleMappings` containing `attribute`, `value`, and `role` passes validation.
- An Azure AD config with `attributeTeamMappings` using `value: "*"` and no `team` field passes validation.
- An `attributeBusinessUnitMappings` entry with `value: "*"` and no `business_unit` field passes validation.
- Any mapping item with unknown extra properties fails validation (`additionalProperties: false`).

## Breaking changes

- [x] Yes
- [ ] No

The Keycloak `attributeRoleMappings`, `attributeTeamMappings`, and `attributeBusinessUnitMappings` items now enforce `additionalProperties: false` and explicit `required` fields. Any existing config that passes undeclared properties in these arrays will fail schema validation.

## Related issues

## Security considerations

The `attributeType`/`attributeValue` fields are used during SCIM provisioning to match users or groups. Ensure that group `displayName` values used in mappings are controlled and cannot be spoofed by end-users through SCIM payloads.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **Configuration Updates**
  * Enhanced identity provider mapping schema with new optional attributes for role mappings and richer mapping options.
  * Relaxed validation for team and business-unit mappings so they no longer require target fields, making mappings more flexible.

* **Documentation**
  * Clarified descriptions for wildcard behavior and mapping semantics to reduce ambiguity.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants