mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: harden OAuth login flow — open redirect, path traversal, info leak
- Validate authorize_url is HTTPS before redirect (open redirect prevention) - encodeURIComponent on provider name in API URL paths (path traversal prevention) - encodeURIComponent on referralCode in t.me deep link - Gate console.warn behind import.meta.env.DEV (no info leak in prod)
This commit is contained in:
@@ -138,7 +138,7 @@ export const authApi = {
|
||||
provider: string,
|
||||
): Promise<{ authorize_url: string; state: string }> => {
|
||||
const response = await apiClient.get<{ authorize_url: string; state: string }>(
|
||||
`/cabinet/auth/oauth/${provider}/authorize`,
|
||||
`/cabinet/auth/oauth/${encodeURIComponent(provider)}/authorize`,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
@@ -146,7 +146,7 @@ export const authApi = {
|
||||
// OAuth: callback (exchange code for tokens)
|
||||
oauthCallback: async (provider: string, code: string, state: string): Promise<AuthResponse> => {
|
||||
const response = await apiClient.post<AuthResponse>(
|
||||
`/cabinet/auth/oauth/${provider}/callback`,
|
||||
`/cabinet/auth/oauth/${encodeURIComponent(provider)}/callback`,
|
||||
{ code, state },
|
||||
);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user