Skip to content

Commit 2ce642a

Browse files
Merge pull request #614 from AikidoSec/extra-comments
Add extra comments
2 parents 0d31cd9 + 2b37e12 commit 2ce642a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

library/helpers/safeDecodeURIComponent.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ const HEX = {
6161
* Decodes a URI component, returning undefined if the URI is invalid.
6262
* This function is a safe alternative to `decodeURIComponent`, which throws
6363
* an error if the URI is malformed.
64+
*
65+
* We use this for performance reasons (throwing errors is very slow).
6466
*/
6567
export function safeDecodeURIComponent(uri: string): string | undefined {
6668
let percentPosition = uri.indexOf("%");

library/sources/http-server/checkIfRequestIsBlocked.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ const checkedBlocks = Symbol("__zen_checked_blocks__");
1414
* - Whether the user agent is blocked by a user agent blocklist
1515
*/
1616
export function checkIfRequestIsBlocked(
17+
// This flag is used to determine whether the request has already been checked
18+
// We use a Symbol so that we don't accidentally overwrite any other properties on the response object
19+
// and that we're the only ones that can access it
1720
res: ServerResponse & { [checkedBlocks]?: boolean },
1821
agent: Agent
1922
): boolean {

0 commit comments

Comments
 (0)