-
Notifications
You must be signed in to change notification settings - Fork 23
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
just logging the entire req from Nginx #3542
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,7 +374,8 @@ const useJWTStrategy = (tenant, req, res, next) => | |
const endpoint = req.headers["x-original-uri"]; | ||
const clientOriginalIp = req.headers["x-client-original-ip"]; | ||
const requestBody = req.body; | ||
logObject("Request Body:", requestBody); | ||
logObject("Request Body", requestBody); | ||
logObject("logging the entire req", req); | ||
Comment on lines
+377
to
+378
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider security and performance implications of extensive logging. The addition of these logging statements aligns well with the PR objective of implementing logging for the entire request received from Nginx. This enhancement will undoubtedly improve our ability to debug and monitor incoming requests. However, I have a few friendly suggestions to ensure we're implementing this feature in the most effective and secure manner:
Here's a potential refactoring to address these points: - logObject("Request Body", requestBody);
- logObject("logging the entire req", req);
+ const sanitizedReq = sanitizeRequest(req);
+ logObject("Sanitized Request Body", sanitizedReq.body);
+ if (process.env.NODE_ENV === 'development') {
+ logObject("Full sanitized request (dev only)", sanitizedReq);
+ }
function sanitizeRequest(req) {
// Implement sanitization logic here
// e.g., remove sensitive headers, mask PII in body, etc.
} This approach sanitizes the request, always logs the body (which is likely smaller), and only logs the full request in development environments. Remember to implement the
|
||
|
||
let service = req.headers["service"] || "unknown"; | ||
let userAction = "unknown"; | ||
|
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.
💡 Codebase verification
Remaining Instances of the Old Import Path Detected
The following files still use the old import path
"@bin/kafka-consumer"
:src/incentives/bin/test/ut_kafka-consumer.js
src/incentives/bin/test/ut_index.js
src/blog-content-manager/bin/test/ut_kafka-consumer.js
src/blog-content-manager/bin/test/ut_index.js
src/auth-service/bin/test/ut_index.js
Please update these import statements to
"@bin/jobs/kafka-consumer"
to maintain consistency across the codebase.🔗 Analysis chain
Excellent restructuring of the kafka-consumer module!
The updated import path reflects a more organized project structure, which is a positive change. The kafka-consumer module is now appropriately placed within the 'jobs' subdirectory.
To ensure this change doesn't introduce any issues elsewhere in the codebase, let's verify other occurrences of the old import path:
If the first command returns any results, those files may need to be updated. The second command should confirm the existence of the kafka-consumer.js file in the new location.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1016