Skip to content
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

Only count distinct (domain+field) sniffs once #8

Merged
merged 2 commits into from May 23, 2022

Conversation

grundt
Copy link
Contributor

@grundt grundt commented May 17, 2022

This is a proposed behavior change to only increment the sniff count once, per distinct "sniff-domain/sniffed-field".

The change alters the "inputSniffed" message handler to -update- (rather than -insert-) sniff details, if the domain+fieldName+xpath already exists.
Included is a modification to setBadge() to display the sniff count when the badge is yellow (i.e. when there are sniffs, but no leaky requests).

This is a proposed behavior change to only increment the sniff count once, per distinct "sniff-domain/sniffed-field".

The change alters the "inputSniffed" message handler to -update- (rather than -insert-) sniff details, if the domain+fieldName+xpath already exists.
Included is a modification to setBadge() to display the sniff count when the badge is yellow (i.e. when there are sniffs, but no leaky requests).
},
timeStamp: sniffDetails.timeStamp,
});
const previouslySniffedDetails=sniffs[msgTabId][sniff.domain]["details"].find(d => d.inputField.fieldName===sniffDetails.fieldName && d.inputField.xpath===sniffDetails.xpath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to do this look up without find? For instance by using fieldName and xpath as keys?
sniffs[msgTabId][sniff.domain]["details"][sniffDetails.fieldName][sniffDetails.xpath], or something similar.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave a space before and after the =:
const previouslySniffedDetails=sniffs... -> const previouslySniffedDetails = sniffs...

Copy link
Contributor Author

@grundt grundt May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, I'm not aware of a better alternative to find in this case, and I'm not familiar with any way to use keys that way.
So please feel free to alter it however you feel works best.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Thanks for the contribution. We'll take it from there.

@gunesacar
Copy link
Collaborator

I think this is reasonable behavior change. There are pros and cons to both approaches, but we'll be happy to merge this once the comments are addressed.

@asumansenol asumansenol merged commit 22597fb into leaky-forms:main May 23, 2022
@grundt grundt deleted the background-sniff-count-increment branch May 23, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants