Skip to content

Commit

Permalink
fix a conditional statement that may effect Cloudflare token issuing
Browse files Browse the repository at this point in the history
  • Loading branch information
warren-bank committed Jan 30, 2022
1 parent 3e39527 commit 84ea20b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "privacy-pass",
"version": "3.6.3",
"version": "3.6.4",
"private": true,
"contributors": [
"Suphanat Chunhapanya <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"description": "__MSG_appDescription__",
"version": "3.6.3",
"version": "3.6.4",
"manifest_version": 2,
"default_locale": "en",
"icons": {
Expand Down
17 changes: 14 additions & 3 deletions src/background/providers/cloudflare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ export class CloudflareProvider extends Provider {
details: chrome.webRequest.WebRequestHeadersDetails,
): chrome.webRequest.BlockingResponse | void {

if (this.issueInfo !== null) {
if (
(this.issueInfo !== null) &&
(this.issueInfo.requestId === details.requestId)
) {
if (this.matchesIssuingHeadersCriteria(details)) {
const issueInfo: IssueInfo = { ...this.issueInfo };

Expand Down Expand Up @@ -232,7 +235,10 @@ export class CloudflareProvider extends Provider {
private redeemToken(
details: chrome.webRequest.WebRequestHeadersDetails,
): chrome.webRequest.BlockingResponse | void {
if (this.redeemInfo === null || details.requestId !== this.redeemInfo.requestId) {
if (
(this.redeemInfo === null) ||
(this.redeemInfo.requestId !== details.requestId)
) {
return;
}

Expand Down Expand Up @@ -267,7 +273,12 @@ export class CloudflareProvider extends Provider {
let href: string;
let url: URL;

if (this.issueInfo === null) return false;
if (
(this.issueInfo === null) ||
(this.issueInfo.requestId !== details.requestId)
) {
return false;
}

href = this.issueInfo.url;
url = new URL(href);
Expand Down

0 comments on commit 84ea20b

Please sign in to comment.