PromucFlow_constructor/app/client/cypress/e2e/Regression/ClientSide
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
..
ActionExecution fix: console log update and fix modal issue (#38692) 2025-01-19 09:25:04 +05:30
AdminSettings test: Admin setting new test cases with email (#38522) 2025-01-30 17:25:07 +05:30
Anvil chore: fix form widgets bugs (#38492) 2025-01-07 17:34:15 +05:30
AppNavigation chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
AuditLogs
Autocomplete feat: update autocomplete sorting (#38690) 2025-01-17 16:30:52 +05:30
Binding chore: update select component (#38954) 2025-02-06 13:10:25 +05:30
Branding chore: Migrate Tenant to Organization (#38891) 2025-02-18 20:41:07 +05:30
BugTests fix: Enabled js mode by default for Table and Select widget form display ui button (#39032) 2025-02-06 14:50:41 +05:30
CodeComment chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
CommunityTemplate chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
Debugger feat: Trigger autocomplete even outside bindings (#39446) 2025-03-07 13:35:16 +05:30
DynamicHeight chore: removed old flags for airgap instances (#36609) 2024-10-07 15:26:25 +05:30
Editor
EmbedSettings fix: Fix copy issue in embedsetting spec (#38590) 2025-01-13 10:43:55 +05:30
ExplorerTests test: validate 'Show Bindings' menu for queries & JS Objects in split-pane (#38577) 2025-01-13 10:51:17 +05:30
Fork test: adding tests for Fork app related to multiple workspace (#39263) 2025-02-25 13:28:33 +05:30
FormLogin chore: change snapshot package (#35867) 2024-09-12 11:09:42 +03:00
FormNativeToRawTests
Git fix: Use Spring's native CSRF protection, and fix login page (#37292) 2025-03-08 21:01:02 +05:30
Github
Google
Homepage chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
IDE chore: entity tabs replacement (#38989) 2025-02-06 11:33:54 +03:00
JSLibrary test: adding tests for custom lib (#37901) 2024-12-11 10:56:38 +05:30
JSObject chore: entity tabs replacement (#38989) 2025-02-06 11:33:54 +03:00
Linting feat: Enable new toolbar for cypress (#37148) 2024-12-03 09:21:43 +05:30
Login test: Sign in and Sign up cases (#39028) 2025-02-05 15:20:33 +05:30
MobileResponsiveTests chore: skipping cases for mockdb usage (#38888) 2025-01-30 11:47:38 +05:30
Onboarding chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
OneClickBinding chore: skipping cases for mockdb usage (#38888) 2025-01-30 11:47:38 +05:30
OtherUIFeatures fix: Use Spring's native CSRF protection, and fix login page (#37292) 2025-03-08 21:01:02 +05:30
PartialImportExport test: adding test for page functionality (#38538) 2025-01-18 20:26:42 +05:30
PeekOverlay feat: Inspect State CTA for discovery (#39100) 2025-02-14 21:57:08 +05:30
Performance chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
ProductRamps chore: rm dr ce (#34765) 2024-07-31 08:24:51 +05:30
PropertyPane fix: Revert "Revert "feat: Added focus ring for focus visible (#37700)" (#… (#38655) 2025-02-03 11:12:29 +05:30
PublishedApps test: flaky check for published Spec (#38427) 2025-01-03 12:08:10 +05:30
Refactoring chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
SetProperty chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
SettingsPane chore: Added sanity and tags for blank tag specs (#36421) 2024-09-19 18:21:58 +05:30
Templates chore: git mod - test fixes (#38357) 2025-01-07 12:30:42 +01:00
ThemingTests chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30
UserProfile
VisualTests fix: Checking fix working for js indent failure (#38382) 2024-12-27 08:43:46 +05:30
Widgets feat: Trigger autocomplete even outside bindings (#39446) 2025-03-07 13:35:16 +05:30
Workspace chore: Addding dependent tags (#36965) 2024-10-18 18:19:08 +05:30