PromucFlow_constructor/app/client/src
Shrikant Sharat Kandula 32ed0ac9ad
fix: Use Spring's native CSRF protection, and fix login page (#37292)
## Description

The login page, and a few other pages are exempted from CSRF today and
aren't doing any check at all. This makes our login page vulnerable to
CSRF. But it's not really exploitable in its current form, since there's
other points in the login flow that patch this hole up.

Nevertheless, CSRF being possible on the login form doesn't sound good
in any tone and context. This PR fixes this by not exempting _anything_
from CSRF, and doing a stateless CSRF check where necessary.

PR summary:

1. Switches from our home-built CSRF filter implementation to Spring's
native implementation.
2. Login form and a few others were previously exempted from CSRF
checks, and now that exemption is gone. This is why we need the
`X-Requested-By: Appsmith` for the login/signup form submission calls
from Cypress.
3. Removes the check on `Content-Type: application/json` header.
Previously, if a request had this header, it was considered exempt from
CSRF check. This has been removed as it appears it's not a safe
assumption in today's JSON-dominated web.

⚠️ verify SCIM flow before merging.

## Automation

/test all

### 🔍 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/13697073430>
> Commit: 0873799e2346e58dac3d59b1a3890b86ab17d5b4
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13697073430&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Thu, 06 Mar 2025 12:13:19 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

## Release Notes

- **New Features**
- Introduced a `CsrfTokenInput` component to enhance security during
user authentication and signup processes by including a CSRF token.

- **Improvements**
- Enhanced API request headers for login and signup commands to improve
security.
- Added cookie validation for successful login to ensure session
integrity.
  - Improved error handling for database operations.

- **Bug Fixes**
- Removed outdated CSRF filter to streamline CSRF protection handling in
the application.

- **Tests**
- Added comprehensive unit tests for CSRF protection to ensure correct
behavior under various scenarios.
- Introduced a new test suite for testing CSRF logout and login
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-03-08 21:01:02 +05:30
..
actions chore: Split canvas widget reducers (#39327) 2025-02-18 16:12:05 +05:30
api fix: Use Spring's native CSRF protection, and fix login page (#37292) 2025-03-08 21:01:02 +05:30
assets feat: update response tab UI (#37640) 2024-11-28 17:01:50 +05:30
ce chore: added upcoming section for gac enabled users (#39563) 2025-03-07 18:19:33 +05:30
components feat: Trigger autocomplete even outside bindings (#39446) 2025-03-07 13:35:16 +05:30
constants fix: Reduce cycle deps by removing wrong exports (#39268) 2025-02-14 18:26:31 +05:30
Datasource/components chore: reconnect ds detached from datasource editor part 1 (#35907) 2024-09-02 11:26:34 +05:30
ee chore: Move existing middlewares to a middlewares folder and added pass through middleware for packages (#39410) 2025-03-05 20:55:35 +05:30
enterprise fix: change appsmith alias (#35349) 2024-08-06 17:52:22 +03:00
entities chore: Fix appsmith store hydration from localstorage in view mode (#39375) 2025-02-20 14:58:44 +05:30
git chore: fixing dropdown issue with default branch (#39552) 2025-03-05 10:45:56 +01:00
git-artifact-helpers/application chore: git pkg - package integration with git (#39342) 2025-02-19 13:42:58 +01:00
globalStyles fix: Sync EE items into CE (#34373) 2024-06-24 09:36:38 +00:00
icons chore:delete unused files (#36368) 2024-09-19 16:01:03 +03:00
IDE chore: Fixing renaming of Queries, JS and Widgets to replace spaces and special characters with underscore (#39596) 2025-03-06 18:24:04 +05:30
instrumentation chore: disable faro session tracking (#38523) 2025-01-08 14:15:30 +05:30
layoutSystems fix:codeowners file (#39447) 2025-02-26 15:21:36 +03:00
mockResponses
mocks chore: delete unused code (#36461) 2024-09-23 13:52:00 +03:00
navigation chore: Move entities/IDE/constants (#39064) 2025-02-07 16:45:55 +05:30
pages fix: Use Spring's native CSRF protection, and fix login page (#37292) 2025-03-08 21:01:02 +05:30
PluginActionEditor chore: improvements for datasource tab (#39553) 2025-03-04 20:33:42 +03:00
plugins/Linting fix: Reduce cycle deps by removing wrong exports (#39268) 2025-02-14 18:26:31 +05:30
polyfills chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
reducers chore: Migrate Tenant to Organization (#38891) 2025-02-18 20:41:07 +05:30
reflow chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
sagas chore: Refactoring code by taking out the common logic for re-using it on other IDEs (#39577) 2025-03-06 13:22:24 +05:30
selectors fix:codeowners file (#39447) 2025-02-26 15:21:36 +03:00
templates
theme
usagePulse fix: Use Spring's native CSRF protection, and fix login page (#37292) 2025-03-08 21:01:02 +05:30
utils feat: Trigger autocomplete even outside bindings (#39446) 2025-03-07 13:35:16 +05:30
WidgetProvider fix:codeowners file (#39447) 2025-02-26 15:21:36 +03:00
WidgetQueryGenerators fix: Separate Plugin Entity from Action (#38582) 2025-01-15 11:29:32 +05:30
widgets fix: antd library package update for custom widget (#39574) 2025-03-05 20:43:07 +05:30
workers chore: Split canvas widget reducers (#39327) 2025-02-18 16:12:05 +05:30
App.css
AppErrorBoundry.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
config.d.ts fix: change appsmith alias (#35349) 2024-08-06 17:52:22 +03:00
Globals.d.ts fix: Sync EE items into CE (#34373) 2024-06-24 09:36:38 +00:00
index.css fix: Revert "Revert "feat: Added focus ring for focus visible (#37700)" (#… (#38655) 2025-02-03 11:12:29 +05:30
index.tsx chore: bypass immer for first evaluation, fixed cloneDeep issue and using mutative instead of immer (#38993) 2025-02-06 11:20:08 +05:30
LandingScreen.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
preload-route-chunks.ts chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
react-app-env.d.ts chore: Eject CRA (#39264) 2025-02-14 14:24:41 +05:30
RouteChangeListener.tsx chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00
serviceWorker.ts chore: add etag caching in consolidated api for application view mode (#38873) 2025-01-30 13:54:34 +05:30
store.ts chore: Move existing middlewares to a middlewares folder and added pass through middleware for packages (#39410) 2025-03-05 20:55:35 +05:30
wdyr.ts chore: add blank line eslint rule (#36369) 2024-09-18 19:35:28 +03:00