Skip to content
Merged

ALL #69

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fastify/assets/srcs/controllers/private/browsing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const browseUsersHandler = async (request: FastifyRequest, reply: Fastify
offset,
limit
} = request.params as { minAge: number, maxAge: number, minFame: number, maxFame: number, tags: string, lat: number, lng: number, radius: number, sortBy: string, offset: number, limit: number };

console.log('Browsing with params:', request.params);
if (!request.user?.id)
throw new UnauthorizedError();
const tagsArray = tags ? tags.split(',') : [];
Expand All @@ -36,6 +36,7 @@ export const browseUsersHandler = async (request: FastifyRequest, reply: Fastify
requestFilters,
(sortBy ? sortBy as BrowsingSort : undefined)
);
console.log(`Found ${users.length} users for browsing`);
return reply.status(200).send({ users });
} catch (error) {
if (error instanceof AppError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const completeProfileRoutes = async (fastify: FastifyInstance) => {
firstName: { type: 'string', minLength: 1, maxLength: 50, pattern: '[a-zA-Z-\' ]' },
lastName: { type: 'string', minLength: 1, maxLength: 50, pattern: '[a-zA-Z-\' ]' },
bio: { type: 'string', minLength: 50, maxLength: 500 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30, pattern: '[a-zA-Z_]' }, minItems: 3 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30 }, minItems: 3 },
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern validation for tags has been removed, which now allows any characters including special characters, numbers, and spaces. While this enables internationalization (e.g., accented characters like "Café"), it may also allow potentially problematic input like SQL injection attempts or XSS payloads. Consider adding a more permissive but still secure pattern that allows alphanumeric characters, spaces, and common international characters while blocking potentially dangerous characters like quotes, brackets, or HTML tags.

Suggested change
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30 }, minItems: 3 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30, pattern: "^[\\p{L}\\p{N} _-]+$" }, minItems: 3 },

Copilot uses AI. Check for mistakes.
gender: { type: 'string', enum: ['men', 'women'] },
orientation: { type: 'string', enum: ['heterosexual', 'homosexual', 'bisexual', 'other'] },
bornAt: { type: 'string', format: 'date-time' },
Expand Down
2 changes: 1 addition & 1 deletion fastify/assets/srcs/routes/private/user/me/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const profileRoutes = async (fastify: FastifyInstance) => {
lastName: { type: 'string', minLength: 1, maxLength: 50, pattern: '[a-zA-Z-\' ]' },
email: { type: 'string', format: 'email' },
bio: { type: 'string', minLength: 50, maxLength: 500 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30, pattern: '[a-zA-Z_]' }, minItems: 3 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30 }, minItems: 3 },
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern validation for tags has been removed, which now allows any characters including special characters, numbers, and spaces. While this enables internationalization (e.g., accented characters like "Café"), it may also allow potentially problematic input like SQL injection attempts or XSS payloads. Consider adding a more permissive but still secure pattern that allows alphanumeric characters, spaces, and common international characters while blocking potentially dangerous characters like quotes, brackets, or HTML tags.

Suggested change
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30 }, minItems: 3 },
tags: { type: 'array', items: { type: 'string', minLength: 1, maxLength: 30, pattern: '^[^"\'<>[\\]{}()]*$' }, minItems: 3 },

Copilot uses AI. Check for mistakes.
gender: { type: 'string', enum: ['men', 'women'] },
orientation: { type: 'string', enum: ['heterosexual', 'homosexual', 'bisexual', 'other'] },
bornAt: { type: 'string', format: 'date-time' },
Expand Down
1 change: 1 addition & 0 deletions fastify/assets/srcs/services/BrowsingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ BETWEEN ${filters.age.min} AND ${filters.age.max}
`,
parameters
);

return result.rows.map((row: {
id: number;
first_name: string;
Expand Down
1 change: 0 additions & 1 deletion fastify/assets/test/integration/fixtures/auth.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const signUpAndGetToken = async (app: FastifyInstance, userData: UserData


if (signUpResponse.statusCode !== 201) {
console.log('Sign up response:', signUpResponse);
throw new Error(`Failed to sign up user: ${signUpResponse.body}, code: ${signUpResponse.statusCode}`);
}

Expand Down
3 changes: 1 addition & 2 deletions nextjs/matcha/src/app/(logged)/browsing/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useState, useMemo, useCallback, useEffect } from "react";
import { useState, useMemo, useCallback, useEffect, use } from "react";
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use function is imported from React but is not used anywhere in this file. Unused imports should be removed to keep the code clean and avoid unnecessary bundle size increases.

Suggested change
import { useState, useMemo, useCallback, useEffect, use } from "react";
import { useState, useMemo, useCallback, useEffect } from "react";

Copilot uses AI. Check for mistakes.
import { useRouter, useSearchParams } from "next/navigation";
import Typography from "@/components/common/Typography";
import Stack from "@/components/common/Stack";
Expand Down Expand Up @@ -83,7 +83,6 @@ export default function BrowsingPage() {
const { likeUser, isLiking } = useLikeUser();
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable isLiking.

Suggested change
const { likeUser, isLiking } = useLikeUser();
const { likeUser } = useLikeUser();

Copilot uses AI. Check for mistakes.
const { passUser, isPassing } = usePassUser();
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable isPassing.

Suggested change
const { passUser, isPassing } = usePassUser();
const { passUser } = usePassUser();

Copilot uses AI. Check for mistakes.

// When search params change, update filters
useEffect(() => {
if (searchCriteria) {
setFilters(searchCriteria);
Expand Down
2 changes: 2 additions & 0 deletions nextjs/matcha/src/components/browsing/ProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default function ProfileCard({
{/* Image */}
<div className="relative aspect-3/4 w-full overflow-hidden">
<Image
width={48}
height={48}
Comment on lines +27 to +28
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The width and height values of 48px are likely incorrect for a profile card image. The parent container has aspect-3/4 which suggests a portrait aspect ratio, but these dimensions result in a square (48x48). This will cause the image to be stretched or distorted. Consider removing these fixed dimensions to let the image fill its container naturally, or use dimensions that match the 3:4 aspect ratio.

Suggested change
width={48}
height={48}
fill

Copilot uses AI. Check for mistakes.
unoptimized
src={pictureUrl}
alt={name}
Expand Down
1 change: 1 addition & 0 deletions nextjs/matcha/src/hooks/useOnboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const useOnboarding = () => {
return response;
} catch (error) {
console.error("Failed to update default location:", error);
throw error;
}
};

Expand Down
2 changes: 0 additions & 2 deletions nextjs/matcha/src/lib/api/browsing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ export const browsingApi = {
};
*/

console.log("donc les tags sont:", userProfile?.tags);

const {
ageMin = 18,
ageMax = 100,
Expand Down
1 change: 0 additions & 1 deletion nextjs/matcha/src/lib/api/userProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export const userProfileApi = {
*/
getUserProfile: async ({ userId }: GetUserProfileRequest): Promise<UserProfileResponse> => {
const response = await axios.get<UserProfileResponse>(`/api/private/user/view/${userId}`);
console.log('getUserProfile response:', response.data);
return response.data;
},

Expand Down
2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ http {
}

server {
client_max_body_size 2M;
client_max_body_size 50M;
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
Expand Down
Loading