Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Aug 11, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-2317/okta-user-profile-tool

How Has This Been Tested?

Tested locally.

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

Summary by cubic

Added a new Okta Profile tool that lets the assistant fetch and display user profile information from Okta using OAuth and Okta Admin API.

  • New Features
  • Okta Profile tool is enabled by environment variables and appears in the tool list.
  • Fetches user details from Okta, including name, email, department, and account status.
  • Integrates with the chat UI to show profile results when used.

@Weves Weves requested a review from a team as a code owner August 11, 2025 16:37
Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
internal-search Ready Preview Comment Aug 13, 2025 4:40pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR introduces a new Okta Profile Tool that enables users to retrieve their profile information from Okta through the chat interface. The implementation follows Onyx's established tool architecture pattern and includes several key components:

Core Implementation: The OktaProfileTool class (backend/onyx/tools/tool_implementations/okta_profile/okta_profile_tool.py) inherits from BaseTool and implements the standard tool interface. It orchestrates a multi-step authentication flow: first extracting user IDs from OAuth tokens via OIDC userinfo/introspection endpoints, then fetching full profile data using Okta's Users API with SSWS authentication.

Configuration Integration: New environment-based configurations were added to app_configs.py including OKTA_PROFILE_TOOL_ENABLED (feature flag), OKTA_API_TOKEN (for Users API access), and OPENID_CONFIG_URL (for OIDC configuration). These follow the existing configuration patterns in the codebase.

Tool System Integration: The tool is properly integrated into the existing tool constructor (tool_constructor.py) with comprehensive validation checks for required OAuth credentials and Okta API tokens. It's also conditionally registered in the built-in tools system (built_in_tools.py) using the same pattern as other external service integrations like InternetSearchTool.

Performance Optimizations: Import optimizations were made in llm/models.py and tools/tool.py to reduce runtime dependencies by converting heavy imports to lazy loading and moving type-only imports under TYPE_CHECKING blocks.

UI Enhancements: Minor frontend improvements in Messages.tsx include more explicit array length checking and consistent spacing for tool displays.

The tool integrates seamlessly with Onyx's existing authentication system, leveraging user OAuth tokens for secure profile retrieval while maintaining the established patterns for tool validation, error handling, and conditional availability based on environment configuration.

Confidence score: 3/5

  • This PR introduces significant new functionality with external API dependencies that could potentially cause issues if Okta services are unavailable or misconfigured
  • Score reflects concerns about error handling that may expose sensitive information in logs and the complexity of the multi-step authentication flow with multiple potential failure points
  • Pay close attention to backend/onyx/tools/tool_implementations/okta_profile/okta_profile_tool.py for security implications and error handling robustness

7 files reviewed, 6 comments

Edit Code Review Bot Settings | Greptile

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

2 issues found across 7 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@Weves Weves changed the title Okta profile tool feat: okta profile tool Aug 11, 2025
Copy link
Contributor

@evan-onyx evan-onyx left a comment

Choose a reason for hiding this comment

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

left some qs that can become TODOs if necessary

@Weves Weves merged commit e0a9a6f into main Aug 13, 2025
14 of 15 checks passed
@Weves Weves deleted the okta-profile-tool branch August 13, 2025 16:57
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
* Initial Okta profile tool

* Improve

* Fix

* Improve

* Improve

* Address EL comments
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.

2 participants