Skip to content

v3-rc into master#276

Merged
haxxpop merged 50 commits intomasterfrom
v3-rc
Nov 18, 2021
Merged

v3-rc into master#276
haxxpop merged 50 commits intomasterfrom
v3-rc

Conversation

@haxxpop
Copy link
Member

@haxxpop haxxpop commented Nov 11, 2021

No description provided.

Create a Tab class to store the per-tab states, and add the listeners
for the tab events to update the Tab objects accordingly.
The HTTP header cf-chl-bypass is used to determine what Privacy Pass
provider (Cloudflare or hCaptcha) the website supports. We change the
tab context according to that header value.
Put the directory structure and the list of improvements to the previous
version in the README file.
Because Cloudflare CI uses npm by default, it's better to follow the
convention.
We change the place where the context is cleared from onBeforeRequest to
onHeadersReceived so that the context will last a bit longer
haxxpop and others added 23 commits November 17, 2021 16:56
1. Update the number after issuances and redemptions
2. Update the number when the active tab is changed
3. Update the number when the page in the tab is changed
Changes:
 - Removes crypto library, since extension relies on webcrypto API and
   sjcl libraries.
 - creating a voprf module.
 - Making Jest to work with ESM.
 - Adding linter and formating files with prettier.
 - Fix return type.
 - Rename a listener file.
 - Replacing ProviderID -> ProviderId.
 - Removing plural from providers.
 - Replacing HCaptcha -> Hcaptcha.
 - Adding contributor guide.
 - Adding return types to satisfy linter.
 - Removing default exports.
 - Add strickNullChecks to configuration.
 - Removing yarn related files.
 - Removing isomorphic-webcrypto.
 - Attaching TABS variable to window global object.
We need a Storage class so that we can add middlewares for all the
operations of the storage.
Since, when clearing the tokens, the provider buttons have to know that the
tokens are cleared, we Redux to share such info among the React
components. By doing this we can update the number of tokens shown in
the buttons immediately when the tokens are cleared
For icon updating, we allow the provider to explicitly actively update
the icon using the callback instead of using the event listeners
implemented in the Tab class. By doing this, the provider has the
freedom to update the icon any time it wants.

For tab reloading, we move the logic to the Tab class so that the
provider doesn't have to use the Chrome API directly and allow the
provider to reload the tab using the callback in the same way as in icon
updating.
The issuance involves handleBeforeRequest listener.
1. Firstly, the listener check if the request looks like the one that we
should send an issuance request.
2. If it passes the check, the listener returns the cancel command to
cancel the request. If not, it returns nothing and let the request
continue.
3. At the same time the listener returns, it calls a private method
"issue" to send an issuance request to the server and the method return
an array of issued tokens.
4. The listener stored the issued tokens in the storage.
5. The listener reloads the tab to get the proper web page for the tab.

The redemption involves handleHeadersReceived and handleBeforeSendHeaders
listeners. In handleHeadersReceived listener,
1. Firstly, the listener check if the response is the challenge page and
it supports Privacy Pass redemption.
2. If it passes the check, the listener gets a token from the storage to
redeem.
3. The listener sets "redeemInfo" property which includes the request id
and the mentioned token. The property will be used by
handleBeforeSendHeaders to redeem the token.
4. The listener returns the redirect command so that the browser will
send the same request again with the token attached.

In handleBeforeSendHeaders,
1. The listener will check if the provided request id matches the
request id in "redeemInfo". If so, it means that the request is from the
redirect command returned by handleHeadersReceived. If not, it returns
nothing and let the request continue.
2. If it passes the check, the listener attaches the token from
"redeemInfo" in the "challenge-bypass-token" HTTP header and clears the
"redeemInfo" property because "redeemInfo" is used already.
@armfazh
Copy link
Member

armfazh commented Nov 17, 2021

GitHub says there are still conflicts with the rebase. @ppopth

@haxxpop haxxpop merged commit 266a560 into master Nov 18, 2021
@haxxpop haxxpop deleted the v3-rc branch November 18, 2021 07:44
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