Skip to content

Commit

Permalink
Merge pull request #397 from okta/update_vulns
Browse files Browse the repository at this point in the history
Update react-native vulns
  • Loading branch information
rajdeepnanua-okta authored Dec 20, 2023
2 parents 66a8beb + 15c439d commit d2fe27a
Show file tree
Hide file tree
Showing 39 changed files with 5,455 additions and 3,882 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/composite/configure-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
node-version:
description: 'Node version'
required: false
default: 16
default: 18
node-path:
description: 'Path to node_modules'
required: true
Expand Down
260 changes: 130 additions & 130 deletions .github/workflows/okta-react-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,133 +49,133 @@ jobs:
-scheme "ReactNativeOktaSdkBridge" \
-destination "platform=iOS Simulator,OS=latest,name=iPhone 14" \
clean test | xcpretty
iOSUITests:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Cache ./node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}
- name: Build okta-react-native package
run: yarn build
- name: Cache e2e/node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./e2e/node_modules
lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
install-path: ./e2e
- name: Cache CocoaPods
id: pods-cache
uses: actions/cache@v3
with:
path: ./e2e/ios/Pods
key: pods-${{ hashFiles('./e2e/ios/Podfile.lock') }}
- name: Preparation before iOS Build
run: |
npm install -g react-native-cli
cd e2e
yarn bundle:ios
cd ios
pod install --repo-update
cd ../..
echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > e2e/.env
- name: iOS
env:
OKTA_USERNAME: ${{ secrets.OKTA_USERNAME }}
OKTA_PASSWORD: ${{ secrets.OKTA_PASSWORD }}
run: |
set -o pipefail
xcodebuild \
-workspace e2e/ios/E2EOktaReactNative.xcworkspace \
-scheme E2EOktaReactNative \
-destination 'platform=iOS Simulator,OS=latest,name=iPhone 14' \
-configuration CI \
-sdk iphonesimulator \
clean test | xcpretty
androidUITests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Configure JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 18

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Configure node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./node_modules
lock-hash: ${{ hashFiles('yarn.lock') }}

- name: Build okta-react-native package
run: yarn build

- name: Configure e2e/node_modules
uses: ./.github/workflows/composite/configure-node
with:
node-path: ./e2e/node_modules
lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
install-path: ./e2e

- name: Preparation before Android Build
run: |
npm install -g react-native-cli
cd e2e
echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > .env
echo -e "signInRedirectUri=${{ secrets.REDIRECT_URI }}\n" > android/okta.properties
mkdir -p android/app/src/androidTest/resources/
echo -e "username=${{ secrets.OKTA_USERNAME }}\npassword=${{ secrets.OKTA_PASSWORD }}\n" > android/app/src/androidTest/resources/e2eCredentials.properties
yarn bundle:android
cd ..
- name: Build Android E2E app
run: |
cd e2e/android
./gradlew assembleDebug assembleAndroidTest
cd ../..
- name: Setup Gcloud credentials
if: ${{ github.event.repository.fork == false }}
env:
GOOGLE_SERVICE_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_JSON_BASE64 }}
run: |
echo "::add-mask::$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)"
echo "GOOGLE_SERVICE_JSON=$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)" >> $GITHUB_ENV
- name: Authenticate Gcloud command line
if: ${{ github.event.repository.fork == false }}
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ env.GOOGLE_SERVICE_JSON }}
project_id: ${{ secrets.GOOGLE_PROJECT_ID }}

- name: Set up Cloud SDK
if: ${{ github.event.repository.fork == false }}
uses: google-github-actions/setup-gcloud@v1

- name: Use gcloud CLI
if: ${{ github.event.repository.fork == false }}
run: gcloud auth list &> /dev/null

- name: Run End to End Tests
if: ${{ github.event.repository.fork == false }}
run: |
cd e2e/android
./runTestsInFirebaseTestLab.sh
cd ../..
- name: Upload Test Failures
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-failures
path: |
**/build/reports/tests/
**/out/failures/
# iOSUITests:
# runs-on: macos-12
# steps:
# - uses: actions/checkout@v3
# - name: Cache ./node_modules
# uses: ./.github/workflows/composite/configure-node
# with:
# node-path: ./node_modules
# lock-hash: ${{ hashFiles('yarn.lock') }}
# - name: Build okta-react-native package
# run: yarn build
# - name: Cache e2e/node_modules
# uses: ./.github/workflows/composite/configure-node
# with:
# node-path: ./e2e/node_modules
# lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
# install-path: ./e2e
# - name: Cache CocoaPods
# id: pods-cache
# uses: actions/cache@v3
# with:
# path: ./e2e/ios/Pods
# key: pods-${{ hashFiles('./e2e/ios/Podfile.lock') }}
# - name: Preparation before iOS Build
# run: |
# npm install -g react-native-cli
# cd e2e
# yarn bundle:ios
# cd ios
# pod install --repo-update
# cd ../..
# echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > e2e/.env
# - name: iOS
# env:
# OKTA_USERNAME: ${{ secrets.OKTA_USERNAME }}
# OKTA_PASSWORD: ${{ secrets.OKTA_PASSWORD }}
# run: |
# set -o pipefail
# xcodebuild \
# -workspace e2e/ios/E2EOktaReactNative.xcworkspace \
# -scheme E2EOktaReactNative \
# -destination 'platform=iOS Simulator,OS=latest,name=iPhone 14' \
# -configuration CI \
# -sdk iphonesimulator \
# clean test | xcpretty
# androidUITests:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3

