Skip to content

Add Scratch Addons identification to /csrf_token route - #7646

Closed
jeffalo wants to merge 2 commits into
ScratchAddons:masterfrom
jeffalo:identify-sa
Closed

Add Scratch Addons identification to /csrf_token route#7646
jeffalo wants to merge 2 commits into
ScratchAddons:masterfrom
jeffalo:identify-sa

Conversation

@jeffalo

@jeffalo jeffalo commented Jul 15, 2024

Copy link
Copy Markdown
Contributor

At Scratch we're seeing some extremely high request rates to these endpoints (orders of magnitude higher than other endpoints), we would like to identify which requests are coming from Scratch Addons.

This change adds a ?sa=true parameters to requests to these endpoints. It has no functional impact on Scratch Addons' use, it will help us diagnose the issue.

If possible, if we could get these changes in as soon as possible, that would be great!!

@WorldLanguages

Copy link
Copy Markdown
Member

The requests sent by the background page of the extension to scratch.mit.edu endpoints (/session, /csrf_token, etc) can be identified with some degree of confidence by checking the value of the Sec-Fetch-Site header. It is set to none (instead of same-origin) by the browser, even though host permissions were granted by the user.

It is unlikely there is other software used by hundreds that requests /csrf_token so I think we should assume it is Scratch Addons.

@WorldLanguages

Copy link
Copy Markdown
Member

Related: #6729

@WorldLanguages

Copy link
Copy Markdown
Member

To clarify, due to #6614 we can affirm that Scratch Addons is sending no more than 1 request for each 1.5 seconds / user. But apparently, when all users are online, it can really add up.

@WorldLanguages

Copy link
Copy Markdown
Member

Superseded by #7647.

These requests are no longer sent, so there's nothing we can add these URL params to.
Also, checking the coexistence of the Cookie header and Sec-Fetch-Site:none should be enough to identify that a browser extension is sending the requests from its background process. Further work to identify and throttle requests sent by the extension in all contexts, including the popup and Scratch tabs, can be discussed in issue #6729.

@jeffalo
jeffalo deleted the identify-sa branch July 16, 2024 07:28
@Hans5958 Hans5958 mentioned this pull request Jul 22, 2024
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.

2 participants