Skip to content

[CSM][BE][Web] Skip SCIM external-account lookup for wso2.com emails - #1444

Merged
shayanmalinda merged 1 commit into
wso2-open-operations:mainfrom
Rashmika998:fix/csm-scim-wso2-email-guard
Aug 12, 2026
Merged

shayanmalinda merged 1 commit into
wso2-open-operations:mainfrom
Rashmika998:fix/csm-scim-wso2-email-guard

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1421. A ServiceNow project-contact row can carry a wso2.com email under a customer-facing userType/role (e.g. snc_external) despite belonging to a WSO2 employee. That account can never exist in the SCIM "external" org — it's reserved for WSO2 staff — so both the SCIM lookup and the resulting UI (the Overview card's "External account" field and the locked-account alert on UserProfilePage) are now skipped whenever the email's domain is wso2.com, regardless of userType/role.

Gated on email domain rather than the specific snc_external role string since it's the necessary-and-sufficient condition (a wso2.com account can never appear in that SCIM org under any role) and more robust to role-string variants.

Test plan

  • go build ./... && go vet ./... && go test ./... — all pass
  • gosec -fmt=text ./... — 0 issues in changed files (2 pre-existing, unrelated findings remain in internal/dashboard/registry.go)
  • tsc -b — clean
  • eslint on changed files — clean
  • vitest run — UserProfilePage.test.tsx (19 tests, incl. a new one for this fix) and CsmSideBar.test.tsx (3 tests) all pass

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • WSO2 users no longer trigger external-account lookups, regardless of user classification.
    • External-account details and locked-account alerts are hidden for WSO2 email addresses.
    • User profiles continue loading successfully without displaying irrelevant external-account information.
  • Tests

    • Added coverage for WSO2 users with external classifications and locked external-account data.

A ServiceNow project-contact row can carry a wso2.com email under a
customer-facing userType/role (e.g. snc_external) despite belonging to a
WSO2 employee. That account can never exist in the SCIM "external" org --
it's reserved for WSO2 staff -- so the lookup (and the resulting Overview
field / locked alert on UserProfilePage) is now skipped whenever the
email's domain is wso2.com, regardless of userType/role.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 96e9208a-ab0e-4d4d-9501-f1aea99d67c7

📥 Commits

Reviewing files that changed from the base of the PR and between def7f3d and 915c872.

📒 Files selected for processing (4)
  • apps/csm-portal/backend/internal/handler/user_external_account.go
  • apps/csm-portal/backend/internal/handler/user_external_account_test.go
  • apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.test.tsx
  • apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.tsx

📝 Walkthrough

Walkthrough

The backend now skips SCIM external-account enrichment for @wso2.com addresses. The frontend also hides external-account details and locked-account alerts for these addresses. Backend and frontend tests cover the behavior.

Changes

WSO2 external-account handling

Layer / File(s) Summary
Backend lookup exclusion
apps/csm-portal/backend/internal/handler/user_external_account.go, apps/csm-portal/backend/internal/handler/user_external_account_test.go
The handler detects WSO2 email addresses and skips SearchExternalUser enrichment. Tests verify that the response omits externalAccount.
Frontend display exclusion
apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.tsx, apps/csm-portal/webapp/src/features/csm-users/pages/UserProfilePage.test.tsx
The user profile page hides external-account details and locked-account alerts for WSO2 email addresses. Tests cover locked external-account data.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: hesara2003, rksk

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the purpose and test results, but it omits most required template sections, including release, documentation, security, environment, and migration details. Use the repository template and complete the required sections, or mark non-applicable sections with a brief explanation.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: skipping SCIM external-account lookups for wso2.com email addresses.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@shayanmalinda
shayanmalinda merged commit 3151fec into wso2-open-operations:main Aug 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants