-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added profile routes #167
Added profile routes #167
Conversation
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
- | - | Cloudinary API keys | ec90e07 | backend/utils/cloudinary.ts | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Rebase to another branch first, you cannot work on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am closing this PR because it has quite a few issues and honestly disregards our code style. I would recommend analysing and understanding the codebase first before starting to work on an issue. That would be beneficial to both the team and the contributor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not change package-lock.json file unless prompted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when i start it, by running npm run dev , it is giving error conflicting packages so it deleled the node modules and package-lock.json folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not needed, you are not supposed to hardcode this for security reasons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is just env file , canbe changed anytime, when anyone start the server they can just copy paste this in their env file
} | ||
|
||
if (username) user.username = username; | ||
if (email) user.email = email; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how are you checking whether the email format is correct?
|
||
if ((req as MulterRequest).file) { | ||
const uploaded_url = await upload_on_cloudinary((req as MulterRequest).file.buffer); | ||
console.log("Uploaded URL:", uploaded_url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log("Uploaded URL:", uploaded_url);
This is going to print it...why?
What is this code snippet doing?
if (typeof uploaded_url === "string" && uploaded_url) { | ||
user.picture = uploaded_url; | ||
} else { | ||
console.error("Invalid URL returned from Cloudinary:", uploaded_url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never ever mention the name of file in error, this is robotic and the user doesn't need to know.
} | ||
} | ||
|
||
console.log("Updated Picture URL:", user.picture); // Check the value before saving |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated profile picture....not url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good
// const { v2: cloudinary } = require('cloudinary'); | ||
import {v2 as cloudinary} from 'cloudinary' | ||
import streamifier from 'streamifier' | ||
// const streamifier = require('streamifier'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you have this line here? redundant comments are against best practices and I would like us to keep only necessary comments.
secure: true, | ||
}); | ||
|
||
const upload_on_cloudinary = async (fileBuffer:Buffer, folderName = "demo") => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why demo folder name?
} | ||
} | ||
); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, this won't do.
I have added more profile routes and controller
Fixing #166
Routes:
/profile/getprofile
- get user profile/profil/editprofile
- edit user profile , added the functionality for adding user images/profile/quizStatus
- get user participated quizes