Add /tx-digest-hash endpoint to fetch last x tx digests#88
Add /tx-digest-hash endpoint to fetch last x tx digests#88tanuj-shardeum wants to merge 1 commit into
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| count = config.REQUEST_LIMIT.MAX_DIGESTS_PER_REQUEST | ||
| } | ||
|
|
||
| console.log(`Fetching latest ${count} tx digests`) |
Check warning
Code scanning / CodeQL
Log injection
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI almost 2 years ago
To fix the log injection issue, we need to sanitize the count parameter before using it in the log statement. Specifically, we should ensure that the count parameter does not contain any characters that could be interpreted as new lines or other control characters. This can be achieved by converting the count to a string and replacing any newline characters with an empty string.
| @@ -56,4 +56,5 @@ | ||
| } | ||
|
|
||
| console.log(`Fetching latest ${count} tx digests`) | ||
| // Sanitize the count parameter to prevent log injection | ||
| const sanitizedCount = count.toString().replace(/\n|\r/g, "") | ||
| console.log(`Fetching latest ${sanitizedCount} tx digests`) | ||
| const txDigests = await getLatestTxDigests(count) |
No description provided.