-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
chore: Remove unused JSON superuser signup route #37378
Conversation
WalkthroughThe pull request involves the removal of the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
deploy/ansible/appsmith_playbook/roles/setup-appsmith/templates/appsmith/scripts/first-time-setup.sh (1)
114-120
: Consider using POST data instead of URL parameters for sensitive information.The current implementation passes the password as a URL parameter, which might be logged in server logs.
Consider using the
-d
flag withapplication/x-www-form-urlencoded
content type for better security:- curl http://localhost/api/v1/users/super \ - --data-urlencode "name=$default_user_name" \ - --data-urlencode "email=$default_user_name" \ - --data-urlencode "password=$default_user_password" \ - -d source=FORM \ - -d state=ACTIVATED \ - -d isEnabled=true + curl -X POST http://localhost/api/v1/users/super \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "name=$default_user_name" \ + -d "email=$default_user_name" \ + -d "password=$default_user_password" \ + -d "source=FORM" \ + -d "state=ACTIVATED" \ + -d "isEnabled=true"deploy/aws_ami/first-time-setup.sh (1)
113-119
: Add error handling for the curl command.The URL-encoded format change looks good, but the curl command should include error handling to ensure the super user was created successfully.
Consider adding error handling:
- curl http://localhost/api/v1/users/super \ + response=$(curl -s -w "\n%{http_code}" http://localhost/api/v1/users/super \ --data-urlencode "name=$default_user_name" \ --data-urlencode "email=$default_user_name" \ --data-urlencode "password=$default_user_password" \ -d source=FORM \ -d state=ACTIVATED \ - -d isEnabled=true + -d isEnabled=true) + + status_code=$(echo "$response" | tail -n1) + if [[ $status_code -ne 200 ]]; then + echo "Failed to create super user. Status code: $status_code" + exit 1 + fi
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (4)
app/client/src/ce/api/UserApi.tsx
(0 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java
(0 hunks)deploy/ansible/appsmith_playbook/roles/setup-appsmith/templates/appsmith/scripts/first-time-setup.sh
(1 hunks)deploy/aws_ami/first-time-setup.sh
(1 hunks)
💤 Files with no reviewable changes (2)
- app/client/src/ce/api/UserApi.tsx
- app/server/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java
🔇 Additional comments (1)
deploy/aws_ami/first-time-setup.sh (1)
113-119
: Verify removal of JSON endpoint.
Let's verify that the JSON endpoint for super user creation has been completely removed from the codebase.
✅ Verification successful
JSON endpoint for super user creation has been removed
Based on the search results, there are no JSON-specific endpoints or content-type headers for super user creation in the codebase. The current implementation in first-time-setup.sh
uses form-encoded data which is the correct approach.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining references to JSON super user creation
# Check for JSON content-type headers with super user endpoints
rg -i 'content-type.*application/json.*users/super'
# Check for any remaining JSON payload structures for super user creation
rg -i '{"name".*"email".*"password".*users/super'
# Check for any remaining createSuperUser method definitions
ast-grep --pattern 'createSuperUser($$$) {
$$$
}'
Length of output: 276
Script:
#!/bin/bash
# Let's fix the regex and search patterns
# Check for JSON content-type headers with super user endpoints
rg -i "content-type.*json.*users/super"
# Check for JSON-like patterns in super user creation
rg -i "users/super.*json"
# Search for createSuperUser function definitions
ast-grep --pattern 'function createSuperUser($_) {
$$$
}'
# Search for class method definitions of createSuperUser
ast-grep --pattern 'createSuperUser($_) {
$$$
}'
# Look for any API routes handling super user creation
rg -i "router\.(post|put).*users/super"
Length of output: 226
Script:
#!/bin/bash
# Let's try a broader search for super user related endpoints and implementations
# Search for any super user endpoints
rg -i "/users/super" -A 3 -B 3
# Search for any files containing super user related code
rg -l "super.*user"
# Look for API route definitions with users/super
rg -i "app\.(post|put|get).*users/super"
# Search for any remaining references to JSON in user creation
rg -i "application/json.*user" -A 2
Length of output: 50133
...nsible/appsmith_playbook/roles/setup-appsmith/templates/appsmith/scripts/first-time-setup.sh
Show resolved
Hide resolved
...erver/appsmith-server/src/main/java/com/appsmith/server/controllers/ce/UserControllerCE.java
Show resolved
Hide resolved
The JSON payload version of the super user signup route is not used anywhere significant. This PR removes it. ## Automation /test sanity authentication ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11830003644> > Commit: d051ed8 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11830003644&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity, @tag.Authentication` > Spec: > <hr>Thu, 14 Nov 2024 03:53:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated user creation process to use URL-encoded data instead of JSON for super user creation. - **Bug Fixes** - Removed deprecated `createSuperUser` methods from the API and server controllers, streamlining user management. - **Chores** - Modified setup scripts to reflect changes in user data transmission for creating super users. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
The JSON payload version of the super user signup route is not used anywhere significant. This PR removes it. ## Automation /test sanity authentication ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11830003644> > Commit: d051ed8 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11830003644&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Sanity, @tag.Authentication` > Spec: > <hr>Thu, 14 Nov 2024 03:53:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated user creation process to use URL-encoded data instead of JSON for super user creation. - **Bug Fixes** - Removed deprecated `createSuperUser` methods from the API and server controllers, streamlining user management. - **Chores** - Modified setup scripts to reflect changes in user data transmission for creating super users. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
The JSON payload version of the super user signup route is not used anywhere significant. This PR removes it.
Automation
/test sanity authentication
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11830003644
Commit: d051ed8
Cypress dashboard.
Tags:
@tag.Sanity, @tag.Authentication
Spec:
Thu, 14 Nov 2024 03:53:00 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
createSuperUser
methods from the API and server controllers, streamlining user management.Chores