-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat: improve username sanitization in profiling example #7868
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
Conversation
Hello, This commit updates the username sanitization logic in the profiling example code to allow only alphanumeric characters. The original pattern (/[!@#$%^&*]/g) was limited and could lead to inconsistent behavior depending on input. Changed: - From: username = username.replace(/[!@#$%^&*]/g, '') - To: username = username.replace(/[^a-zA-Z0-9]/g, '') This change makes the input handling cleaner and more appropriate for educational purposes, aligning better with common sanitization practices. Relates to: nodejs#7867 Signed-off-by: DongNyoung Lee <121621378+Dongnyoung@users.noreply.github.com>
feat: improve username sanitization in profiling example
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
AugustinMauroy
left a comment
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.
In theory it's good. But I don't know what is the value behind this example
|
Thanks for the feedback! I suggested this change to make the example more aligned with common input sanitization practices. The original regex was quite limited, so I thought a more realistic pattern might help learners better understand typical use cases. Happy to adjust further if needed! |
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #7868 +/- ##
=======================================
Coverage 75.46% 75.46%
=======================================
Files 101 101
Lines 8306 8306
Branches 218 218
=======================================
Hits 6268 6268
Misses 2036 2036
Partials 2 2 ☔ View full report in Codecov by Sentry. |
|
Lighthouse Results
|
Hello,
This commit updates the username sanitization logic in the profiling
example code to allow only alphanumeric characters. The original
pattern (/[!@#$%^&*]/g) was limited and could lead to inconsistent
behavior depending on input.
Changed:
This change makes the input handling cleaner and more appropriate
for educational purposes, aligning better with common sanitization
practices.
Note: This change was initially merged into my forked repository by mistake during development. This PR now reflects the correct version intended for the original repository.
Relates to: #7867
Thank you for reviewing.