siarashield_workspace 0.0.22 → 0.0.24
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/README.md
CHANGED
|
@@ -23,21 +23,23 @@ Get your public/private keys from <a href="https://mycybersiara.com" target="_bl
|
|
|
23
23
|
## 3) Put keys in correct place
|
|
24
24
|
|
|
25
25
|
- **Frontend (Angular):** public key only
|
|
26
|
-
- **Backend (.env):** private key only
|
|
26
|
+
- **Backend (.env):** private key only
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Angular `environment` example:
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
```ts
|
|
31
|
+
export const environment = {
|
|
32
|
+
siaraShieldPublicKey: 'YOUR-PUBLIC-KEY',
|
|
33
|
+
};
|
|
34
|
+
```
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
siaraShieldPublicKey:"YOUR-PUBLIC-KEY",
|
|
35
|
-
siaraShieldPrivateKey:"YOUR-PRIVATE-KEY"
|
|
36
|
-
}
|
|
36
|
+
Backend `.env` example:
|
|
37
37
|
|
|
38
|
+
```dotenv
|
|
39
|
+
SIARASHIELD_PRIVATE_KEY=YOUR-PRIVATE-KEY
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
Do not place the private key in Angular environment files, templates, or browser code.
|
|
41
43
|
|
|
42
44
|
## 4) Add captcha container in template
|
|
43
45
|
|
|
@@ -45,7 +47,7 @@ If your frontend project already uses `environment`, that is fine. Map it to the
|
|
|
45
47
|
<div class="SiaraShield"></div>
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
Add the `CaptchaSubmit` class to your submit button:
|
|
49
51
|
|
|
50
52
|
```html
|
|
51
53
|
<button class="CaptchaSubmit"></button>
|
|
@@ -53,7 +55,7 @@ In your submit button, make sure to add this class:CaptchaSubmit
|
|
|
53
55
|
|
|
54
56
|
## 5) Add TypeScript integration (copy-paste)
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
You can integrate SiaraShield into any form component, including Login, Contact Us, Signup, Forgot Password, and Lead Form screens.
|
|
57
59
|
|
|
58
60
|
```ts
|
|
59
61
|
import { OnInit } from '@angular/core';
|
|
@@ -68,8 +70,7 @@ export class FormComponent implements OnInit {
|
|
|
68
70
|
initializeCaptcha() {
|
|
69
71
|
initSiaraShield({
|
|
70
72
|
publicKey: environment.siaraShieldPublicKey,
|
|
71
|
-
|
|
72
|
-
// cspNonce: 'server-generated-nonce',
|
|
73
|
+
cspNonce: (window as any).__cspNonce || undefined,
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -77,67 +78,84 @@ export class FormComponent implements OnInit {
|
|
|
77
78
|
const result = checkSiaraShieldCaptcha();
|
|
78
79
|
if (!result.ok) {
|
|
79
80
|
console.log('Captcha not completed yet');
|
|
80
|
-
return;
|
|
81
|
+
return;
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
alert('Form submitted successfully');
|
|
87
|
-
}
|
|
84
|
+
console.log(result.token);
|
|
85
|
+
// API call here
|
|
86
|
+
alert('Form submitted successfully');
|
|
88
87
|
}
|
|
89
88
|
}
|
|
90
89
|
```
|
|
91
90
|
|
|
92
|
-
|
|
91
|
+
Keep your submit API logic inside the successful captcha branch.
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
If your frontend reads the nonce from the DOM instead of `window`, you can reuse the nonce from an existing script tag:
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- When needed, package loads:
|
|
100
|
-
- `https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js`
|
|
101
|
-
- Package also loads:
|
|
102
|
-
- `https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js`
|
|
103
|
-
- `https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js`
|
|
95
|
+
```ts
|
|
96
|
+
const nonce = document.querySelector('script[nonce]')?.getAttribute('nonce') || undefined;
|
|
97
|
+
```
|
|
104
98
|
|
|
105
|
-
|
|
99
|
+
The nonce must be generated on the server for each request. The plugin NEVER generates a nonce in the browser.
|
|
106
100
|
|
|
107
|
-
|
|
101
|
+
## CSP Compliance (Important)
|
|
108
102
|
|
|
109
|
-
|
|
110
|
-
import { getSiaraShieldCspPolicy, mergeSiaraShieldCspPolicy } from 'siarashield_workspace';
|
|
103
|
+
Inline scripts are blocked by CSP unless you allow them with a nonce or a hash. This package does not execute inline JavaScript and does not use `eval()`, `new Function()`, `setTimeout(string)`, `setInterval(string)`, or any other string-based execution path. All scripts are loaded as external resources. Any dynamically created `<script>` elements are assigned the provided CSP nonce when `cspNonce` is passed.
|
|
111
104
|
|
|
112
|
-
|
|
105
|
+
For strict CSP deployments:
|
|
113
106
|
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
- Generate the nonce on the server for each request.
|
|
108
|
+
- Use the SAME nonce in the `Content-Security-Policy` header.
|
|
109
|
+
- Use the SAME nonce on the `<script>` tag that loads your Angular app or any direct SiaraShield resource.
|
|
110
|
+
- Use the SAME nonce in `initSiaraShield({ cspNonce: ... })`.
|
|
111
|
+
- The plugin NEVER generates a nonce in the browser.
|
|
112
|
+
- If a valid CSP nonce is required but not provided, browsers will block script execution and the captcha will fail to load.
|
|
116
113
|
|
|
117
|
-
|
|
114
|
+
Safe CSP example:
|
|
118
115
|
|
|
119
116
|
```http
|
|
120
|
-
|
|
121
|
-
script-src
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
style-src 'self'
|
|
117
|
+
default-src 'self';
|
|
118
|
+
script-src 'self' 'nonce-<dynamic>' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
119
|
+
script-src-elem 'self' 'nonce-<dynamic>' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
120
|
+
connect-src 'self' https://embed.mycybersiara.com https://embedcdn.mycybersiara.com;
|
|
121
|
+
style-src 'self' https://embed.mycybersiara.com https://mycybersiara.com https://fonts.googleapis.com https://cdnjs.cloudflare.com;
|
|
122
|
+
font-src 'self' https://fonts.gstatic.com https://mycybersiara.com https://cdnjs.cloudflare.com data:;
|
|
123
|
+
img-src 'self' data: https://embed.mycybersiara.com https://embedcdn.mycybersiara.com https://mycybersiara.com;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Example using the same server-generated nonce in a script tag:
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<script nonce="YOUR_NONCE" src="https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js"></script>
|
|
125
130
|
```
|
|
126
131
|
|
|
127
|
-
If
|
|
132
|
+
If your Angular app initializes SiaraShield from the main application bundle, that bundle's `<script>` tag must use the same nonce value that appears in the CSP header.
|
|
128
133
|
|
|
129
|
-
|
|
134
|
+
`getSiaraShieldCspPolicy()` and `mergeSiaraShieldCspPolicy()` only generate a baseline CSP string. These helpers do not inject a nonce and do not apply headers. The server must inject the nonce and must apply the final `Content-Security-Policy` header. The generated policy must always be reviewed before production use.
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
The package still works in environments without CSP or with relaxed policies. If your site uses a strict nonce-based CSP, passing the server-generated nonce is required.
|
|
132
137
|
|
|
133
|
-
|
|
138
|
+
## jQuery loading behavior
|
|
139
|
+
|
|
140
|
+
- Default `loadJQuery` is `true`.
|
|
141
|
+
- If jQuery is not already available, the package loads:
|
|
142
|
+
- `https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js`
|
|
143
|
+
- The package also loads:
|
|
144
|
+
- `https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js`
|
|
145
|
+
- `https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js`
|
|
146
|
+
- jQuery and the captcha bootstrap process may create script elements dynamically.
|
|
147
|
+
- When `cspNonce` is provided, all dynamically created script elements created by this package are assigned that nonce.
|
|
148
|
+
- This is required for compatibility with strict nonce-based CSP policies.
|
|
149
|
+
- If a valid CSP nonce is required but not passed, browsers will block those script loads and the captcha will fail to initialize.
|
|
150
|
+
- If your app already loads jQuery, set `loadJQuery: false`.
|
|
151
|
+
- If your app loads jQuery from another CDN, allow that host in `script-src` and `script-src-elem`.
|
|
134
152
|
|
|
135
153
|
## Quick troubleshooting
|
|
136
154
|
|
|
137
|
-
- Captcha not visible -> confirm `<div class="SiaraShield"></div>` is present
|
|
138
|
-
- `CheckCaptcha` not available -> ensure `initSiaraShield(...)` ran
|
|
139
|
-
- CSP
|
|
140
|
-
- Token empty -> check browser console and network calls after clicking submit
|
|
155
|
+
- Captcha not visible -> confirm `<div class="SiaraShield"></div>` is present.
|
|
156
|
+
- `CheckCaptcha` not available -> ensure `initSiaraShield(...)` ran and CSP allows the required hosts.
|
|
157
|
+
- CSP error in console -> confirm the same server-generated nonce is present in the CSP header, the bootstrapping `<script>` tag, and `initSiaraShield(...)`.
|
|
158
|
+
- Token empty -> check browser console and network calls after clicking submit.
|
|
141
159
|
|
|
142
160
|
## Build and pack (library maintainers)
|
|
143
161
|
|
|
@@ -9,45 +9,154 @@ function getInitCaptchaFn(g) {
|
|
|
9
9
|
return g.initCaptcha ?? g.InitCaptcha;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
const SCRIPT_STATUS_BY_DOCUMENT = new WeakMap();
|
|
13
|
+
const SCRIPT_PENDING_BY_DOCUMENT = new WeakMap();
|
|
14
|
+
const DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';
|
|
15
|
+
function getStatusBySrc(documentRef) {
|
|
16
|
+
let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);
|
|
17
|
+
if (!statusBySrc) {
|
|
18
|
+
statusBySrc = new Map();
|
|
19
|
+
SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);
|
|
20
|
+
}
|
|
21
|
+
return statusBySrc;
|
|
22
|
+
}
|
|
23
|
+
function getPendingBySrc(documentRef) {
|
|
24
|
+
let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);
|
|
25
|
+
if (!pendingBySrc) {
|
|
26
|
+
pendingBySrc = new Map();
|
|
27
|
+
SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);
|
|
28
|
+
}
|
|
29
|
+
return pendingBySrc;
|
|
30
|
+
}
|
|
31
|
+
function getDynamicScriptNoncePatchState() {
|
|
32
|
+
const globalState = globalThis;
|
|
33
|
+
if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {
|
|
34
|
+
globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {
|
|
35
|
+
nonceByDocument: new WeakMap(),
|
|
36
|
+
patched: false,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];
|
|
40
|
+
}
|
|
41
|
+
function normalizeNonce(nonce) {
|
|
42
|
+
const trimmed = nonce?.trim();
|
|
43
|
+
return trimmed ? trimmed : undefined;
|
|
44
|
+
}
|
|
45
|
+
function isScriptElement(node) {
|
|
46
|
+
return node instanceof Element && node.tagName.toLowerCase() === 'script';
|
|
47
|
+
}
|
|
48
|
+
function applyScriptNonce(script, nonce) {
|
|
49
|
+
const resolvedNonce = normalizeNonce(nonce);
|
|
50
|
+
if (!resolvedNonce) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
script.setAttribute('nonce', resolvedNonce);
|
|
54
|
+
script.nonce = resolvedNonce;
|
|
55
|
+
}
|
|
56
|
+
function applyTrackedNonce(node) {
|
|
57
|
+
if (!isScriptElement(node)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const documentRef = node.ownerDocument;
|
|
61
|
+
if (!documentRef) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);
|
|
65
|
+
applyScriptNonce(node, nonce);
|
|
66
|
+
}
|
|
67
|
+
function patchDynamicScriptInsertion() {
|
|
68
|
+
const patchState = getDynamicScriptNoncePatchState();
|
|
69
|
+
if (patchState.patched) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const originalAppendChild = Node.prototype.appendChild;
|
|
73
|
+
const originalInsertBefore = Node.prototype.insertBefore;
|
|
74
|
+
const originalReplaceChild = Node.prototype.replaceChild;
|
|
75
|
+
Node.prototype.appendChild = function (node) {
|
|
76
|
+
applyTrackedNonce(node);
|
|
77
|
+
return originalAppendChild.call(this, node);
|
|
78
|
+
};
|
|
79
|
+
Node.prototype.insertBefore = function (node, child) {
|
|
80
|
+
applyTrackedNonce(node);
|
|
81
|
+
return originalInsertBefore.call(this, node, child);
|
|
82
|
+
};
|
|
83
|
+
Node.prototype.replaceChild = function (node, child) {
|
|
84
|
+
applyTrackedNonce(node);
|
|
85
|
+
return originalReplaceChild.call(this, node, child);
|
|
86
|
+
};
|
|
87
|
+
patchState.patched = true;
|
|
88
|
+
}
|
|
89
|
+
function resolveCspNonce(documentRef, explicitNonce) {
|
|
90
|
+
const resolvedExplicitNonce = normalizeNonce(explicitNonce);
|
|
91
|
+
if (resolvedExplicitNonce) {
|
|
92
|
+
return resolvedExplicitNonce;
|
|
93
|
+
}
|
|
94
|
+
const scriptWithNonce = documentRef.querySelector('script[nonce]');
|
|
95
|
+
const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);
|
|
96
|
+
if (nonceFromScript) {
|
|
97
|
+
return nonceFromScript;
|
|
98
|
+
}
|
|
99
|
+
const nonceMeta = documentRef.querySelector('meta[name="csp-nonce"]');
|
|
100
|
+
return normalizeNonce(nonceMeta?.content);
|
|
101
|
+
}
|
|
102
|
+
function prepareScriptNonce(documentRef, explicitNonce) {
|
|
103
|
+
const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);
|
|
104
|
+
const patchState = getDynamicScriptNoncePatchState();
|
|
105
|
+
patchDynamicScriptInsertion();
|
|
106
|
+
if (resolvedNonce) {
|
|
107
|
+
patchState.nonceByDocument.set(documentRef, resolvedNonce);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
patchState.nonceByDocument.delete(documentRef);
|
|
111
|
+
}
|
|
112
|
+
return resolvedNonce;
|
|
113
|
+
}
|
|
114
|
+
function loadScript(documentRef, src, options) {
|
|
115
|
+
const nonce = prepareScriptNonce(documentRef, options?.nonce);
|
|
116
|
+
const statusBySrc = getStatusBySrc(documentRef);
|
|
117
|
+
const pendingBySrc = getPendingBySrc(documentRef);
|
|
118
|
+
const existing = documentRef.querySelector(`script[src="${src}"]`);
|
|
119
|
+
if (existing) {
|
|
120
|
+
applyScriptNonce(existing, nonce);
|
|
121
|
+
const status = statusBySrc.get(src);
|
|
122
|
+
if (status === 'loaded') {
|
|
123
|
+
return Promise.resolve();
|
|
124
|
+
}
|
|
125
|
+
const pending = pendingBySrc.get(src);
|
|
126
|
+
if (pending) {
|
|
127
|
+
return pending;
|
|
128
|
+
}
|
|
129
|
+
return Promise.resolve();
|
|
130
|
+
}
|
|
131
|
+
statusBySrc.set(src, 'loading');
|
|
132
|
+
const pending = new Promise((resolve, reject) => {
|
|
133
|
+
const script = documentRef.createElement('script');
|
|
134
|
+
script.src = src;
|
|
135
|
+
script.async = true;
|
|
136
|
+
applyScriptNonce(script, nonce);
|
|
137
|
+
script.onload = () => {
|
|
138
|
+
statusBySrc.set(src, 'loaded');
|
|
139
|
+
pendingBySrc.delete(src);
|
|
140
|
+
resolve();
|
|
141
|
+
};
|
|
142
|
+
script.onerror = () => {
|
|
143
|
+
statusBySrc.set(src, 'error');
|
|
144
|
+
pendingBySrc.delete(src);
|
|
145
|
+
reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));
|
|
146
|
+
};
|
|
147
|
+
documentRef.head.appendChild(script);
|
|
148
|
+
});
|
|
149
|
+
pendingBySrc.set(src, pending);
|
|
150
|
+
return pending;
|
|
151
|
+
}
|
|
152
|
+
|
|
12
153
|
class SiaraShieldLoaderService {
|
|
13
154
|
document;
|
|
14
|
-
statusBySrc = new Map();
|
|
15
|
-
pendingBySrc = new Map();
|
|
16
155
|
constructor(document) {
|
|
17
156
|
this.document = document;
|
|
18
157
|
}
|
|
19
158
|
loadScript(src, options) {
|
|
20
|
-
|
|
21
|
-
if (existing)
|
|
22
|
-
return Promise.resolve();
|
|
23
|
-
const status = this.statusBySrc.get(src);
|
|
24
|
-
if (status === 'loaded')
|
|
25
|
-
return Promise.resolve();
|
|
26
|
-
if (status === 'loading') {
|
|
27
|
-
const pending = this.pendingBySrc.get(src);
|
|
28
|
-
if (pending)
|
|
29
|
-
return pending;
|
|
30
|
-
}
|
|
31
|
-
this.statusBySrc.set(src, 'loading');
|
|
32
|
-
const pending = new Promise((resolve, reject) => {
|
|
33
|
-
const script = this.document.createElement('script');
|
|
34
|
-
script.src = src;
|
|
35
|
-
script.async = true;
|
|
36
|
-
if (options?.nonce) {
|
|
37
|
-
script.nonce = options.nonce;
|
|
38
|
-
}
|
|
39
|
-
script.onload = () => {
|
|
40
|
-
this.statusBySrc.set(src, 'loaded');
|
|
41
|
-
resolve();
|
|
42
|
-
};
|
|
43
|
-
script.onerror = () => {
|
|
44
|
-
this.statusBySrc.set(src, 'error');
|
|
45
|
-
reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));
|
|
46
|
-
};
|
|
47
|
-
this.document.head.appendChild(script);
|
|
48
|
-
});
|
|
49
|
-
this.pendingBySrc.set(src, pending);
|
|
50
|
-
return pending;
|
|
159
|
+
return loadScript(this.document, src, options);
|
|
51
160
|
}
|
|
52
161
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SiaraShieldLoaderService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
53
162
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.5", ngImport: i0, type: SiaraShieldLoaderService, providedIn: 'root' });
|
|
@@ -90,7 +199,7 @@ class SiaraShieldComponent {
|
|
|
90
199
|
if (!options.publicKey) {
|
|
91
200
|
throw new Error('SiaraShieldComponent: publicKey is required.');
|
|
92
201
|
}
|
|
93
|
-
const cspNonce = this.
|
|
202
|
+
const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);
|
|
94
203
|
if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {
|
|
95
204
|
await this.loader.loadScript(JQUERY_FALLBACK_SRC$1, { nonce: cspNonce });
|
|
96
205
|
}
|
|
@@ -121,20 +230,6 @@ class SiaraShieldComponent {
|
|
|
121
230
|
const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector('script[src*="jquery"]');
|
|
122
231
|
return Boolean(existingJqueryScript);
|
|
123
232
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Uses explicit nonce first. If not provided, tries to reuse nonce
|
|
126
|
-
* from the first script tag or from `<meta name="csp-nonce">`.
|
|
127
|
-
*/
|
|
128
|
-
resolveCspNonce(explicitNonce) {
|
|
129
|
-
if (explicitNonce)
|
|
130
|
-
return explicitNonce;
|
|
131
|
-
const doc = this.host.nativeElement.ownerDocument;
|
|
132
|
-
const scriptWithNonce = doc.querySelector('script[nonce]');
|
|
133
|
-
if (scriptWithNonce?.nonce)
|
|
134
|
-
return scriptWithNonce.nonce;
|
|
135
|
-
const nonceMeta = doc.querySelector('meta[name="csp-nonce"]');
|
|
136
|
-
return nonceMeta?.content || undefined;
|
|
137
|
-
}
|
|
138
233
|
preventDuplicateValidationBootstrap(g) {
|
|
139
234
|
const originalAppendValidation = g.AppendValidationJS;
|
|
140
235
|
if (typeof originalAppendValidation !== 'function') {
|
|
@@ -220,22 +315,6 @@ const VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/Sia
|
|
|
220
315
|
const CAPTCHA_READY_TIMEOUT_MS = 8000;
|
|
221
316
|
let pending = null;
|
|
222
317
|
let initialized = false;
|
|
223
|
-
function loadScript(src, options) {
|
|
224
|
-
const existing = document.querySelector(`script[src="${src}"]`);
|
|
225
|
-
if (existing)
|
|
226
|
-
return Promise.resolve();
|
|
227
|
-
return new Promise((resolve, reject) => {
|
|
228
|
-
const script = document.createElement('script');
|
|
229
|
-
script.src = src;
|
|
230
|
-
script.async = true;
|
|
231
|
-
if (options?.nonce) {
|
|
232
|
-
script.nonce = options.nonce;
|
|
233
|
-
}
|
|
234
|
-
script.onload = () => resolve();
|
|
235
|
-
script.onerror = () => reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));
|
|
236
|
-
document.head.appendChild(script);
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
318
|
function isJQueryAlreadyAvailable() {
|
|
240
319
|
const g = getSiaraShieldGlobals();
|
|
241
320
|
if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {
|
|
@@ -244,15 +323,6 @@ function isJQueryAlreadyAvailable() {
|
|
|
244
323
|
const existingJqueryScript = document.querySelector('script[src*="jquery"]');
|
|
245
324
|
return Boolean(existingJqueryScript);
|
|
246
325
|
}
|
|
247
|
-
function resolveCspNonce(explicitNonce) {
|
|
248
|
-
if (explicitNonce)
|
|
249
|
-
return explicitNonce;
|
|
250
|
-
const scriptWithNonce = document.querySelector('script[nonce]');
|
|
251
|
-
if (scriptWithNonce?.nonce)
|
|
252
|
-
return scriptWithNonce.nonce;
|
|
253
|
-
const nonceMeta = document.querySelector('meta[name="csp-nonce"]');
|
|
254
|
-
return nonceMeta?.content || undefined;
|
|
255
|
-
}
|
|
256
326
|
function preventDuplicateValidationBootstrap(g) {
|
|
257
327
|
const originalAppendValidation = g.AppendValidationJS;
|
|
258
328
|
if (typeof originalAppendValidation !== 'function') {
|
|
@@ -293,14 +363,14 @@ async function initSiaraShield(options) {
|
|
|
293
363
|
throw new Error('initSiaraShield: publicKey is required.');
|
|
294
364
|
}
|
|
295
365
|
pending = (async () => {
|
|
296
|
-
const cspNonce =
|
|
366
|
+
const cspNonce = prepareScriptNonce(document, options.cspNonce);
|
|
297
367
|
if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {
|
|
298
|
-
await loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });
|
|
368
|
+
await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });
|
|
299
369
|
}
|
|
300
|
-
await loadScript(CAPTCHA_SCRIPT_SRC, {
|
|
370
|
+
await loadScript(document, CAPTCHA_SCRIPT_SRC, {
|
|
301
371
|
nonce: cspNonce,
|
|
302
372
|
});
|
|
303
|
-
await loadScript(VALIDATION_SCRIPT_SRC, {
|
|
373
|
+
await loadScript(document, VALIDATION_SCRIPT_SRC, {
|
|
304
374
|
nonce: cspNonce,
|
|
305
375
|
});
|
|
306
376
|
const g = getSiaraShieldGlobals();
|
|
@@ -361,8 +431,23 @@ const DATA = 'data:';
|
|
|
361
431
|
const UNSAFE_INLINE = "'unsafe-inline'";
|
|
362
432
|
const SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'];
|
|
363
433
|
const OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'];
|
|
364
|
-
const CONNECT_HOSTS = ['https://embed.mycybersiara.com'];
|
|
365
|
-
const
|
|
434
|
+
const CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'];
|
|
435
|
+
const STYLE_HOSTS = [
|
|
436
|
+
'https://embed.mycybersiara.com',
|
|
437
|
+
'https://mycybersiara.com',
|
|
438
|
+
'https://fonts.googleapis.com',
|
|
439
|
+
'https://cdnjs.cloudflare.com',
|
|
440
|
+
];
|
|
441
|
+
const FONT_HOSTS = [
|
|
442
|
+
'https://fonts.gstatic.com',
|
|
443
|
+
'https://mycybersiara.com',
|
|
444
|
+
'https://cdnjs.cloudflare.com',
|
|
445
|
+
];
|
|
446
|
+
const IMG_HOSTS = [
|
|
447
|
+
'https://embed.mycybersiara.com',
|
|
448
|
+
'https://embedcdn.mycybersiara.com',
|
|
449
|
+
'https://mycybersiara.com',
|
|
450
|
+
];
|
|
366
451
|
function unique(values) {
|
|
367
452
|
return [...new Set(values.filter((value) => Boolean(value && value.trim())))];
|
|
368
453
|
}
|
|
@@ -390,15 +475,18 @@ function parsePolicy(policy) {
|
|
|
390
475
|
}
|
|
391
476
|
function getSiaraShieldCspDirectives(options) {
|
|
392
477
|
const includeGoogleApis = options?.includeGoogleApis ?? false;
|
|
478
|
+
const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? true;
|
|
393
479
|
const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? true;
|
|
394
480
|
const nonce = nonceSource(options?.nonce);
|
|
395
481
|
const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];
|
|
396
482
|
return {
|
|
397
|
-
'
|
|
483
|
+
'default-src': unique([SELF]),
|
|
484
|
+
'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),
|
|
398
485
|
'script-src-elem': unique([SELF, nonce, ...scriptHosts]),
|
|
399
486
|
'connect-src': unique([SELF, ...CONNECT_HOSTS]),
|
|
400
487
|
'img-src': unique([SELF, DATA, ...IMG_HOSTS]),
|
|
401
|
-
'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined]),
|
|
488
|
+
'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),
|
|
489
|
+
'font-src': unique([SELF, ...FONT_HOSTS, DATA]),
|
|
402
490
|
};
|
|
403
491
|
}
|
|
404
492
|
function getSiaraShieldCspPolicy(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siarashield_workspace.mjs","sources":["../../../projects/siarashield-workspace/src/lib/siara-shield.globals.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\ntype ScriptStatus = 'idle' | 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n private statusBySrc = new Map<string, ScriptStatus>();\n private pendingBySrc = new Map<string, Promise<void>>();\n\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n const existing = this.document.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n if (existing) return Promise.resolve();\n\n const status = this.statusBySrc.get(src);\n if (status === 'loaded') return Promise.resolve();\n if (status === 'loading') {\n const pending = this.pendingBySrc.get(src);\n if (pending) return pending;\n }\n\n this.statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = this.document.createElement('script');\n script.src = src;\n script.async = true;\n if (options?.nonce) {\n script.nonce = options.nonce;\n }\n script.onload = () => {\n this.statusBySrc.set(src, 'loaded');\n resolve();\n };\n script.onerror = () => {\n this.statusBySrc.set(src, 'error');\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n this.document.head.appendChild(script);\n });\n\n this.pendingBySrc.set(src, pending);\n return pending;\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\r\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\r\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface SiaraShieldInitOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\r\n\r\n@Component({\r\n selector: 'siara-shield',\r\n standalone: true,\r\n template: `<div class=\"SiaraShield\"></div>`,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class SiaraShieldComponent implements AfterViewInit {\n @Input({ required: true }) publicKey!: string;\r\n @Input() loadJQuery = true;\n @Input() cspNonce?: string;\n\r\n /**\r\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\r\n */\r\n @Output() token = new EventEmitter<string>();\r\n\r\n private initialized = false;\r\n\r\n constructor(\n private readonly host: ElementRef<HTMLElement>,\n private readonly loader: SiaraShieldLoaderService,\n ) {}\n\r\n async ngAfterViewInit(): Promise<void> {\r\n await this.init({ publicKey: this.publicKey, loadJQuery: this.loadJQuery, cspNonce: this.cspNonce });\r\n }\r\n\r\n async init(options: SiaraShieldInitOptions): Promise<void> {\r\n if (this.initialized) return;\r\n\r\n // Ensure the host element is in DOM before scripts run.\r\n void this.host.nativeElement;\r\n\r\n if (!options.publicKey) {\r\n throw new Error('SiaraShieldComponent: publicKey is required.');\r\n }\r\n const cspNonce = this.resolveCspNonce(options.cspNonce);\r\n\r\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n this.preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await this.waitForCheckCaptchaApi();\r\n this.initialized = true;\r\n }\r\n\r\n /**\r\n * Detect preloaded jQuery from global object or an existing script tag.\r\n */\r\n private isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n 'script[src*=\"jquery\"]',\r\n );\r\n return Boolean(existingJqueryScript);\r\n }\r\n\r\n /**\r\n * Uses explicit nonce first. If not provided, tries to reuse nonce\r\n * from the first script tag or from `<meta name=\"csp-nonce\">`.\r\n */\r\n private resolveCspNonce(explicitNonce?: string): string | undefined {\n if (explicitNonce) return explicitNonce;\r\n const doc = this.host.nativeElement.ownerDocument;\r\n const scriptWithNonce = doc.querySelector<HTMLScriptElement>('script[nonce]');\r\n if (scriptWithNonce?.nonce) return scriptWithNonce.nonce;\r\n\r\n const nonceMeta = doc.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\r\n return nonceMeta?.content || undefined;\n }\n\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\n );\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n }\n\r\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n }\n\r\n /**\r\n * Calls the global `CheckCaptcha()` from SiaraShield script.\r\n * Returns true when captcha is valid; emits token if available.\r\n */\r\n checkCaptcha(): boolean {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n if (ok && typeof g.CyberSiaraToken === 'string') {\r\n this.token.emit(g.CyberSiaraToken);\r\n }\r\n return ok;\r\n }\r\n\r\n /**\r\n * Async-friendly captcha validation to avoid first-click timing issues.\r\n * Retries briefly until token/check API settles.\r\n */\r\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number }): Promise<boolean> {\r\n const timeoutMs = options?.timeoutMs ?? 2000;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const startedAt = Date.now();\r\n\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\r\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface InitSiaraShieldOptions {\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\n publicKey: string;\n /**\n * Loads jQuery before SiaraShield script.\n * Default is true for easier integration.\n * Set to false only if your site/app already loads jQuery.\n */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\n\r\nlet pending: Promise<void> | null = null;\r\nlet initialized = false;\r\n\r\nfunction loadScript(src: string, options?: { nonce?: string }): Promise<void> {\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n if (existing) return Promise.resolve();\n\n return new Promise<void>((resolve, reject) => {\n const script = document.createElement('script');\n script.src = src;\n script.async = true;\n if (options?.nonce) {\n script.nonce = options.nonce;\n }\n script.onload = () => resolve();\n script.onerror = () =>\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n document.head.appendChild(script);\n });\n}\n\r\nfunction isJQueryAlreadyAvailable(): boolean {\n const g = getSiaraShieldGlobals();\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\n return true;\n }\n\r\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\n return Boolean(existingJqueryScript);\n}\n\nfunction resolveCspNonce(explicitNonce?: string): string | undefined {\n if (explicitNonce) return explicitNonce;\n\n const scriptWithNonce = document.querySelector<HTMLScriptElement>('script[nonce]');\n if (scriptWithNonce?.nonce) return scriptWithNonce.nonce;\n\n const nonceMeta = document.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return nonceMeta?.content || undefined;\n}\n\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n}\n\r\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n if (getSiaraShieldGlobals().CheckCaptcha) {\n return;\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n}\n\r\n/**\r\n * Drop-in initializer for SiaraShield.\r\n * - Loads required scripts (optionally jQuery)\r\n * - Calls global `initCaptcha(publicKey)`\r\n *\r\n * Requirements in your HTML/template:\r\n * - You must render: `<div class=\"SiaraShield\"></div>`\r\n */\r\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\r\n if (initialized) return;\r\n if (pending) return pending;\r\n\r\n if (!options?.publicKey) {\r\n throw new Error('initSiaraShield: publicKey is required.');\r\n }\r\n\r\n pending = (async () => {\n const cspNonce = resolveCspNonce(options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\n await loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await loadScript(CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await loadScript(VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await waitForCheckCaptchaApi();\r\n initialized = true;\r\n })();\r\n\r\n try {\r\n await pending;\r\n } finally {\r\n // keep `pending` cached for subsequent callers\r\n }\r\n}\r\n\r\n/**\r\n * Calls global `CheckCaptcha()` and returns its boolean result.\r\n * If successful, returns `{ ok: true, token?: string }`.\r\n */\r\nexport function checkSiaraShieldCaptcha(): { ok: boolean; token?: string } {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\r\n return ok ? { ok: true, token } : { ok: false };\r\n}\r\n\r\n/**\r\n * Async-friendly captcha check to handle delayed token population.\r\n */\r\nexport async function checkSiaraShieldCaptchaAsync(options?: {\r\n timeoutMs?: number;\r\n pollIntervalMs?: number;\r\n}): Promise<{ ok: boolean; token?: string }> {\r\n const timeoutMs = options?.timeoutMs ?? 1200;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\r\n if (!firstCheck.ok) return firstCheck;\r\n if (firstCheck.token) return firstCheck;\r\n\r\n const startedAt = Date.now();\r\n // Token can be assigned slightly after successful verification.\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n const token = getSiaraShieldGlobals().CyberSiaraToken;\r\n if (typeof token === 'string' && token.length > 0) {\r\n return { ok: true, token };\r\n }\r\n }\r\n\r\n return { ok: true };\r\n}\r\n\r\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Keep `style-src 'unsafe-inline'` for current vendor markup/styles. */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com'] as const;\nconst IMG_HOSTS = ['https://embed.mycybersiara.com'] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? true;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'script-src': unique([SELF, nonce, ...scriptHosts]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","i1.SiaraShieldLoaderService"],"mappings":";;;;SAagB,qBAAqB,GAAA;AACnC,IAAA,OAAQ,UAAwE;AAClF;AAEM,SAAU,gBAAgB,CAAC,CAAqB,EAAA;AACpD,IAAA,OAAO,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW;AACvC;;MCTa,wBAAwB,CAAA;AAIY,IAAA,QAAA;AAHvC,IAAA,W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,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;QACxD,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IAC5E;AAEA,IAAA,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE;AAC5B,SAAA,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC;AACf;;ACrFA;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"siarashield_workspace.mjs","sources":["../../../projects/siarashield-workspace/src/lib/siara-shield.globals.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-script-utils.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-loader.service.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.component.ts","../../../projects/siarashield-workspace/src/lib/siara-shield.ts","../../../projects/siarashield-workspace/src/lib/siara-shield-csp.ts","../../../projects/siarashield-workspace/src/public-api.ts","../../../projects/siarashield-workspace/src/siarashield_workspace.ts"],"sourcesContent":["export type InitCaptchaFn = (publicKey: string) => void;\nexport type CheckCaptchaFn = () => boolean;\n\nexport interface SiaraShieldGlobals {\n initCaptcha?: InitCaptchaFn;\n InitCaptcha?: InitCaptchaFn;\n CheckCaptcha?: CheckCaptchaFn;\n AppendValidationJS?: () => void;\n CyberSiaraToken?: string;\n jQuery?: unknown;\n $?: unknown;\n}\n\nexport function getSiaraShieldGlobals(): SiaraShieldGlobals {\n return (globalThis as unknown as { [k: string]: unknown }) as SiaraShieldGlobals;\n}\n\nexport function getInitCaptchaFn(g: SiaraShieldGlobals): InitCaptchaFn | undefined {\n return g.initCaptcha ?? g.InitCaptcha;\n}\n","type ScriptStatus = 'loading' | 'loaded' | 'error';\n\nexport interface ScriptLoadOptions {\n nonce?: string;\n}\n\ninterface DynamicScriptNoncePatchState {\n nonceByDocument: WeakMap<Document, string>;\n patched: boolean;\n}\n\nconst SCRIPT_STATUS_BY_DOCUMENT = new WeakMap<Document, Map<string, ScriptStatus>>();\nconst SCRIPT_PENDING_BY_DOCUMENT = new WeakMap<Document, Map<string, Promise<void>>>();\nconst DYNAMIC_SCRIPT_NONCE_STATE_KEY = '__siaraShieldDynamicScriptNonceState__';\n\nfunction getStatusBySrc(documentRef: Document): Map<string, ScriptStatus> {\n let statusBySrc = SCRIPT_STATUS_BY_DOCUMENT.get(documentRef);\n if (!statusBySrc) {\n statusBySrc = new Map<string, ScriptStatus>();\n SCRIPT_STATUS_BY_DOCUMENT.set(documentRef, statusBySrc);\n }\n\n return statusBySrc;\n}\n\nfunction getPendingBySrc(documentRef: Document): Map<string, Promise<void>> {\n let pendingBySrc = SCRIPT_PENDING_BY_DOCUMENT.get(documentRef);\n if (!pendingBySrc) {\n pendingBySrc = new Map<string, Promise<void>>();\n SCRIPT_PENDING_BY_DOCUMENT.set(documentRef, pendingBySrc);\n }\n\n return pendingBySrc;\n}\n\nfunction getDynamicScriptNoncePatchState(): DynamicScriptNoncePatchState {\n const globalState = globalThis as typeof globalThis & {\n [DYNAMIC_SCRIPT_NONCE_STATE_KEY]?: DynamicScriptNoncePatchState;\n };\n\n if (!globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY]) {\n globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY] = {\n nonceByDocument: new WeakMap<Document, string>(),\n patched: false,\n };\n }\n\n return globalState[DYNAMIC_SCRIPT_NONCE_STATE_KEY];\n}\n\nfunction normalizeNonce(nonce?: string | null): string | undefined {\n const trimmed = nonce?.trim();\n return trimmed ? trimmed : undefined;\n}\n\nfunction isScriptElement(node: Node): node is HTMLScriptElement {\n return node instanceof Element && node.tagName.toLowerCase() === 'script';\n}\n\nexport function applyScriptNonce(script: HTMLScriptElement, nonce?: string): void {\n const resolvedNonce = normalizeNonce(nonce);\n if (!resolvedNonce) {\n return;\n }\n\n script.setAttribute('nonce', resolvedNonce);\n script.nonce = resolvedNonce;\n}\n\nfunction applyTrackedNonce(node: Node): void {\n if (!isScriptElement(node)) {\n return;\n }\n\n const documentRef = node.ownerDocument;\n if (!documentRef) {\n return;\n }\n\n const nonce = getDynamicScriptNoncePatchState().nonceByDocument.get(documentRef);\n applyScriptNonce(node, nonce);\n}\n\nfunction patchDynamicScriptInsertion(): void {\n const patchState = getDynamicScriptNoncePatchState();\n if (patchState.patched) {\n return;\n }\n\n const originalAppendChild = Node.prototype.appendChild;\n const originalInsertBefore = Node.prototype.insertBefore;\n const originalReplaceChild = Node.prototype.replaceChild;\n\n Node.prototype.appendChild = function <T extends Node>(node: T): T {\n applyTrackedNonce(node);\n return originalAppendChild.call(this, node) as T;\n };\n\n Node.prototype.insertBefore = function <T extends Node>(node: T, child: Node | null): T {\n applyTrackedNonce(node);\n return originalInsertBefore.call(this, node, child) as T;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(node: Node, child: T): T {\n applyTrackedNonce(node);\n return originalReplaceChild.call(this, node, child) as T;\n };\n\n patchState.patched = true;\n}\n\nexport function resolveCspNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedExplicitNonce = normalizeNonce(explicitNonce);\n if (resolvedExplicitNonce) {\n return resolvedExplicitNonce;\n }\n\n const scriptWithNonce = documentRef.querySelector<HTMLScriptElement>('script[nonce]');\n const nonceFromScript = normalizeNonce(scriptWithNonce?.getAttribute('nonce') ?? scriptWithNonce?.nonce);\n if (nonceFromScript) {\n return nonceFromScript;\n }\n\n const nonceMeta = documentRef.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]');\n return normalizeNonce(nonceMeta?.content);\n}\n\nexport function prepareScriptNonce(documentRef: Document, explicitNonce?: string): string | undefined {\n const resolvedNonce = resolveCspNonce(documentRef, explicitNonce);\n const patchState = getDynamicScriptNoncePatchState();\n\n patchDynamicScriptInsertion();\n\n if (resolvedNonce) {\n patchState.nonceByDocument.set(documentRef, resolvedNonce);\n } else {\n patchState.nonceByDocument.delete(documentRef);\n }\n\n return resolvedNonce;\n}\n\nexport function loadScript(documentRef: Document, src: string, options?: ScriptLoadOptions): Promise<void> {\n const nonce = prepareScriptNonce(documentRef, options?.nonce);\n const statusBySrc = getStatusBySrc(documentRef);\n const pendingBySrc = getPendingBySrc(documentRef);\n const existing = documentRef.querySelector<HTMLScriptElement>(`script[src=\"${src}\"]`);\n\n if (existing) {\n applyScriptNonce(existing, nonce);\n const status = statusBySrc.get(src);\n if (status === 'loaded') {\n return Promise.resolve();\n }\n\n const pending = pendingBySrc.get(src);\n if (pending) {\n return pending;\n }\n\n return Promise.resolve();\n }\n\n statusBySrc.set(src, 'loading');\n\n const pending = new Promise<void>((resolve, reject) => {\n const script = documentRef.createElement('script');\n script.src = src;\n script.async = true;\n applyScriptNonce(script, nonce);\n script.onload = () => {\n statusBySrc.set(src, 'loaded');\n pendingBySrc.delete(src);\n resolve();\n };\n script.onerror = () => {\n statusBySrc.set(src, 'error');\n pendingBySrc.delete(src);\n reject(new Error(`Failed to load script: ${src}. Check CSP allowlist and nonce configuration.`));\n };\n documentRef.head.appendChild(script);\n });\n\n pendingBySrc.set(src, pending);\n return pending;\n}\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\n\nimport { loadScript, type ScriptLoadOptions } from './siara-shield-script-utils';\n\n@Injectable({ providedIn: 'root' })\nexport class SiaraShieldLoaderService {\n constructor(@Inject(DOCUMENT) private readonly document: Document) {}\n\n loadScript(src: string, options?: ScriptLoadOptions): Promise<void> {\n return loadScript(this.document, src, options);\n }\n}\n","import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewEncapsulation } from '@angular/core';\nimport { SiaraShieldLoaderService } from './siara-shield-loader.service';\nimport { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { prepareScriptNonce } from './siara-shield-script-utils';\n\r\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface SiaraShieldInitOptions {\r\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\r\n publicKey: string;\r\n /** Loads jQuery before SiaraShield script. Default is true for easier integration. Set to false only if your page already includes jQuery. */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\r\n\r\n@Component({\r\n selector: 'siara-shield',\r\n standalone: true,\r\n template: `<div class=\"SiaraShield\"></div>`,\r\n encapsulation: ViewEncapsulation.None,\r\n})\r\nexport class SiaraShieldComponent implements AfterViewInit {\n @Input({ required: true }) publicKey!: string;\r\n @Input() loadJQuery = true;\n @Input() cspNonce?: string;\n\r\n /**\r\n * Emits the current `CyberSiaraToken` right after a successful `checkCaptcha()`.\r\n */\r\n @Output() token = new EventEmitter<string>();\r\n\r\n private initialized = false;\r\n\r\n constructor(\n private readonly host: ElementRef<HTMLElement>,\n private readonly loader: SiaraShieldLoaderService,\n ) {}\n\r\n async ngAfterViewInit(): Promise<void> {\r\n await this.init({ publicKey: this.publicKey, loadJQuery: this.loadJQuery, cspNonce: this.cspNonce });\r\n }\r\n\r\n async init(options: SiaraShieldInitOptions): Promise<void> {\r\n if (this.initialized) return;\r\n\r\n // Ensure the host element is in DOM before scripts run.\r\n void this.host.nativeElement;\r\n\r\n if (!options.publicKey) {\n throw new Error('SiaraShieldComponent: publicKey is required.');\n }\n const cspNonce = prepareScriptNonce(this.host.nativeElement.ownerDocument, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !this.isJQueryAlreadyAvailable()) {\n await this.loader.loadScript(JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await this.loader.loadScript(CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await this.loader.loadScript(VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n this.preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await this.waitForCheckCaptchaApi();\r\n this.initialized = true;\r\n }\r\n\r\n /**\r\n * Detect preloaded jQuery from global object or an existing script tag.\r\n */\r\n private isJQueryAlreadyAvailable(): boolean {\r\n const g = getSiaraShieldGlobals();\r\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\r\n return true;\r\n }\r\n\r\n const existingJqueryScript = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\r\n 'script[src*=\"jquery\"]',\r\n );\r\n return Boolean(existingJqueryScript);\r\n }\r\n\r\n private preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = this.host.nativeElement.ownerDocument.querySelector<HTMLScriptElement>(\n `script[src=\"${VALIDATION_SCRIPT_SRC}\"]`,\n );\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n }\n\r\n private async waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\r\n const startedAt = Date.now();\r\n while (Date.now() - startedAt < timeoutMs) {\r\n if (getSiaraShieldGlobals().CheckCaptcha) {\r\n return;\r\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n }\n\r\n /**\r\n * Calls the global `CheckCaptcha()` from SiaraShield script.\r\n * Returns true when captcha is valid; emits token if available.\r\n */\r\n checkCaptcha(): boolean {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did init() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n if (ok && typeof g.CyberSiaraToken === 'string') {\r\n this.token.emit(g.CyberSiaraToken);\r\n }\r\n return ok;\r\n }\r\n\r\n /**\r\n * Async-friendly captcha validation to avoid first-click timing issues.\r\n * Retries briefly until token/check API settles.\r\n */\r\n async checkCaptchaAsync(options?: { timeoutMs?: number; pollIntervalMs?: number }): Promise<boolean> {\r\n const timeoutMs = options?.timeoutMs ?? 2000;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const startedAt = Date.now();\r\n\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n if (this.checkCaptcha()) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n}\r\n\r\n","import { getInitCaptchaFn, getSiaraShieldGlobals } from './siara-shield.globals';\nimport { loadScript, prepareScriptNonce } from './siara-shield-script-utils';\n\nconst JQUERY_FALLBACK_SRC = 'https://embedcdn.mycybersiara.com/capcha-temple/js/jquery.min.js';\nconst CAPTCHA_SCRIPT_SRC = 'https://embedcdn.mycybersiara.com/CaptchaFormate/CaptchaResources.js';\nconst VALIDATION_SCRIPT_SRC = 'https://embed.mycybersiara.com/CaptchaFormate/SiaraShield_Validation.js';\nconst CAPTCHA_READY_TIMEOUT_MS = 8000;\n\r\nexport interface InitSiaraShieldOptions {\n /** SiaraShield public key. Use \"TEST-CYBERSIARA\" for staging/development. */\n publicKey: string;\n /**\n * Loads jQuery before SiaraShield script.\n * Default is true for easier integration.\n * Set to false only if your site/app already loads jQuery.\n */\n loadJQuery?: boolean;\n /** CSP nonce for strict policies (`script-src 'nonce-...'`). Pair with `getSiaraShieldCspPolicy()`. */\n cspNonce?: string;\n}\n\r\nlet pending: Promise<void> | null = null;\nlet initialized = false;\n\nfunction isJQueryAlreadyAvailable(): boolean {\n const g = getSiaraShieldGlobals();\n if (typeof g.jQuery === 'function' || typeof g.$ === 'function') {\n return true;\n }\n\n const existingJqueryScript = document.querySelector<HTMLScriptElement>('script[src*=\"jquery\"]');\n return Boolean(existingJqueryScript);\n}\n\nfunction preventDuplicateValidationBootstrap(g: ReturnType<typeof getSiaraShieldGlobals>): void {\n const originalAppendValidation = g.AppendValidationJS;\n if (typeof originalAppendValidation !== 'function') {\n return;\n }\n\n g.AppendValidationJS = () => {\n const existing = document.querySelector<HTMLScriptElement>(`script[src=\"${VALIDATION_SCRIPT_SRC}\"]`);\n if (existing) {\n return;\n }\n\n originalAppendValidation();\n };\n}\n\r\nasync function waitForCheckCaptchaApi(timeoutMs = CAPTCHA_READY_TIMEOUT_MS): Promise<void> {\n const startedAt = Date.now();\n while (Date.now() - startedAt < timeoutMs) {\n if (getSiaraShieldGlobals().CheckCaptcha) {\n return;\n }\r\n await new Promise((resolve) => setTimeout(resolve, 100));\r\n }\r\n throw new Error('SiaraShield: CheckCaptcha() was not available within timeout. This can happen when CSP blocks the captcha runtime.');\n}\n\r\n/**\r\n * Drop-in initializer for SiaraShield.\r\n * - Loads required scripts (optionally jQuery)\r\n * - Calls global `initCaptcha(publicKey)`\r\n *\r\n * Requirements in your HTML/template:\r\n * - You must render: `<div class=\"SiaraShield\"></div>`\r\n */\r\nexport async function initSiaraShield(options: InitSiaraShieldOptions): Promise<void> {\r\n if (initialized) return;\r\n if (pending) return pending;\r\n\r\n if (!options?.publicKey) {\r\n throw new Error('initSiaraShield: publicKey is required.');\r\n }\n\n pending = (async () => {\n const cspNonce = prepareScriptNonce(document, options.cspNonce);\n\n if ((options.loadJQuery ?? true) && !isJQueryAlreadyAvailable()) {\n await loadScript(document, JQUERY_FALLBACK_SRC, { nonce: cspNonce });\n }\n\n await loadScript(document, CAPTCHA_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n await loadScript(document, VALIDATION_SCRIPT_SRC, {\n nonce: cspNonce,\n });\n\n const g = getSiaraShieldGlobals();\n preventDuplicateValidationBootstrap(g);\n const initCaptchaFn = getInitCaptchaFn(g);\n if (!initCaptchaFn) {\n throw new Error(\n 'SiaraShield: InitCaptcha() is not available after loading scripts. Check whether CSP blocked vendor scripts or inline execution.',\n );\n }\n\r\n initCaptchaFn(options.publicKey);\r\n await waitForCheckCaptchaApi();\r\n initialized = true;\r\n })();\r\n\r\n try {\r\n await pending;\r\n } finally {\r\n // keep `pending` cached for subsequent callers\r\n }\r\n}\r\n\r\n/**\r\n * Calls global `CheckCaptcha()` and returns its boolean result.\r\n * If successful, returns `{ ok: true, token?: string }`.\r\n */\r\nexport function checkSiaraShieldCaptcha(): { ok: boolean; token?: string } {\n const g = getSiaraShieldGlobals();\n if (!g.CheckCaptcha) {\n throw new Error('SiaraShield: CheckCaptcha() is not available. Did initSiaraShield() run, and is CSP allowing the captcha scripts?');\n }\n\r\n const ok = g.CheckCaptcha();\r\n const token = typeof g.CyberSiaraToken === 'string' ? g.CyberSiaraToken : undefined;\r\n return ok ? { ok: true, token } : { ok: false };\r\n}\r\n\r\n/**\r\n * Async-friendly captcha check to handle delayed token population.\r\n */\r\nexport async function checkSiaraShieldCaptchaAsync(options?: {\r\n timeoutMs?: number;\r\n pollIntervalMs?: number;\r\n}): Promise<{ ok: boolean; token?: string }> {\r\n const timeoutMs = options?.timeoutMs ?? 1200;\r\n const pollIntervalMs = options?.pollIntervalMs ?? 120;\r\n const firstCheck = checkSiaraShieldCaptcha(); // one API call only\r\n if (!firstCheck.ok) return firstCheck;\r\n if (firstCheck.token) return firstCheck;\r\n\r\n const startedAt = Date.now();\r\n // Token can be assigned slightly after successful verification.\r\n while (Date.now() - startedAt < timeoutMs) {\r\n await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));\r\n const token = getSiaraShieldGlobals().CyberSiaraToken;\r\n if (typeof token === 'string' && token.length > 0) {\r\n return { ok: true, token };\r\n }\r\n }\r\n\r\n return { ok: true };\r\n}\r\n\r\n","export interface SiaraShieldCspOptions {\n /** Server-generated nonce value without the `'nonce-'` prefix. */\n nonce?: string;\n /** Optional if the customer still loads jQuery from Google's CDN. */\n includeGoogleApis?: boolean;\n /** Keep `'unsafe-inline'` in `script-src` for strict vendor compatibility. */\n includeUnsafeInlineScript?: boolean;\n /** Keep `style-src 'unsafe-inline'` for current vendor markup/styles. */\n includeUnsafeInlineStyle?: boolean;\n}\n\nexport type SiaraShieldCspDirectives = Record<string, string[]>;\n\nconst SELF = \"'self'\";\nconst DATA = 'data:';\nconst UNSAFE_INLINE = \"'unsafe-inline'\";\n\nconst SCRIPT_HOSTS = ['https://embedcdn.mycybersiara.com', 'https://embed.mycybersiara.com'] as const;\nconst OPTIONAL_SCRIPT_HOSTS = ['https://ajax.googleapis.com'] as const;\nconst CONNECT_HOSTS = ['https://embed.mycybersiara.com', 'https://embedcdn.mycybersiara.com'] as const;\nconst STYLE_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://mycybersiara.com',\n 'https://fonts.googleapis.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst FONT_HOSTS = [\n 'https://fonts.gstatic.com',\n 'https://mycybersiara.com',\n 'https://cdnjs.cloudflare.com',\n] as const;\nconst IMG_HOSTS = [\n 'https://embed.mycybersiara.com',\n 'https://embedcdn.mycybersiara.com',\n 'https://mycybersiara.com',\n] as const;\n\nfunction unique(values: Array<string | undefined>): string[] {\n return [...new Set(values.filter((value): value is string => Boolean(value && value.trim())))];\n}\n\nfunction nonceSource(nonce?: string): string | undefined {\n return nonce ? `'nonce-${nonce}'` : undefined;\n}\n\nfunction serializeDirective(name: string, values: string[]): string {\n return values.length > 0 ? `${name} ${values.join(' ')}` : name;\n}\n\nfunction parsePolicy(policy: string): Map<string, string[]> {\n const directives = new Map<string, string[]>();\n\n for (const rawDirective of policy.split(';')) {\n const directive = rawDirective.trim();\n if (!directive) {\n continue;\n }\n\n const parts = directive.split(/\\s+/).filter(Boolean);\n const [name, ...values] = parts;\n if (!name) {\n continue;\n }\n\n directives.set(name, values);\n }\n\n return directives;\n}\n\nexport function getSiaraShieldCspDirectives(options?: SiaraShieldCspOptions): SiaraShieldCspDirectives {\n const includeGoogleApis = options?.includeGoogleApis ?? false;\n const includeUnsafeInlineScript = options?.includeUnsafeInlineScript ?? true;\n const includeUnsafeInlineStyle = options?.includeUnsafeInlineStyle ?? true;\n const nonce = nonceSource(options?.nonce);\n const scriptHosts = includeGoogleApis ? [...SCRIPT_HOSTS, ...OPTIONAL_SCRIPT_HOSTS] : [...SCRIPT_HOSTS];\n\n return {\n 'default-src': unique([SELF]),\n 'script-src': unique([SELF, nonce, ...scriptHosts, includeUnsafeInlineScript ? UNSAFE_INLINE : undefined]),\n 'script-src-elem': unique([SELF, nonce, ...scriptHosts]),\n 'connect-src': unique([SELF, ...CONNECT_HOSTS]),\n 'img-src': unique([SELF, DATA, ...IMG_HOSTS]),\n 'style-src': unique([SELF, includeUnsafeInlineStyle ? UNSAFE_INLINE : undefined, ...STYLE_HOSTS]),\n 'font-src': unique([SELF, ...FONT_HOSTS, DATA]),\n };\n}\n\nexport function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): string {\n return Object.entries(getSiaraShieldCspDirectives(options))\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n\nexport function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string {\n const directives = parsePolicy(existingPolicy);\n const recommended = getSiaraShieldCspDirectives(options);\n\n for (const [name, values] of Object.entries(recommended)) {\n directives.set(name, unique([...(directives.get(name) ?? []), ...values]));\n }\n\n return [...directives.entries()]\n .map(([name, values]) => serializeDirective(name, values))\n .join('; ');\n}\n","/*\n * Public API Surface of siarashield-workspace\n */\n\nexport * from './lib/siarashield-workspace';\nexport * from './lib/siara-shield.component';\nexport * from './lib/siara-shield-loader.service';\nexport * from './lib/siara-shield.globals';\nexport * from './lib/siara-shield';\nexport * from './lib/siara-shield-csp';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["JQUERY_FALLBACK_SRC","CAPTCHA_SCRIPT_SRC","VALIDATION_SCRIPT_SRC","CAPTCHA_READY_TIMEOUT_MS","i1.SiaraShieldLoaderService"],"mappings":";;;;SAagB,qBAAqB,GAAA;AACnC,IAAA,OAAQ,UAAwE;AAClF;AAEM,SAAU,gBAAgB,CAAC,CAAqB,EAAA;AACpD,IAAA,OAAO,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW;AACvC;;ACRA,MAAM,yBAAyB,GAAG,IAAI,OAAO,EAAuC;AACpF,MAAM,0BAA0B,GAAG,IAAI,OAAO,EAAwC;AACtF,MAAM,8BAA8B,GAAG,wCAAwC;AAE/E,SAAS,cAAc,CAAC,WAAqB,EAAA;IAC3C,IAAI,WAAW,GAAG,yBAAyB,CAAC,GAAG,CAAC,WAAW,CAAC;IAC5D,IAAI,CAAC,WAAW,EAAE;AAChB,QAAA,WAAW,GAAG,IAAI,GAAG,EAAwB;AAC7C,QAAA,yBAAyB,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC;IACzD;AAEA,IAAA,OAAO,WAAW;AACpB;AAEA,SAAS,eAAe,CAAC,WAAqB,EAAA;IAC5C,IAAI,YAAY,GAAG,0BAA0B,CAAC,GAAG,CAAC,WAAW,CAAC;IAC9D,IAAI,CAAC,YAAY,EAAE;AACjB,QAAA,YAAY,GAAG,IAAI,GAAG,EAAyB;AAC/C,QAAA,0BAA0B,CAAC,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC;IAC3D;AAEA,IAAA,OAAO,YAAY;AACrB;AAEA,SAAS,+BAA+B,GAAA;IACtC,MAAM,WAAW,GAAG,UAEnB;AAED,IAAA,IAA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,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE;AAC5B,SAAA,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC;SACxD,IAAI,CAAC,IAAI,CAAC;AACf;;ACzGA;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -4,10 +4,9 @@ import { AfterViewInit, EventEmitter, ElementRef } from '@angular/core';
|
|
|
4
4
|
interface ScriptLoadOptions {
|
|
5
5
|
nonce?: string;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
declare class SiaraShieldLoaderService {
|
|
8
9
|
private readonly document;
|
|
9
|
-
private statusBySrc;
|
|
10
|
-
private pendingBySrc;
|
|
11
10
|
constructor(document: Document);
|
|
12
11
|
loadScript(src: string, options?: ScriptLoadOptions): Promise<void>;
|
|
13
12
|
static ɵfac: i0.ɵɵFactoryDeclaration<SiaraShieldLoaderService, never>;
|
|
@@ -40,11 +39,6 @@ declare class SiaraShieldComponent implements AfterViewInit {
|
|
|
40
39
|
* Detect preloaded jQuery from global object or an existing script tag.
|
|
41
40
|
*/
|
|
42
41
|
private isJQueryAlreadyAvailable;
|
|
43
|
-
/**
|
|
44
|
-
* Uses explicit nonce first. If not provided, tries to reuse nonce
|
|
45
|
-
* from the first script tag or from `<meta name="csp-nonce">`.
|
|
46
|
-
*/
|
|
47
|
-
private resolveCspNonce;
|
|
48
42
|
private preventDuplicateValidationBootstrap;
|
|
49
43
|
private waitForCheckCaptchaApi;
|
|
50
44
|
/**
|
|
@@ -123,6 +117,8 @@ interface SiaraShieldCspOptions {
|
|
|
123
117
|
nonce?: string;
|
|
124
118
|
/** Optional if the customer still loads jQuery from Google's CDN. */
|
|
125
119
|
includeGoogleApis?: boolean;
|
|
120
|
+
/** Keep `'unsafe-inline'` in `script-src` for strict vendor compatibility. */
|
|
121
|
+
includeUnsafeInlineScript?: boolean;
|
|
126
122
|
/** Keep `style-src 'unsafe-inline'` for current vendor markup/styles. */
|
|
127
123
|
includeUnsafeInlineStyle?: boolean;
|
|
128
124
|
}
|
|
@@ -132,4 +128,4 @@ declare function getSiaraShieldCspPolicy(options?: SiaraShieldCspOptions): strin
|
|
|
132
128
|
declare function mergeSiaraShieldCspPolicy(existingPolicy: string, options?: SiaraShieldCspOptions): string;
|
|
133
129
|
|
|
134
130
|
export { SiaraShieldComponent, SiaraShieldLoaderService, checkSiaraShieldCaptcha, checkSiaraShieldCaptchaAsync, getInitCaptchaFn, getSiaraShieldCspDirectives, getSiaraShieldCspPolicy, getSiaraShieldGlobals, initSiaraShield, mergeSiaraShieldCspPolicy };
|
|
135
|
-
export type { CheckCaptchaFn, InitCaptchaFn, InitSiaraShieldOptions,
|
|
131
|
+
export type { CheckCaptchaFn, InitCaptchaFn, InitSiaraShieldOptions, SiaraShieldCspDirectives, SiaraShieldCspOptions, SiaraShieldGlobals, SiaraShieldInitOptions };
|