@netacea/cloudflare 1.6.3 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +90 -1
- package/dist/package.json +4 -4
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.6.6](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/cloudflare@1.6.5...@netacea/cloudflare@1.6.6) (2022-07-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **Cloudflare:** INT-196: Added mermaid section ([ce4a8d3](https://github.com/Netacea/JavascriptATAIntegration/commit/ce4a8d3b4a20ba9be243d4589b926545be96a614))
|
|
12
|
+
* **Cloudflare:** INT-196: Added subroutine diagram ([b378266](https://github.com/Netacea/JavascriptATAIntegration/commit/b378266b9c4b708b83f85d45ca23cc26628487df))
|
|
13
|
+
* **Cloudflare:** INT-196: Formatting change ([08a7010](https://github.com/Netacea/JavascriptATAIntegration/commit/08a701091fb459479655d5d4d64ac6eef7a31196))
|
|
14
|
+
* **Cloudflare:** INT-196: Get Mitigation Response as subroutine ([2c6e6cd](https://github.com/Netacea/JavascriptATAIntegration/commit/2c6e6cd76f3e67b3aa882f4e98de99d5cefb7891))
|
|
15
|
+
* **Cloudflare:** INT-196: Legend as subgraph ([7b1cd2f](https://github.com/Netacea/JavascriptATAIntegration/commit/7b1cd2f2072a7697417fa292c1f5ce8e7094131d))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [1.6.5](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/cloudflare@1.6.4...@netacea/cloudflare@1.6.5) (2022-07-12)
|
|
22
|
+
|
|
23
|
+
**Note:** Version bump only for package @netacea/cloudflare
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [1.6.4](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/cloudflare@1.6.3...@netacea/cloudflare@1.6.4) (2022-06-20)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package @netacea/cloudflare
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
6
37
|
## [1.6.3](https://github.com/Netacea/JavascriptATAIntegration/compare/@netacea/cloudflare@1.6.2...@netacea/cloudflare@1.6.3) (2022-06-16)
|
|
7
38
|
|
|
8
39
|
**Note:** Version bump only for package @netacea/cloudflare
|
package/README.md
CHANGED
|
@@ -7,11 +7,100 @@
|
|
|
7
7
|
|
|
8
8
|
`@netacea/cloudflare` is a package designed to add [Netacea](https://netacea.com) functionality to [Cloudflare Workers](https://workers.cloudflare.com/).
|
|
9
9
|
|
|
10
|
+
## Integration graph
|
|
11
|
+
```mermaid
|
|
12
|
+
graph TD
|
|
13
|
+
subgraph Cloudflare
|
|
14
|
+
subgraph Data flow
|
|
15
|
+
Request(Request) -->MitigationType{Mitigation<br/> Type}
|
|
16
|
+
MitigationType --> |Mitigate| Mitigate[[Get <br/>Mitigation<br/> Response]]
|
|
17
|
+
MitigationType --> |Inject| Inject[[Get <br/>Mitigation<br/> Response]]
|
|
18
|
+
MitigationType --> |Ingest| Ingest[Get Mitata cookie<br/> from header]
|
|
19
|
+
Mitigate --> IsResponseMitigated{Mitigated<br/> Response?}
|
|
20
|
+
Inject --> InjectReqHeaders[Add Headers<br/> to request]
|
|
21
|
+
Ingest --> IsHashValid{Is hash<br/> valid?}
|
|
22
|
+
IsResponseMitigated --> |NO| CallOriginServer[Call origin server]
|
|
23
|
+
IsResponseMitigated --> |YES| IsMitigationCaptcha{Mitigation<br/> - captcha?}
|
|
24
|
+
IsMitigationCaptcha --> |NO| MitigationCaptchaNo[Response body<br/> - Forbidden]
|
|
25
|
+
IsMitigationCaptcha --> |YES| MitigationCaptchaYes[Response body<br/> - mitigation result body]
|
|
26
|
+
MitigationCaptchaNo --> NetaceaIngest[Netacea<br/> Ingest]
|
|
27
|
+
MitigationCaptchaYes --> NetaceaIngest
|
|
28
|
+
InjectReqHeaders --> CallOriginServer
|
|
29
|
+
IsHashValid --> |NO| HashValidNo[Create proto Mitata<br/> with no user ID<br/> and max age]
|
|
30
|
+
IsHashValid --> |YES| CookieRequireReissue{Does cookie<br/> require reissue?}
|
|
31
|
+
CookieRequireReissue --> |NO| CookieRequireReissueNo[Set session status to ''<br/> and setCookie to be<br/> proto Mitata cookie]
|
|
32
|
+
CookieRequireReissue --> |YES| CookieRequireReissueYes[Create proto Mitata<br/> with user ID<br/> from Mitata cookie]
|
|
33
|
+
HashValidNo --> CallOriginServer
|
|
34
|
+
CookieRequireReissueNo --> CallOriginServer
|
|
35
|
+
CookieRequireReissueYes --> CallOriginServer
|
|
36
|
+
CallOriginServer --> IsNetaceaResultDefined{Is Netacea Result<br/> defined?}
|
|
37
|
+
IsNetaceaResultDefined --> |NO| NetaceaIngest
|
|
38
|
+
IsNetaceaResultDefined --> |YES| NetaceaResultDefined{New Netacea<br/> cookie<br/> from origin?}
|
|
39
|
+
NetaceaResultDefined --> |NO| NetaceaResultDefinedAddCookie[Append cookie<br/> to response]
|
|
40
|
+
NetaceaResultDefined --> |YES| NetaceaIngest
|
|
41
|
+
NetaceaResultDefinedAddCookie --> NetaceaIngest
|
|
42
|
+
NetaceaIngest --> Response(Response)
|
|
43
|
+
|
|
44
|
+
subgraph Legend
|
|
45
|
+
GreenBorder[Green border means this is shared code <br/>without green borders could still have<br/ some code >in shared areas]
|
|
46
|
+
style GreenBorder stroke:#00ce2e, stroke-width:4px
|
|
47
|
+
OrangeFilled[[This is a subroutine<br/> which flow you can see<br/> in the diagram on the right]]
|
|
48
|
+
style OrangeFilled fill:#d43804, stroke:#000000,stroke-width:3px
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
style MitigationType stroke:#00ce2e, stroke-width:4px
|
|
52
|
+
style Mitigate fill:#d43804, stroke:#000000,stroke-width:3px
|
|
53
|
+
style Inject fill:#d43804, stroke:#000000,stroke-width:3px
|
|
54
|
+
style Ingest stroke:#00ce2e, stroke-width:4px
|
|
55
|
+
style IsHashValid stroke:#00ce2e, stroke-width:4px
|
|
56
|
+
style CookieRequireReissue stroke:#00ce2e, stroke-width:4px
|
|
57
|
+
style CookieRequireReissueNo stroke:#00ce2e, stroke-width:4px
|
|
58
|
+
style CookieRequireReissueYes stroke:#00ce2e, stroke-width:4px
|
|
59
|
+
style HashValidNo stroke:#00ce2e, stroke-width:4px
|
|
60
|
+
style NetaceaIngest stroke:#00ce2e, stroke-width:4px
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
subgraph Get Mitigation Response
|
|
64
|
+
GetMitigationResponseReq[Request received] --> GetCookies[Get Mitata and<br/> Mitata Captcha<br/> cookie from<br/> requests COOKIE<br/> header]
|
|
65
|
+
GetCookies --> IsUrlCaptchaPost{Is URL <br/>catpcha<br/> post?}
|
|
66
|
+
IsUrlCaptchaPost --> |Yes| UrlCaptchaPost[Set API key<br/> and client IP headers<br/> on request]
|
|
67
|
+
UrlCaptchaPost --> GetMitataFromReqHeader[Get Mitata cookie<br/> from requests<br/> COOKIE header]
|
|
68
|
+
GetMitataFromReqHeader --> SetUserID[Set user ID header<br/> to the userId<br/> in Mitata cookie]
|
|
69
|
+
SetUserID --> MakeMitSvcReqToVerifyCaptcha[Make mit svc request<br/> to /AtaVerifyCaptcha<br/> endpoint]
|
|
70
|
+
IsUrlCaptchaPost --> |No| IsHashOrCookieInvalid{Is hash invalid<br/> OR does cookie<br/> require reissue?}
|
|
71
|
+
IsHashOrCookieInvalid --> |No| CreateMitataCookie[Create new Mitata cookie<br/> based on values in old cookie]
|
|
72
|
+
IsHashOrCookieInvalid --> |Yes| IsUserIdDefinedInMitata{Is user ID<br/> defined in<br/> Mitata cookie}
|
|
73
|
+
IsUserIdDefinedInMitata --> |Yes| AddUserIdToHeader[Add user id to<br/> X-Netacea-UserId<br/> header of mit svc request]
|
|
74
|
+
IsUserIdDefinedInMitata --> |No| MakeMitSvcReq[Make mit svc request]
|
|
75
|
+
AddUserIdToHeader --> MakeMitSvcReq
|
|
76
|
+
MakeMitSvcReq --> CreateMitataCookieFromMitSvcRes[Create Mitata cookie<br/> from mit svc response]
|
|
77
|
+
CreateMitataCookieFromMitSvcRes --> CalculateMitigation[Calculate mitigation<br/> from mit svc response]
|
|
78
|
+
CreateMitataCookie --> CalculateMitigation
|
|
79
|
+
CalculateMitigation --> CreateInjectHeaders[Create inject headers]
|
|
80
|
+
CreateInjectHeaders --> GetMitigationResponseRes[Return mit svc response]
|
|
81
|
+
|
|
82
|
+
style IsUrlCaptchaPost stroke:#00ce2e, stroke-width:4px
|
|
83
|
+
style UrlCaptchaPost stroke:#00ce2e, stroke-width:4px
|
|
84
|
+
style GetMitataFromReqHeader stroke:#00ce2e, stroke-width:4px
|
|
85
|
+
style SetUserID stroke:#00ce2e, stroke-width:4px
|
|
86
|
+
style MakeMitSvcReqToVerifyCaptcha stroke:#00ce2e, stroke-width:4px
|
|
87
|
+
style IsHashOrCookieInvalid stroke:#00ce2e, stroke-width:4px
|
|
88
|
+
style CreateMitataCookie stroke:#00ce2e, stroke-width:4px
|
|
89
|
+
style IsUserIdDefinedInMitata stroke:#00ce2e, stroke-width:4px
|
|
90
|
+
style AddUserIdToHeader stroke:#00ce2e, stroke-width:4px
|
|
91
|
+
style MakeMitSvcReq stroke:#00ce2e, stroke-width:4px
|
|
92
|
+
style CreateMitataCookieFromMitSvcRes stroke:#00ce2e, stroke-width:4px
|
|
93
|
+
style CalculateMitigation stroke:#00ce2e, stroke-width:4px
|
|
94
|
+
style CreateInjectHeaders stroke:#00ce2e, stroke-width:4px
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
```
|
|
98
|
+
|
|
10
99
|
## Installation
|
|
11
100
|
|
|
12
101
|
### 🤠 __Wrangler__
|
|
13
102
|
|
|
14
|
-
We strongly recommend installing and using
|
|
103
|
+
We strongly recommend installing and using [wrangler](https://github.com/cloudflare/wrangler) to manage your cloudflare workers. Wrangler is a CLI tool designed to make previewing and deploying Cloudflare Workers seamless.
|
|
15
104
|
|
|
16
105
|
#### 🌻 Starting fresh
|
|
17
106
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netacea/cloudflare",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "Netacea Cloudflare CDN Integration",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@netacea/netaceaintegrationbase": "^1.10.
|
|
19
|
-
"@netacea/netaceaintegrationtestrunner": "^1.5.
|
|
18
|
+
"@netacea/netaceaintegrationbase": "^1.10.3",
|
|
19
|
+
"@netacea/netaceaintegrationtestrunner": "^1.5.5"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@cloudflare/workers-types": "^2.0.0",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"tsconfig-paths": "^3.9.0",
|
|
33
33
|
"typescript": "^3.9.7"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "9c24424966a5b9ca9a64b996d687917b6b39642a"
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netacea/cloudflare",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "Netacea Cloudflare CDN Integration",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@netacea/netaceaintegrationbase": "^1.10.
|
|
19
|
-
"@netacea/netaceaintegrationtestrunner": "^1.5.
|
|
18
|
+
"@netacea/netaceaintegrationbase": "^1.10.3",
|
|
19
|
+
"@netacea/netaceaintegrationtestrunner": "^1.5.5"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@cloudflare/workers-types": "^2.0.0",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"tsconfig-paths": "^3.9.0",
|
|
33
33
|
"typescript": "^3.9.7"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "9c24424966a5b9ca9a64b996d687917b6b39642a"
|
|
36
36
|
}
|