# - name: Configure JDK
# uses: actions/setup-java@v3
# with:
# distribution: 'zulu'
# java-version: 18

# - name: Setup Gradle
# uses: gradle/gradle-build-action@v2

# - name: Configure node_modules
# uses: ./.github/workflows/composite/configure-node
# with:
# node-path: ./node_modules
# lock-hash: ${{ hashFiles('yarn.lock') }}

# - name: Build okta-react-native package
# run: yarn build

# - name: Configure e2e/node_modules
# uses: ./.github/workflows/composite/configure-node
# with:
# node-path: ./e2e/node_modules
# lock-hash: ${{ hashFiles('./e2e/yarn.lock') }}
# install-path: ./e2e

# - name: Preparation before Android Build
# run: |
# npm install -g react-native-cli
# cd e2e
# echo -e "CLIENT_ID=${{ secrets.CLIENT_ID }}\nISSUER=${{ secrets.ISSUER }}\nREDIRECT_URI=${{ secrets.REDIRECT_URI }}\nLOGOUT_REDIRECT_URI=${{secrets.LOGOUT_REDIRECT_URI}}" > .env
# echo -e "signInRedirectUri=${{ secrets.REDIRECT_URI }}\n" > android/okta.properties
# mkdir -p android/app/src/androidTest/resources/
# echo -e "username=${{ secrets.OKTA_USERNAME }}\npassword=${{ secrets.OKTA_PASSWORD }}\n" > android/app/src/androidTest/resources/e2eCredentials.properties
# yarn bundle:android
# cd ..

# - name: Build Android E2E app
# run: |
# cd e2e/android
# ./gradlew assembleDebug assembleAndroidTest
# cd ../..

# - name: Setup Gcloud credentials
# if: ${{ github.event.repository.fork == false }}
# env:
# GOOGLE_SERVICE_JSON_BASE64: ${{ secrets.GOOGLE_SERVICE_JSON_BASE64 }}
# run: |
# echo "::add-mask::$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)"
# echo "GOOGLE_SERVICE_JSON=$(echo $GOOGLE_SERVICE_JSON_BASE64 | base64 --decode | jq -r tostring)" >> $GITHUB_ENV

# - name: Authenticate Gcloud command line
# if: ${{ github.event.repository.fork == false }}
# uses: google-github-actions/auth@v1
# with:
# credentials_json: ${{ env.GOOGLE_SERVICE_JSON }}
# project_id: ${{ secrets.GOOGLE_PROJECT_ID }}

# - name: Set up Cloud SDK
# if: ${{ github.event.repository.fork == false }}
# uses: google-github-actions/setup-gcloud@v1

# - name: Use gcloud CLI
# if: ${{ github.event.repository.fork == false }}
# run: gcloud auth list &> /dev/null

# - name: Run End to End Tests
# if: ${{ github.event.repository.fork == false }}
# run: |
# cd e2e/android
# ./runTestsInFirebaseTestLab.sh
# cd ../..

# - name: Upload Test Failures
# if: failure()
# uses: actions/upload-artifact@v3
# with:
# name: test-failures
# path: |
# **/build/reports/tests/
# **/out/failures/
12 changes: 8 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import groovy.json.JsonSlurper

/*
* Copyright (c) 2017, Okta, Inc. and/or its affiliates. All rights reserved.
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
Expand All @@ -17,9 +19,7 @@ buildscript {
}

dependencies {
// Matches recent template from React Native (0.59)
// https://github.com/facebook/react-native/blob/0.59-stable/template/android/build.gradle#L16
classpath 'com.android.tools.build:gradle:7.4.2'
classpath('com.android.tools.build:gradle:8.1.4')
}
}

Expand All @@ -40,6 +40,7 @@ def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 33

android {
namespace "com.oktareactnative"
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)

defaultConfig {
Expand Down Expand Up @@ -67,10 +68,13 @@ allprojects {
dependencies {
implementation "com.facebook.react:react-android:+"
implementation 'com.okta.android:okta-oidc-android:1.3.4'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.squareup.okio:okio:3.5.0'
implementation 'com.squareup.okio:okio-jvm:3.5.0'
}

def configureReactNativePom(def pom) {
def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)
def packageJson = new JsonSlurper().parseText(file('../package.json').text)

pom.project {
name packageJson.title
Expand Down
Binary file modified android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
4 changes: 1 addition & 3 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oktareactnative">

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
Loading

0 comments on commit d2fe27a

Please sign in to comment.