@trackunit/iris-app-api 0.0.82 → 0.0.84

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 CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.84](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.83...iris-app-api/0.0.84) (2023-04-11)
6
+
7
+ ## [0.0.83](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.82...iris-app-api/0.0.83) (2023-04-11)
8
+
5
9
  ## [0.0.82](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.81...iris-app-api/0.0.82) (2023-04-10)
6
10
 
7
11
  ## [0.0.81](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.80...iris-app-api/0.0.81) (2023-03-30)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-api",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "main": "./src/index.js",
@@ -15,6 +15,8 @@ export type CspDirectives = {
15
15
  * This function is used to generate the CSP input for the Iris Apps Csp Header
16
16
  *
17
17
  * @param validDomains input valid domains to add to the CSP header
18
+ * @param frameAncestors input frame ancestors to add to the CSP header
19
+ * @param extraScriptSrc input extra script src to add to the CSP header
18
20
  * @returns { CspDirectives } the CSP input for the Iris Apps Csp Header
19
21
  */
20
- export declare const irisAppCspInput: (validDomains: string[]) => CspDirectives;
22
+ export declare const irisAppCspInput: (validDomains: string[], frameAncestors?: string[], extraScriptSrc?: string) => CspDirectives;
@@ -17,10 +17,12 @@ const BrandedUrls = [
17
17
  * This function is used to generate the CSP input for the Iris Apps Csp Header
18
18
  *
19
19
  * @param validDomains input valid domains to add to the CSP header
20
+ * @param frameAncestors input frame ancestors to add to the CSP header
21
+ * @param extraScriptSrc input extra script src to add to the CSP header
20
22
  * @returns { CspDirectives } the CSP input for the Iris Apps Csp Header
21
23
  */
22
- const irisAppCspInput = (validDomains) => {
23
- return {
24
+ const irisAppCspInput = (validDomains, frameAncestors, extraScriptSrc) => {
25
+ const cspInput = {
24
26
  directives: {
25
27
  "default-src": ["'self'", ...validDomains],
26
28
  "script-src": ["'self'", ...validDomains],
@@ -37,6 +39,13 @@ const irisAppCspInput = (validDomains) => {
37
39
  },
38
40
  reportUri: "https://o343335.ingest.sentry.io/api/1888181/security/?sentry_key=62900a1fa49748d8ba12f4ffbdbd8e07",
39
41
  };
42
+ if (extraScriptSrc) {
43
+ cspInput.directives["script-src"].push(extraScriptSrc);
44
+ }
45
+ if (frameAncestors && frameAncestors.length > 0) {
46
+ cspInput.directives["frame-ancestors"] = frameAncestors;
47
+ }
48
+ return cspInput;
40
49
  };
41
50
  exports.irisAppCspInput = irisAppCspInput;
42
51
  //# sourceMappingURL=irisAppCspInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"irisAppCspInput.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/irisAppCspInput.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG;IAClB,yBAAyB;IACzB,4BAA4B;IAC5B,uBAAuB;IACvB,gCAAgC;IAChC,uBAAuB;IACvB,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,sBAAsB;CACvB,CAAC;AAgBF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAAC,YAAsB,EAAiB,EAAE;IACvE,OAAO;QACL,UAAU,EAAE;YACV,aAAa,EAAE,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC;YAC1C,YAAY,EAAE,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC;YACzC,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;YAClD,WAAW,EAAE,CAAC,iBAAiB,EAAE,8BAA8B,CAAC;YAChE,aAAa,EAAE;gBACb,QAAQ;gBACR,qBAAqB;gBACrB,mBAAmB;gBACnB,uBAAuB;gBACvB,GAAG,WAAW;gBACd,GAAG,YAAY;aAChB;SACF;QACD,SAAS,EAAE,oGAAoG;KAChH,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,eAAe,mBAkB1B","sourcesContent":["const BrandedUrls = [\n \"https://*.trackunit.com\",\n \"https://*.wackerneuson.com\",\n \"https://*.manitou.com\",\n \"https://*.niftylinkmanager.com\",\n \"https://*.skyjack.com\",\n \"https://*.ahernaccess.com\",\n \"https://*.magnith.com\",\n \"https://*.terberg.com\",\n \"https://*.mymecalac.com\",\n \"https://*.delille.be\",\n];\n\n/**\n * This type is used to generate the CSP input for the Iris Apps Csp Header\n */\nexport type CspDirectives = {\n directives: {\n \"default-src\": string[];\n \"script-src\": string[];\n \"worker-src\": string[];\n \"style-src\": string[];\n \"connect-src\": string[];\n };\n reportUri?: string;\n};\n\n/**\n * This function is used to generate the CSP input for the Iris Apps Csp Header\n *\n * @param validDomains input valid domains to add to the CSP header\n * @returns { CspDirectives } the CSP input for the Iris Apps Csp Header\n */\nexport const irisAppCspInput = (validDomains: string[]): CspDirectives => {\n return {\n directives: {\n \"default-src\": [\"'self'\", ...validDomains],\n \"script-src\": [\"'self'\", ...validDomains],\n \"worker-src\": [\"'self'\", \"blob:\", ...validDomains],\n \"style-src\": [\"'unsafe-inline'\", \"https://fonts.googleapis.com\"],\n \"connect-src\": [\n \"'self'\",\n \"https://*.sentry.io\",\n \"https://sentry.io\",\n \"http://localhost:3003\",\n ...BrandedUrls,\n ...validDomains,\n ],\n },\n reportUri: \"https://o343335.ingest.sentry.io/api/1888181/security/?sentry_key=62900a1fa49748d8ba12f4ffbdbd8e07\",\n };\n};\n"]}
1
+ {"version":3,"file":"irisAppCspInput.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/irisAppCspInput.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG;IAClB,yBAAyB;IACzB,4BAA4B;IAC5B,uBAAuB;IACvB,gCAAgC;IAChC,uBAAuB;IACvB,2BAA2B;IAC3B,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,sBAAsB;CACvB,CAAC;AAgBF;;;;;;;GAOG;AACI,MAAM,eAAe,GAAG,CAC7B,YAAsB,EACtB,cAAyB,EACzB,cAAuB,EACR,EAAE;IACjB,MAAM,QAAQ,GAAG;QACf,UAAU,EAAE;YACV,aAAa,EAAE,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC;YAC1C,YAAY,EAAE,CAAC,QAAQ,EAAE,GAAG,YAAY,CAAC;YACzC,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;YAClD,WAAW,EAAE,CAAC,iBAAiB,EAAE,8BAA8B,CAAC;YAEhE,aAAa,EAAE;gBACb,QAAQ;gBACR,qBAAqB;gBACrB,mBAAmB;gBACnB,uBAAuB;gBACvB,GAAG,WAAW;gBACd,GAAG,YAAY;aAChB;SACF;QACD,SAAS,EAAE,oGAAoG;KAChH,CAAC;IACF,IAAI,cAAc,EAAE;QAClB,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;KACxD;IACD,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/C,QAAQ,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,cAAc,CAAC;KACzD;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AA9BW,QAAA,eAAe,mBA8B1B","sourcesContent":["const BrandedUrls = [\n \"https://*.trackunit.com\",\n \"https://*.wackerneuson.com\",\n \"https://*.manitou.com\",\n \"https://*.niftylinkmanager.com\",\n \"https://*.skyjack.com\",\n \"https://*.ahernaccess.com\",\n \"https://*.magnith.com\",\n \"https://*.terberg.com\",\n \"https://*.mymecalac.com\",\n \"https://*.delille.be\",\n];\n\n/**\n * This type is used to generate the CSP input for the Iris Apps Csp Header\n */\nexport type CspDirectives = {\n directives: {\n \"default-src\": string[];\n \"script-src\": string[];\n \"worker-src\": string[];\n \"style-src\": string[];\n \"connect-src\": string[];\n };\n reportUri?: string;\n};\n\n/**\n * This function is used to generate the CSP input for the Iris Apps Csp Header\n *\n * @param validDomains input valid domains to add to the CSP header\n * @param frameAncestors input frame ancestors to add to the CSP header\n * @param extraScriptSrc input extra script src to add to the CSP header\n * @returns { CspDirectives } the CSP input for the Iris Apps Csp Header\n */\nexport const irisAppCspInput = (\n validDomains: string[],\n frameAncestors?: string[],\n extraScriptSrc?: string\n): CspDirectives => {\n const cspInput = {\n directives: {\n \"default-src\": [\"'self'\", ...validDomains],\n \"script-src\": [\"'self'\", ...validDomains],\n \"worker-src\": [\"'self'\", \"blob:\", ...validDomains],\n \"style-src\": [\"'unsafe-inline'\", \"https://fonts.googleapis.com\"],\n\n \"connect-src\": [\n \"'self'\",\n \"https://*.sentry.io\",\n \"https://sentry.io\",\n \"http://localhost:3003\",\n ...BrandedUrls,\n ...validDomains,\n ],\n },\n reportUri: \"https://o343335.ingest.sentry.io/api/1888181/security/?sentry_key=62900a1fa49748d8ba12f4ffbdbd8e07\",\n };\n if (extraScriptSrc) {\n cspInput.directives[\"script-src\"].push(extraScriptSrc);\n }\n if (frameAncestors && frameAncestors.length > 0) {\n cspInput.directives[\"frame-ancestors\"] = frameAncestors;\n }\n return cspInput;\n};\n"]}