You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "KRYSTALM7 (via GitHub)" <gi...@apache.org> on 2026/08/26 08:47:32 UTC
[I] FINERACT-2442: Implement RSA-2048 encrypted authentication payload to prevent plaintext password transmission [fineract-loan-origination]
KRYSTALM7 opened a new issue, #101:
URL: https://github.com/apache/fineract-loan-origination/issues/101
## Description
The current login flow transmits the user's password as plaintext in the request payload. Although local development over HTTP is expected, the browser's network tab exposes the raw credentials in transit, this is not acceptable for any staging or production deployment.
As raised during feedback: the network tab shows exactly what is sent over the wire. The password must be encrypted **before** it leaves the browser,regardless of transport layer.
## Current Behavior
- `POST /api/v1/auth/login` and `POST /api/v1/auth/staff/login` accept a JSON
body containing the password in plaintext.
- The password is visible in the browser's network tab on every login request.
- There is no client-side encryption before the payload is sent.
## Expected Behavior
- The frontend fetches an RSA public key from the server before login.
- The password is encrypted client-side using the server's public key before being sent in the request payload.
- The server decrypts the payload using the corresponding private key, which is generated in memory and never persisted or exposed.
- The plaintext password is never transmitted over the network.
- Encrypted variants of the login endpoints handle the new flow:
`/api/v1/auth/login/encrypted` and `/api/v1/auth/staff/login/encrypted`
## Proposed Implementation
**Backend:**
- Add a `CryptoKeyController` exposing `GET /api/v1/auth/public-key` to serve the RSA public key to the client.
- Add a `crypto/` package containing RSA-2048 key pair generation logic, with the key pair generated in memory on startup, private key never
leaves the server.
- Update `AuthController` to handle encrypted login requests at the `/encrypted` endpoint variants.
- Update `FineractAuthenticationProvider` to support decryption before credential validation.
**Frontend:**
- Add `PayloadEncryptionService` to fetch the public key and encrypt the password client-side before dispatch.
- Update `AuthService` and `StaffAuthService` to use the encrypted login endpoints by default.
## Files Involved
**New files:**
- `frontend/src/app/core/services/payload-encryption.service.ts`
- `src/main/java/org/apache/fineract/los/api/CryptoKeyController.java`
- `src/main/java/org/apache/fineract/los/crypto/` (key generation package)
**Modified files:**
- `frontend/src/app/core/services/auth.service.ts`
- `frontend/src/app/core/services/staff-auth.service.ts`
- `src/main/java/org/apache/fineract/los/api/AuthController.java`
- `src/main/java/org/apache/fineract/los/security/FineractAuthenticationProvider.java`
- `src/main/java/org/apache/fineract/los/security/RateLimitFilter.java`
## Acceptance Criteria
- [ ] `GET /api/v1/auth/public-key` returns a valid RSA-2048 public key.
- [ ] RSA key pair is generated in memory on startup — private key is never persisted or logged.
- [ ] `POST /api/v1/auth/login/encrypted` and `POST /api/v1/auth/staff/login/encrypted` accept and correctly decrypt encrypted payloads.
- [ ] Frontend encrypts the password using the server's public key before sending any login request.
- [ ] Plaintext password is no longer visible in the browser network tab on login.
- [ ] Plain `/login` endpoints remain functional for local development.
- [ ] Existing authentication tests continue to pass.
- [ ] No credentials appear in logs or response bodies.
## Security Context
This complements the existing server-side hardening already in place:
- Argon2id password hashing (BCrypt-compatible fallback)
- `Cache-Control: no-store` on login responses
- CSP and security headers (nosniff, Referrer-Policy, Permissions-Policy)
- HSTS configured for HTTPS deployments
- Credential-related fields removed from response bodies and logs
---
**JIRA:** [FINERACT-2442](https://issues.apache.org/jira/browse/FINERACT-2442)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] FINERACT-2442: Implement RSA-2048 encrypted authentication payload to prevent plaintext password transmission [fineract-loan-origination]
Posted by "KRYSTALM7 (via GitHub)" <gi...@apache.org>.
KRYSTALM7 commented on issue #101:
URL: https://github.com/apache/fineract-loan-origination/issues/101#issuecomment-5644880511
Thanks @paultofunmi for flagging, this was picked up towards the end of GSoC and
the implementation is complete locally but was not pushed before the programme ended.
The stash contains the full RSA-2048 payload encryption implementation across the backend and frontend. The network tab confirms the login payload is encrypted end-to-end — `ciphertext` and `wrappedKey` are transmitted instead of plaintext credentials.
**What's implemented (unpushed):**
Backend:
- `CryptoKeyController.java` — RSA public key endpoint
- `src/main/java/.../crypto/` — encryption/decryption logic
- `AuthController.java`, `FineractAuthenticationProvider.java`, `RateLimitFilter.java` — updated to handle encrypted payloads
- `application.yml` — crypto configuration
Frontend:
- `payload-encryption.service.ts` — fetches public key and encrypts login payload
- `auth.service.ts`, `staff-auth.service.ts` — updated to use encryption service
I will clean up and open a pull request for this shortly.
<img width="1917" height="912" alt="Image" src="https://github.com/user-attachments/assets/81c1710d-82ae-499d-92ec-75a46c053599" />
<img width="977" height="425" alt="Image" src="https://github.com/user-attachments/assets/01eb03f8-2e49-4432-92d5-87951b92cdb9" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] FINERACT-2442: Implement RSA-2048 encrypted authentication payload to prevent plaintext password transmission [fineract-loan-origination]
Posted by "paultofunmi (via GitHub)" <gi...@apache.org>.
paultofunmi commented on issue #101:
URL: https://github.com/apache/fineract-loan-origination/issues/101#issuecomment-5641584234
picked up
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] FINERACT-2442: Implement RSA-2048 encrypted authentication payload to prevent plaintext password transmission [fineract-loan-origination]
Posted by "Aman-Mittal (via GitHub)" <gi...@apache.org>.
Aman-Mittal closed issue #101: FINERACT-2442: Implement RSA-2048 encrypted authentication payload to prevent plaintext password transmission
URL: https://github.com/apache/fineract-loan-origination/issues/101
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@fineract.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org