freerasp-react-native 3.7.0 → 3.7.2

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
@@ -1,3 +1,14 @@
1
+ # freeRASP 3.7.2
2
+
3
+ - ⚡ Update expo config plugin to fix release build issue in RN 0.73
4
+
5
+ # freeRASP 3.7.1
6
+
7
+ ### Android
8
+
9
+ - ⚡ Updated freeRASP SDK artifact hosting ensuring better stability and availibility
10
+ - ⚡ Fixed compatibility issues with RN < 0.63
11
+
1
12
  # freeRASP 3.7.0
2
13
 
3
14
  - ⚡ Added support for apps built with Expo SDK
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  ![FreeRasp](https://raw.githubusercontent.com/talsec/Free-RASP-Community/master/visuals/freeRASPforRN.png)
2
2
 
3
- ![GitHub Repo stars](https://img.shields.io/github/stars/talsec/Free-RASP-Community?color=green) ![GitHub](https://img.shields.io/github/license/talsec/Free-RASP-Community) ![GitHub](https://img.shields.io/github/last-commit/talsec/Free-RASP-Community) ![Publisher](https://img.shields.io/pub/publisher/freerasp) [![42matters](https://42matters.com/badges/sdk-installations/freerasp)](https://42matters.com/sdks/android/freerasp)
3
+ ![GitHub Repo stars](https://img.shields.io/github/stars/talsec/Free-RASP-Community?color=green) ![GitHub](https://img.shields.io/github/license/talsec/Free-RASP-Community) ![GitHub](https://img.shields.io/github/last-commit/talsec/Free-RASP-Community) ![Publisher](https://img.shields.io/pub/publisher/freerasp) [![42matters](https://42matters.com/badges/sdk-installations/talsec)](https://42matters.com/sdks/android/talsec)
4
+
5
+ [<img src="https://assets.42matters.com/badges/2024/04/rising-star.svg?m=04" width="100"/>](https://42matters.com/sdks/android/talsec)
4
6
 
5
7
  # freeRASP for React Native
6
8
 
@@ -322,14 +324,16 @@ If you encounter any other issues, you can see the list of solved issues [here](
322
324
  freeRASP for React Native is bare React Native plugin. When installing freeRASP into a project that uses Expo SDK, there may be extra configuration needed. We provide plugin config that sets the dependencies automatically. It is recommended to use the plugin config. However, manual setup is also possible.
323
325
 
324
326
  ## Plugin config setup
325
- Add the plugin config into your `app.json` and specify the `minSdkVersion` (use at least 23):
327
+ Add the plugin config into your `app.json` and specify the `minSdkVersion` (use at least 23).
328
+ Additionally, if you are using Expo 50, increase version of R8 above 8.2 with the `R8Version` property [(to support sealed classes on Android)](https://github.com/talsec/Free-RASP-ReactNative/issues/60).
326
329
  ```json
327
330
  "plugins": [
328
331
  [
329
332
  "freerasp-react-native/app.plugin.js",
330
333
  {
331
334
  "android": {
332
- "minSdkVersion": "23"
335
+ "minSdkVersion": "23",
336
+ "R8Version": "8.3.37" // optional for Expo 50
333
337
  }
334
338
  }
335
339
  ]
@@ -347,7 +351,7 @@ This can be done in two ways:
347
351
  ### 2. Add maven dependency
348
352
  - open __android/build.gradle__ _(if you don't see the android folder, run `npx expo prebuild -p android` in terminal to create it)_
349
353
  - add following dependency under __allprojects > repositories__:
350
- `maven { url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp" }`
354
+ `maven { url "https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp" }`
351
355
  - if not already configured, add also
352
356
  `maven { url 'https://www.jitpack.io' }`
353
357
 
@@ -403,6 +407,15 @@ Go to `<your_project>/node_modules/freerasp-react-native/ios/TalsecRuntime.xcfra
403
407
  #define TALSECRUNTIME_SWIFT_H
404
408
  ```
405
409
 
410
+ ### Execution failed for task ':freerasp-react-native:minifyReleaseWithR8'.
411
+ `Sealed classes are not supported as program classes when generating class files.`
412
+
413
+ **Reason:**
414
+ Kotlin sealed classes are not supported in AGP 8.1 used by some versions of RN (currently 0.73.x)
415
+
416
+ **Solution:**
417
+ Follow [this comment on Google Issue Tracker](https://issuetracker.google.com/issues/227160052#comment37), which contains also additional information about the issue.
418
+
406
419
  # Security Report
407
420
 
408
421
  The Security Report is a weekly summary describing the application's security state and characteristics of the devices it runs on in a practical and easy-to-understand way.
@@ -72,7 +72,7 @@ repositories {
72
72
 
73
73
  rootProject.allprojects {
74
74
  repositories {
75
- maven{url "https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp"}
75
+ maven{url "https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp"}
76
76
  maven{url "https://jitpack.io"}
77
77
  }
78
78
  }
@@ -86,7 +86,7 @@ dependencies {
86
86
  //noinspection GradleDynamicVersion
87
87
  implementation "com.facebook.react:react-native:$react_native_version"
88
88
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
89
- implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:9.0.2"
89
+ implementation "com.aheaditec.talsec.security:TalsecSecurity-Community-ReactNative:9.1.0"
90
90
  }
91
91
 
92
92
  if (isNewArchitectureEnabled()) {
@@ -91,14 +91,22 @@ class FreeraspReactNativeModule(val reactContext: ReactApplicationContext) :
91
91
  val certificateHashes = mutableListOf<String>()
92
92
  val hashes = androidConfig.getArray("certificateHashes")!!
93
93
  for (i in 0 until hashes.size()) {
94
- certificateHashes.add(hashes.getString(i))
94
+ // in RN versions < 0.63, getString is nullable
95
+ @Suppress("UNNECESSARY_SAFE_CALL")
96
+ hashes.getString(i)?.let {
97
+ certificateHashes.add(it)
98
+ }
95
99
  }
96
100
  val watcherMail = config.getString("watcherMail")
97
101
  val alternativeStores = mutableListOf<String>()
98
102
  if (androidConfig.hasKey("supportedAlternativeStores")) {
99
103
  val stores = androidConfig.getArray("supportedAlternativeStores")!!
100
104
  for (i in 0 until stores.size()) {
101
- alternativeStores.add(stores.getString(i))
105
+ // in RN versions < 0.63, getString is nullable
106
+ @Suppress("UNNECESSARY_SAFE_CALL")
107
+ stores.getString(i)?.let {
108
+ alternativeStores.add(it)
109
+ }
102
110
  }
103
111
  }
104
112
  var isProd = true
@@ -1,11 +1,5 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
- import { PluginConfigType } from './pluginConfig';
3
- export declare const setBuildscriptDependency: (buildGradle: string) => string;
4
- /**
5
- * Update `<project>/build.gradle` by adding nexus dependency to buildscript
6
- */
7
- export declare const withBuildscriptDependency: ConfigPlugin;
8
- export declare const withAndroidMinSdkVersion: ConfigPlugin<PluginConfigType>;
2
+ import { type PluginConfigType } from './pluginConfig';
9
3
  declare const _default: ConfigPlugin<PluginConfigType>;
10
4
  export default _default;
11
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAQlD,eAAO,MAAM,wBAAwB,gBAAiB,MAAM,WAsB3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,YAcvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,gCASlC,CAAC;;AAgBJ,wBAA2E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAIb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;;AAmHvD,wBAA2E"}
@@ -17,5 +17,6 @@ export interface PluginConfigTypeAndroid {
17
17
  * Override the default `minSdkVersion` version number in **build.gradle**.
18
18
  * */
19
19
  minSdkVersion?: number;
20
+ R8Version?: string;
20
21
  }
21
22
  //# sourceMappingURL=pluginConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pluginConfig.d.ts","sourceRoot":"","sources":["../../../../plugin/src/pluginConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;SAEK;IACL,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
1
+ {"version":3,"file":"pluginConfig.d.ts","sourceRoot":"","sources":["../../../../plugin/src/pluginConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC;;SAEK;IACL,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAQ,mBAAmB,KAAkB,CAAC;AAqC9C,eAAO,MAAM,kBAAkB,mIAiD9B,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,IAExC,CAAC;AAEF,eAAO,MAAM,WAAW,YAAmB,YAAY,KAAG,QAAQ,MAAM,CAEvE,CAAC;AAEF,eAAO,MAAM,WAAW,gDACd,YAAY,qFAkBrB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,yBAAyB,EAC9B,YAAY,EACb,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAQ,mBAAmB,KAAkB,CAAC;AAqC9C,eAAO,MAAM,kBAAkB,gDACrB,CAAC,GAAG,OAAO,QAAQ,MAAM,CAAC,EAAE,MAAM,yBAAyB,CAAC,EAAE,EAAE,CAAC,kBAgD1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAO,IAExC,CAAC;AAEF,eAAO,MAAM,WAAW,YAAmB,YAAY,KAAG,QAAQ,MAAM,CAEvE,CAAC;AAEF,eAAO,MAAM,WAAW,gDACd,YAAY,WACX,CAAC,GAAG,OAAO,QAAQ,MAAM,CAAC,EAAE,MAAM,yBAAyB,CAAC,EAAE,EAAE,CAAC,SAiB3E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "freerasp-react-native",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "React Native plugin for improving app security and threat monitoring on Android and iOS mobile devices.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -10,13 +10,11 @@
10
10
  "scripts": {
11
11
  "typecheck": "tsc --noEmit",
12
12
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
13
- "prepack": "bob build",
14
13
  "release": "release-it",
15
14
  "example": "yarn --cwd example",
16
15
  "bootstrap": "yarn example && yarn install && yarn example pods",
17
16
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
18
17
  "build:plugin": "tsc --build plugin"
19
-
20
18
  },
21
19
  "keywords": [
22
20
  "react-native",
@@ -80,7 +78,6 @@
80
78
  "engines": {
81
79
  "node": ">= 16.0.0"
82
80
  },
83
- "packageManager": "^yarn@1.22.15",
84
81
  "jest": {
85
82
  "preset": "react-native",
86
83
  "modulePathIgnorePatterns": [
@@ -1,10 +1,4 @@
1
1
  import { ConfigPlugin } from '@expo/config-plugins';
2
- import { PluginConfigType } from './pluginConfig';
3
- export declare const setBuildscriptDependency: (buildGradle: string) => string;
4
- /**
5
- * Update `<project>/build.gradle` by adding nexus dependency to buildscript
6
- */
7
- export declare const withBuildscriptDependency: ConfigPlugin;
8
- export declare const withAndroidMinSdkVersion: ConfigPlugin<PluginConfigType>;
2
+ import { type PluginConfigType } from './pluginConfig';
9
3
  declare const _default: ConfigPlugin<PluginConfigType>;
10
4
  export default _default;
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withAndroidMinSdkVersion = exports.withBuildscriptDependency = exports.setBuildscriptDependency = void 0;
4
3
  const config_plugins_1 = require("@expo/config-plugins");
5
4
  const { createBuildGradlePropsConfigPlugin } = config_plugins_1.AndroidConfig.BuildProperties;
6
- const urlNexus = 'https://nexus3-public.monetplus.cz/repository/ahead-talsec-free-rasp';
5
+ const urlFreerasp = 'https://europe-west3-maven.pkg.dev/talsec-artifact-repository/freerasp';
7
6
  const urlJitpack = 'https://www.jitpack.io';
8
7
  const setBuildscriptDependency = (buildGradle) => {
9
8
  // This enables users in bare workflow to comment out the line to prevent freerasp from adding it back.
10
- const mavenNexus = buildGradle.includes(urlNexus)
9
+ const mavenFreerasp = buildGradle.includes(urlFreerasp)
11
10
  ? ''
12
- : `maven { url "${urlNexus}" }`;
13
- const mavenJitpack = buildGradle.includes(urlNexus)
11
+ : `maven { url "${urlFreerasp}" }`;
12
+ const mavenJitpack = buildGradle.includes(urlJitpack)
14
13
  ? ''
15
14
  : `maven { url "${urlJitpack}" }`;
16
15
  // It's ok to have multiple allprojects.repositories, so we create a new one since it's cheaper than tokenizing
@@ -18,21 +17,30 @@ const setBuildscriptDependency = (buildGradle) => {
18
17
  const combinedGradleMaven = `
19
18
  allprojects {
20
19
  repositories {
21
- ${mavenNexus}
20
+ ${mavenFreerasp}
22
21
  ${mavenJitpack}
23
22
  }
24
23
  }
25
24
  `;
26
25
  return buildGradle + `\n${combinedGradleMaven}\n`;
27
26
  };
28
- exports.setBuildscriptDependency = setBuildscriptDependency;
27
+ const setAndroidR8 = (buildGradle, version) => {
28
+ const combinedGradleMaven = `
29
+ buildscript {
30
+ dependencies {
31
+ classpath("com.android.tools:r8:${version}")
32
+ }
33
+ }
34
+ `;
35
+ return buildGradle + `\n${combinedGradleMaven}\n`;
36
+ };
29
37
  /**
30
38
  * Update `<project>/build.gradle` by adding nexus dependency to buildscript
31
39
  */
32
- const withBuildscriptDependency = (config) => {
33
- return (0, config_plugins_1.withProjectBuildGradle)(config, (config) => {
40
+ const withBuildscriptDependency = (expoConfig) => {
41
+ return (0, config_plugins_1.withProjectBuildGradle)(expoConfig, (config) => {
34
42
  if (config.modResults.language === 'groovy') {
35
- config.modResults.contents = (0, exports.setBuildscriptDependency)(config.modResults.contents);
43
+ config.modResults.contents = setBuildscriptDependency(config.modResults.contents);
36
44
  }
37
45
  else {
38
46
  config_plugins_1.WarningAggregator.addWarningAndroid('freerasp-react-native', `Cannot automatically configure project build.gradle, because it's not groovy`);
@@ -40,16 +48,33 @@ const withBuildscriptDependency = (config) => {
40
48
  return config;
41
49
  });
42
50
  };
43
- exports.withBuildscriptDependency = withBuildscriptDependency;
44
- exports.withAndroidMinSdkVersion = createBuildGradlePropsConfigPlugin([
51
+ const withAndroidMinSdkVersion = createBuildGradlePropsConfigPlugin([
45
52
  {
46
53
  propName: 'android.minSdkVersion',
47
54
  propValueGetter: (config) => config.android?.minSdkVersion?.toString(),
48
55
  },
49
56
  ], 'withAndroidMinSdkVersion');
57
+ /**
58
+ * Update `<project>/build.gradle` by updating the R8 version
59
+ */
60
+ const withAndroidR8Version = (expoConfig, props) => {
61
+ if (!props.android?.R8Version) {
62
+ return expoConfig;
63
+ }
64
+ return (0, config_plugins_1.withProjectBuildGradle)(expoConfig, (config) => {
65
+ if (config.modResults.language === 'groovy') {
66
+ config.modResults.contents = setAndroidR8(config.modResults.contents, props.android?.R8Version ?? '+');
67
+ }
68
+ else {
69
+ config_plugins_1.WarningAggregator.addWarningAndroid('freerasp-react-native', `Cannot automatically configure project build.gradle, because it's not groovy`);
70
+ }
71
+ return config;
72
+ });
73
+ };
50
74
  const withRnTalsecApp = (config, props) => {
51
- config = (0, exports.withBuildscriptDependency)(config);
52
- config = (0, exports.withAndroidMinSdkVersion)(config, props);
75
+ config = withBuildscriptDependency(config);
76
+ config = withAndroidMinSdkVersion(config, props);
77
+ config = withAndroidR8Version(config, props);
53
78
  return config;
54
79
  };
55
80
  let pkg = {
@@ -17,4 +17,5 @@ export interface PluginConfigTypeAndroid {
17
17
  * Override the default `minSdkVersion` version number in **build.gradle**.
18
18
  * */
19
19
  minSdkVersion?: number;
20
+ R8Version?: string;
20
21
  }