-
Notifications
You must be signed in to change notification settings - Fork 715
fix: organization related issues #8130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this 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 three main organizational improvements to OpenObserve:
1. Input Sanitization for XSS Prevention
The PR adds HTML entity encoding to prevent XSS attacks when users input HTML tags like <h1>. A sanitizeInput function is implemented in AddUpdateOrganization.vue that first decodes existing HTML entities, then re-encodes them along with trimming whitespace. This ensures user input like <h1> gets converted to <h1> before being processed.
2. Enhanced Organization Display and Search
Organization dropdowns now show both name and identifier in the format "name | identifier" instead of just the name. The UI has been updated with wider containers (450px vs 250px) to accommodate this extended format. Search functionality is enhanced to filter by both organization name and identifier, making it easier for users to find organizations when managing multiple similar entries.
3. Organization Rename Functionality
A complete rename workflow has been added, allowing users to modify existing organization names. This includes:
- New
rename_organizationAPI method in the organizations service - Edit buttons in the organization list for cloud/enterprise users
- Route handling and state management for the update workflow
- Reuse of the existing
AddUpdateOrganizationcomponent for both create and update operations
Architectural Changes
The PR also enables enterprise features by default in Cargo.toml, adding dependencies for enterprise modules including authentication (Dex), authorization (OpenFGA), and rate limiting capabilities that support advanced organization management.
These changes work together to provide a more secure, user-friendly, and feature-complete organization management experience while maintaining the existing component architecture and patterns.
Confidence score: 3/5
- This PR has mixed implementation quality with some solid functionality but notable code quality issues
- Score reflects good security improvements and feature completeness offset by code duplication, inconsistent naming, and potential logic issues
- Pay close attention to
ListOrganizations.vueandAddUpdateOrganization.vuefor code quality improvements
5 files reviewed, 2 comments
| }); | ||
| this.showAddOrganizationDialog = false; | ||
| //after updating the organization we will reset the toBeUpdatedOrganization | ||
| const isUpdated = this.toBeUpdatedOrganization.id.length != 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Use strict equality (!==) instead of loose equality (!=) for better type safety.
| const isUpdated = this.toBeUpdatedOrganization.id.length != 0; | |
| const isUpdated = this.toBeUpdatedOrganization.id.length !== 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks fixed that
| const sanitizeInput = (val: string) => { | ||
| // First decode any existing HTML entities | ||
| const decoded = val | ||
| .replace(/&/g, "&") | ||
| .replace(/</g, "<") | ||
| .replace(/>/g, ">") | ||
| .replace(/"/g, '"') | ||
| .replace(/'/g, "'"); | ||
| // Then sanitize | ||
| return decoded | ||
| .trim() | ||
| .replace(/&/g, "&") | ||
| .replace(/</g, "<") | ||
| .replace(/>/g, ">") | ||
| .replace(/"/g, """) | ||
| .replace(/'/g, "'") | ||
| .replace(/\s+/g, " "); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: The sanitizeInput function properly prevents XSS by encoding HTML entities. However, applying sanitization after trimming at line 225 creates redundancy since sanitizeInput already trims.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we are doing it purposely for any spaces that are there after decoding
PR Code Suggestions ✨Explore these optional code suggestions:
|
e6b98a9 to
6d5eaad
Compare
5471375 to
86712e9
Compare
| return Err(anyhow::anyhow!("Not allowed to rename org")); | ||
| } | ||
|
|
||
| let has_valid_chars = name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name validation code seems repeated. It could be moved out into its own validation function. fn validate_org_name(s: &str) -> bool or fn validate_name(s: &str) -> bool or something similar.
fix: org identifier should be included in search options fix: organization input name sanitized fix: show both name and identifier in org table fix: introduce org update feature fix: unit test case fix: increase width to show id as well fix: wait until org name visible fix: add update santize input fixed
Signed-off-by: Yashodhan Joshi <[email protected]>
dde6bba to
39440dd
Compare
User description
PR Type
Enhancement, Bug fix
Description
Add organization rename functionality
Sanitize organization name input
Show name and identifier in menus/search
Enable edit action in organizations table
Diagram Walkthrough
File Walkthrough
AddUpdateOrganization.vue
Sanitize input and implement org rename flowweb/src/components/iam/organizations/AddUpdateOrganization.vue
modelValueand ID field UI tweaks.ListOrganizations.vue
Add edit action and identifier-aware filteringweb/src/components/iam/organizations/ListOrganizations.vue
model-value.MainLayout.vue
Improve org menu display and search by identifierweb/src/layouts/MainLayout.vue
organizations.ts
Introduce organization rename service endpointweb/src/services/organizations.ts
rename_organizationAPI method./api/{orgIdentifier}/renamewithnew_name.Cargo.toml
Adjust features to enable enterprise stackCargo.toml