1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-10 05:13:17 +00:00

Compare commits

...

12 Commits

Author SHA1 Message Date
Thomas Rittson
acc3473731 Use injectable services 2022-03-28 13:07:56 +10:00
Thomas Rittson
c80805ded6 Basic changes to build 2022-03-28 09:21:20 +10:00
Thomas Rittson
c75d26b618 Update to use new JslibModule (#254) 2022-03-21 23:08:12 +01:00
Joseph Flinn
13a13dd18f Adding a manual trigger to the build pipeline in the directory-connector project (#256) 2022-03-21 15:05:12 -07:00
Vince Grassia
954b23d91f Fix Node caching error (#255) 2022-03-21 14:57:44 -07:00
Micaiah Martin
b9d35c3dc7 Updated actions & applied linting (#253) 2022-03-17 12:27:57 -04:00
github-actions[bot]
536f48b3c7 Bump version to 2.10.0 (#252)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-03-16 10:51:01 -06:00
Vince Grassia
8cd768c7c2 Add Node caching (#251) 2022-03-16 11:18:37 -04:00
Chad Scharf
b233d2e87d Update SECURITY.md (#250)
* Update SECURITY.md

Add link to our HackerOne program for submitting potential security issues.

* Revise language on SECURITY.md
2022-03-15 20:53:33 +01:00
Thomas Rittson
1f6d8c1458 Update jslib (#248) 2022-03-15 15:15:27 +10:00
Joseph Flinn
ae05183aa3 Update hotfix release branch name to hotfix-rc (#247) 2022-03-09 12:46:27 -08:00
Robyn MacCallum
8374103a15 Move delta tokens out of secure storage (#246) 2022-03-09 07:51:27 -05:00
13 changed files with 198 additions and 231 deletions

View File

@@ -7,6 +7,7 @@ on:
- 'l10n_master' - 'l10n_master'
paths-ignore: paths-ignore:
- '.github/workflows/**' - '.github/workflows/**'
workflow_dispatch: {}
jobs: jobs:
@@ -15,7 +16,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up CLOC - name: Set up CLOC
run: | run: |
@@ -33,7 +34,7 @@ jobs:
package_version: ${{ steps.retrieve-version.outputs.package_version }} package_version: ${{ steps.retrieve-version.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Get Package Version - name: Get Package Version
id: retrieve-version id: retrieve-version
@@ -52,11 +53,13 @@ jobs:
_PKG_FETCH_VERSION: 3.2 _PKG_FETCH_VERSION: 3.2
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -91,12 +94,10 @@ jobs:
run: npm run dist:cli:lin run: npm run dist:cli:lin
- name: Zip - name: Zip
run: | run: zip -j ./dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip ./dist-cli/linux/bwdc ./keytar/linux/build/Release/keytar.node
zip -j ./dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip ./dist-cli/linux/bwdc ./keytar/linux/build/Release/keytar.node
- name: Create checksums - name: Create checksums
run: | run: sha256sum ./dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip | cut -d " " -f 1 > ./dist-cli/bwdc-linux-sha256-$_PACKAGE_VERSION.txt
sha256sum ./dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip | cut -d " " -f 1 > ./dist-cli/bwdc-linux-sha256-$_PACKAGE_VERSION.txt
- name: Version Test - name: Version Test
run: | run: |
@@ -120,14 +121,14 @@ jobs:
fi fi
- name: Upload Linux Zip to GitHub - name: Upload Linux Zip to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-linux-${{ env._PACKAGE_VERSION }}.zip name: bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
path: ./dist-cli/bwdc-linux-${{ env._PACKAGE_VERSION }}.zip path: ./dist-cli/bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload Linux checksum to GitHub - name: Upload Linux checksum to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
@@ -144,11 +145,13 @@ jobs:
_PKG_FETCH_VERSION: 3.2 _PKG_FETCH_VERSION: 3.2
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -183,12 +186,10 @@ jobs:
run: npm run dist:cli:mac run: npm run dist:cli:mac
- name: Zip - name: Zip
run: | run: zip -j ./dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip ./dist-cli/macos/bwdc ./keytar/macos/build/Release/keytar.node
zip -j ./dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip ./dist-cli/macos/bwdc ./keytar/macos/build/Release/keytar.node
- name: Create checksums - name: Create checksums
run: | run: sha256sum ./dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip | cut -d " " -f 1 > ./dist-cli/bwdc-macos-sha256-$_PACKAGE_VERSION.txt
sha256sum ./dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip | cut -d " " -f 1 > ./dist-cli/bwdc-macos-sha256-$_PACKAGE_VERSION.txt
- name: Version Test - name: Version Test
run: | run: |
@@ -206,14 +207,14 @@ jobs:
fi fi
- name: Upload Mac Zip to GitHub - name: Upload Mac Zip to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-macos-${{ env._PACKAGE_VERSION }}.zip name: bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
path: ./dist-cli/bwdc-macos-${{ env._PACKAGE_VERSION }}.zip path: ./dist-cli/bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload Mac checksum to GitHub - name: Upload Mac checksum to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
@@ -230,7 +231,7 @@ jobs:
_WIN_PKG_VERSION: 3.2 _WIN_PKG_VERSION: 3.2
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Setup Windows builder - name: Setup Windows builder
run: | run: |
@@ -238,8 +239,10 @@ jobs:
choco install reshack --no-progress choco install reshack --no-progress
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -330,8 +333,7 @@ jobs:
- name: Zip - name: Zip
shell: cmd shell: cmd
run: | run: 7z a ./dist-cli/bwdc-windows-%_PACKAGE_VERSION%.zip ./dist-cli/windows/bwdc.exe ./keytar/windows/keytar.node
7z a ./dist-cli/bwdc-windows-%_PACKAGE_VERSION%.zip ./dist-cli/windows/bwdc.exe ./keytar/windows/keytar.node
- name: Version Test - name: Version Test
run: | run: |
@@ -349,14 +351,14 @@ jobs:
-t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:_PACKAGE_VERSION}.txt -t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:_PACKAGE_VERSION}.txt
- name: Upload Windows Zip to GitHub - name: Upload Windows Zip to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-windows-${{ env._PACKAGE_VERSION }}.zip name: bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
path: ./dist-cli/bwdc-windows-${{ env._PACKAGE_VERSION }}.zip path: ./dist-cli/bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload Windows checksum to GitHub - name: Upload Windows checksum to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
@@ -370,14 +372,19 @@ jobs:
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up .NET - name: Set up .NET
uses: actions/setup-dotnet@a71d1eb2c86af85faa8c772c03fb365e377e45ea uses: actions/setup-dotnet@9211491ffb35dd6a6657ca4f45d43dfe6e97c829
with: with:
dotnet-version: "3.1.x" dotnet-version: "3.1.x"
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -398,9 +405,6 @@ jobs:
- name: Install AST - name: Install AST
uses: bitwarden/gh-actions/install-ast@f135c42c8596cb535c5bcb7523c0b2eef89709ac uses: bitwarden/gh-actions/install-ast@f135c42c8596cb535c5bcb7523c0b2eef89709ac
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Install Node dependencies - name: Install Node dependencies
run: npm install run: npm install
@@ -418,28 +422,28 @@ jobs:
SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }} SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }}
- name: Upload Portable Executable to GitHub - name: Upload Portable Executable to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe name: Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
path: ./dist/Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe path: ./dist/Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error if-no-files-found: error
- name: Upload Installer Executable to GitHub - name: Upload Installer Executable to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
if-no-files-found: error if-no-files-found: error
- name: Upload Installer Executable Blockmap to GitHub - name: Upload Installer Executable Blockmap to GitHub
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
if-no-files-found: error if-no-files-found: error
- name: Upload latest auto-update artifact - name: Upload latest auto-update artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: latest.yml name: latest.yml
path: ./dist/latest.yml path: ./dist/latest.yml
@@ -453,9 +457,14 @@ jobs:
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -472,9 +481,6 @@ jobs:
sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev sudo apt-get -y install pkg-config libxss-dev libsecret-1-dev
sudo apt-get -y install rpm sudo apt-get -y install rpm
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: NPM Install - name: NPM Install
run: npm install run: npm install
@@ -485,14 +491,14 @@ jobs:
run: npm run dist:lin run: npm run dist:lin
- name: Upload AppImage - name: Upload AppImage
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
if-no-files-found: error if-no-files-found: error
- name: Upload latest auto-update artifact - name: Upload latest auto-update artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: latest-linux.yml name: latest-linux.yml
path: ./dist/latest-linux.yml path: ./dist/latest-linux.yml
@@ -506,9 +512,14 @@ jobs:
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Set up Node - name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0
with: with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: '16' node-version: '16'
- name: Update NPM - name: Update NPM
@@ -527,9 +538,6 @@ jobs:
echo "GitHub event: $GITHUB_EVENT" echo "GitHub event: $GITHUB_EVENT"
shell: bash shell: bash
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Decrypt secrets - name: Decrypt secrets
env: env:
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }} DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
@@ -596,28 +604,28 @@ jobs:
"Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip" "Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip"
- name: Upload .zip artifact - name: Upload .zip artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
if-no-files-found: error if-no-files-found: error
- name: Upload .dmg artifact - name: Upload .dmg artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
if-no-files-found: error if-no-files-found: error
- name: Upload .dmg Blockmap artifact - name: Upload .dmg Blockmap artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
if-no-files-found: error if-no-files-found: error
- name: Upload latest auto-update artifact - name: Upload latest auto-update artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # v2.2.3 uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
with: with:
name: latest-mac.yml name: latest-mac.yml
path: ./dist/latest-mac.yml path: ./dist/latest-mac.yml
@@ -668,21 +676,21 @@ jobs:
fi fi
- name: Login to Azure - Prod Subscription - name: Login to Azure - Prod Subscription
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
if: failure() if: failure()
with: with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
- name: Retrieve secrets - name: Retrieve secrets
id: retrieve-secrets id: retrieve-secrets
uses: Azure/get-keyvault-secrets@80ccd3fafe5662407cc2e55f202ee34bfff8c403 uses: Azure/get-keyvault-secrets@b5c723b9ac7870c022b8c35befe620b7009b336f
if: failure() if: failure()
with: with:
keyvault: "bitwarden-prod-kv" keyvault: "bitwarden-prod-kv"
secrets: "devops-alerts-slack-webhook-url" secrets: "devops-alerts-slack-webhook-url"
- name: Notify Slack on failure - name: Notify Slack on failure
uses: act10ns/slack@e4e71685b9b239384b0f676a63c32367f59c2522 # v1.2.2 uses: act10ns/slack@da3191ebe2e67f49b46880b4633f5591a96d1d33
if: failure() if: failure()
env: env:
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }} SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}

View File

@@ -22,9 +22,9 @@ jobs:
- name: Branch check - name: Branch check
if: ${{ github.event.inputs.release_type != 'Dry Run' }} if: ${{ github.event.inputs.release_type != 'Dry Run' }}
run: | run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix" ]]; then if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
echo "===================================" echo "==================================="
echo "[!] Can only release from the 'rc' or 'hotfix' branches" echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
echo "===================================" echo "==================================="
exit 1 exit 1
fi fi

View File

@@ -1,39 +1,11 @@
Bitwarden believes that working with security researchers across the globe is crucial to keeping our Bitwarden believes that working with security researchers across the globe is crucial to keeping our users safe. If you believe you've found a security issue in our product or service, we encourage you to please submit a report through our [HackerOne Program](https://hackerone.com/bitwarden/). We welcome working with you to resolve the issue promptly. Thanks in advance!
users safe. If you believe you've found a security issue in our product or service, we encourage you to
notify us. We welcome working with you to resolve the issue promptly. Thanks in advance!
# Disclosure Policy # Disclosure Policy
- Let us know as soon as possible upon discovery of a potential security issue, and we'll make every - Let us know as soon as possible upon discovery of a potential security issue, and we'll make every effort to quickly resolve the issue.
effort to quickly resolve the issue. - Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or a third-party. We may publicly disclose the issue before resolving it, if appropriate.
- Provide us a reasonable amount of time to resolve the issue before any disclosure to the public or a - Make a good faith effort to avoid privacy violations, destruction of data, and interruption or degradation of our service. Only interact with accounts you own or with explicit permission of the account holder.
third-party. We may publicly disclose the issue before resolving it, if appropriate. - If you would like to encrypt your report, please use the PGP key with long ID `0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool).
- Make a good faith effort to avoid privacy violations, destruction of data, and interruption or
degradation of our service. Only interact with accounts you own or with explicit permission of the
account holder.
- If you would like to encrypt your report, please use the PGP key with long ID
`0xDE6887086F892325FEC04CC0D847525B6931381F` (available in the public keyserver pool).
# In-scope
- Security issues in any current release of Bitwarden. This includes the web vault, browser extension,
and mobile apps (iOS and Android). Product downloads are available at https://bitwarden.com. Source
code is available at https://github.com/bitwarden.
# Exclusions
The following bug classes are out-of scope:
- Bugs that are already reported on any of Bitwarden's issue trackers (https://github.com/bitwarden),
or that we already know of. Note that some of our issue tracking is private.
- Issues in an upstream software dependency (ex: Xamarin, ASP.NET) which are already reported to the
upstream maintainer.
- Attacks requiring physical access to a user's device.
- Self-XSS
- Issues related to software or protocols not under Bitwarden's control
- Vulnerabilities in outdated versions of Bitwarden
- Missing security best practices that do not directly lead to a vulnerability
- Issues that do not have any impact on the general public
While researching, we'd like to ask you to refrain from: While researching, we'd like to ask you to refrain from:
@@ -42,4 +14,8 @@ While researching, we'd like to ask you to refrain from:
- Social engineering (including phishing) of Bitwarden staff or contractors - Social engineering (including phishing) of Bitwarden staff or contractors
- Any physical attempts against Bitwarden property or data centers - Any physical attempts against Bitwarden property or data centers
# We want to help you!
If you have something that you feel is close to exploitation, or if you'd like some information regarding the internal API, or generally have any questions regarding the app that would help in your efforts, please email us at https://bitwarden.com/contact and ask for that information. As stated above, Bitwarden wants to help you find issues, and is more than willing to help.
Thank you for helping keep Bitwarden and our users safe! Thank you for helping keep Bitwarden and our users safe!

2
jslib

Submodule jslib updated: 1cbc119ad8...9950fb42a1

View File

@@ -6,19 +6,7 @@ import { FormsModule } from "@angular/forms";
import { BrowserModule } from "@angular/platform-browser"; import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { CalloutComponent } from "jslib-angular/components/callout.component"; import { JslibModule } from "jslib-angular/jslib.module";
import { IconComponent } from "jslib-angular/components/icon.component";
import { BitwardenToastModule } from "jslib-angular/components/toastr.component";
import { A11yTitleDirective } from "jslib-angular/directives/a11y-title.directive";
import { ApiActionDirective } from "jslib-angular/directives/api-action.directive";
import { AutofocusDirective } from "jslib-angular/directives/autofocus.directive";
import { BlurClickDirective } from "jslib-angular/directives/blur-click.directive";
import { BoxRowDirective } from "jslib-angular/directives/box-row.directive";
import { FallbackSrcDirective } from "jslib-angular/directives/fallback-src.directive";
import { StopClickDirective } from "jslib-angular/directives/stop-click.directive";
import { StopPropDirective } from "jslib-angular/directives/stop-prop.directive";
import { I18nPipe } from "jslib-angular/pipes/i18n.pipe";
import { SearchCiphersPipe } from "jslib-angular/pipes/search-ciphers.pipe";
import { ApiKeyComponent } from "./accounts/apiKey.component"; import { ApiKeyComponent } from "./accounts/apiKey.component";
import { EnvironmentComponent } from "./accounts/environment.component"; import { EnvironmentComponent } from "./accounts/environment.component";
@@ -30,38 +18,23 @@ import { MoreComponent } from "./tabs/more.component";
import { SettingsComponent } from "./tabs/settings.component"; import { SettingsComponent } from "./tabs/settings.component";
import { TabsComponent } from "./tabs/tabs.component"; import { TabsComponent } from "./tabs/tabs.component";
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
AppRoutingModule, AppRoutingModule,
BrowserAnimationsModule,
BrowserModule,
FormsModule,
JslibModule,
ServicesModule, ServicesModule,
BitwardenToastModule.forRoot({
maxOpened: 5,
autoDismiss: true,
closeButton: true,
}),
], ],
declarations: [ declarations: [
A11yTitleDirective,
ApiActionDirective,
ApiKeyComponent, ApiKeyComponent,
AppComponent, AppComponent,
AutofocusDirective,
BlurClickDirective,
BoxRowDirective,
CalloutComponent,
DashboardComponent, DashboardComponent,
EnvironmentComponent, EnvironmentComponent,
FallbackSrcDirective,
I18nPipe,
IconComponent,
MoreComponent, MoreComponent,
SearchCiphersPipe,
SettingsComponent, SettingsComponent,
StopClickDirective,
StopPropDirective,
TabsComponent, TabsComponent,
], ],
providers: [], providers: [],

View File

@@ -0,0 +1,5 @@
import { InjectionToken } from "@angular/core";
export const USE_SECURE_STORAGE_FOR_SECRETS = new InjectionToken<boolean>(
"USE_SECURE_STORAGE_FOR_SECRETS"
);

View File

@@ -9,6 +9,12 @@ import { CryptoService as CryptoServiceAbstraction } from "jslib-common/abstract
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "jslib-common/abstractions/cryptoFunction.service"; import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "jslib-common/abstractions/cryptoFunction.service";
import { EnvironmentService as EnvironmentServiceAbstraction } from "jslib-common/abstractions/environment.service"; import { EnvironmentService as EnvironmentServiceAbstraction } from "jslib-common/abstractions/environment.service";
import { I18nService as I18nServiceAbstraction } from "jslib-common/abstractions/i18n.service"; import { I18nService as I18nServiceAbstraction } from "jslib-common/abstractions/i18n.service";
import {
CLIENT_TYPE,
SECURE_STORAGE,
STATE_FACTORY,
WINDOW_TOKEN,
} from "jslib-common/abstractions/injectionTokens";
import { KeyConnectorService as KeyConnectorServiceAbstraction } from "jslib-common/abstractions/keyConnector.service"; import { KeyConnectorService as KeyConnectorServiceAbstraction } from "jslib-common/abstractions/keyConnector.service";
import { LogService as LogServiceAbstraction } from "jslib-common/abstractions/log.service"; import { LogService as LogServiceAbstraction } from "jslib-common/abstractions/log.service";
import { MessagingService as MessagingServiceAbstraction } from "jslib-common/abstractions/messaging.service"; import { MessagingService as MessagingServiceAbstraction } from "jslib-common/abstractions/messaging.service";
@@ -17,6 +23,7 @@ import { StateMigrationService as StateMigrationServiceAbstraction } from "jslib
import { StorageService as StorageServiceAbstraction } from "jslib-common/abstractions/storage.service"; import { StorageService as StorageServiceAbstraction } from "jslib-common/abstractions/storage.service";
import { TokenService as TokenServiceAbstraction } from "jslib-common/abstractions/token.service"; import { TokenService as TokenServiceAbstraction } from "jslib-common/abstractions/token.service";
import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service"; import { TwoFactorService as TwoFactorServiceAbstraction } from "jslib-common/abstractions/twoFactor.service";
import { ClientType } from "jslib-common/enums/clientType";
import { StateFactory } from "jslib-common/factories/stateFactory"; import { StateFactory } from "jslib-common/factories/stateFactory";
import { GlobalState } from "jslib-common/models/domain/globalState"; import { GlobalState } from "jslib-common/models/domain/globalState";
import { ContainerService } from "jslib-common/services/container.service"; import { ContainerService } from "jslib-common/services/container.service";
@@ -39,6 +46,7 @@ import { StateMigrationService } from "../../services/stateMigration.service";
import { SyncService } from "../../services/sync.service"; import { SyncService } from "../../services/sync.service";
import { AuthGuardService } from "./auth-guard.service"; import { AuthGuardService } from "./auth-guard.service";
import { USE_SECURE_STORAGE_FOR_SECRETS } from "./injectionTokens";
import { LaunchGuardService } from "./launch-guard.service"; import { LaunchGuardService } from "./launch-guard.service";
function refreshTokenCallback(injector: Injector) { function refreshTokenCallback(injector: Injector) {
@@ -103,23 +111,18 @@ export function initFactory(
{ {
provide: I18nServiceAbstraction, provide: I18nServiceAbstraction,
useFactory: (window: Window) => new I18nService(window.navigator.language, "./locales"), useFactory: (window: Window) => new I18nService(window.navigator.language, "./locales"),
deps: ["WINDOW"], deps: [WINDOW_TOKEN],
}, },
{ {
provide: MessagingServiceAbstraction, provide: MessagingServiceAbstraction,
useClass: ElectronRendererMessagingService, useClass: ElectronRendererMessagingService,
deps: [BroadcasterServiceAbstraction],
}, },
{ provide: StorageServiceAbstraction, useClass: ElectronRendererStorageService }, { provide: StorageServiceAbstraction, useClass: ElectronRendererStorageService },
{ provide: "SECURE_STORAGE", useClass: ElectronRendererSecureStorageService }, { provide: SECURE_STORAGE, useClass: ElectronRendererSecureStorageService },
{ provide: CLIENT_TYPE, useValue: ClientType.DirectoryConnector },
{ {
provide: PlatformUtilsServiceAbstraction, provide: PlatformUtilsServiceAbstraction,
useFactory: ( useClass: ElectronPlatformUtilsService,
i18nService: I18nServiceAbstraction,
messagingService: MessagingServiceAbstraction,
stateService: StateServiceAbstraction
) => new ElectronPlatformUtilsService(i18nService, messagingService, false, stateService),
deps: [I18nServiceAbstraction, MessagingServiceAbstraction, StateServiceAbstraction],
}, },
{ provide: CryptoFunctionServiceAbstraction, useClass: NodeCryptoFunctionService, deps: [] }, { provide: CryptoFunctionServiceAbstraction, useClass: NodeCryptoFunctionService, deps: [] },
{ {
@@ -154,71 +157,28 @@ export function initFactory(
{ {
provide: AuthServiceAbstraction, provide: AuthServiceAbstraction,
useClass: AuthService, useClass: AuthService,
deps: [
CryptoServiceAbstraction,
ApiServiceAbstraction,
TokenServiceAbstraction,
AppIdServiceAbstraction,
PlatformUtilsServiceAbstraction,
MessagingServiceAbstraction,
LogServiceAbstraction,
KeyConnectorServiceAbstraction,
EnvironmentServiceAbstraction,
StateServiceAbstraction,
TwoFactorServiceAbstraction,
I18nServiceAbstraction,
],
}, },
{ {
provide: SyncService, provide: SyncService,
useClass: SyncService, useClass: SyncService,
deps: [
LogServiceAbstraction,
CryptoFunctionServiceAbstraction,
ApiServiceAbstraction,
MessagingServiceAbstraction,
I18nServiceAbstraction,
EnvironmentServiceAbstraction,
StateServiceAbstraction,
],
}, },
AuthGuardService, AuthGuardService,
LaunchGuardService, LaunchGuardService,
{
provide: STATE_FACTORY,
useFactory: () => new StateFactory(GlobalState, Account),
},
{
provide: USE_SECURE_STORAGE_FOR_SECRETS,
useValue: true,
},
{ {
provide: StateMigrationServiceAbstraction, provide: StateMigrationServiceAbstraction,
useFactory: ( useClass: StateMigrationService,
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction
) =>
new StateMigrationService(
storageService,
secureStorageService,
new StateFactory(GlobalState, Account)
),
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
}, },
{ {
provide: StateServiceAbstraction, provide: StateServiceAbstraction,
useFactory: ( useClass: StateService,
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction,
logService: LogServiceAbstraction,
stateMigrationService: StateMigrationServiceAbstraction
) =>
new StateService(
storageService,
secureStorageService,
logService,
stateMigrationService,
true,
new StateFactory(GlobalState, Account)
),
deps: [
StorageServiceAbstraction,
"SECURE_STORAGE",
LogServiceAbstraction,
StateMigrationServiceAbstraction,
],
}, },
{ {
provide: TwoFactorServiceAbstraction, provide: TwoFactorServiceAbstraction,

View File

@@ -2,7 +2,7 @@
"name": "@bitwarden/directory-connector", "name": "@bitwarden/directory-connector",
"productName": "Bitwarden Directory Connector", "productName": "Bitwarden Directory Connector",
"description": "Sync your user directory to your Bitwarden organization.", "description": "Sync your user directory to your Bitwarden organization.",
"version": "2.9.10", "version": "2.10.0",
"author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)", "author": "Bitwarden Inc. <hello@bitwarden.com> (https://bitwarden.com)",
"homepage": "https://bitwarden.com", "homepage": "https://bitwarden.com",
"license": "GPL-3.0", "license": "GPL-3.0",

View File

@@ -1,3 +1,5 @@
import { Injectable } from "@angular/core";
import { ApiService } from "jslib-common/abstractions/api.service"; import { ApiService } from "jslib-common/abstractions/api.service";
import { AppIdService } from "jslib-common/abstractions/appId.service"; import { AppIdService } from "jslib-common/abstractions/appId.service";
import { CryptoService } from "jslib-common/abstractions/crypto.service"; import { CryptoService } from "jslib-common/abstractions/crypto.service";
@@ -16,6 +18,7 @@ import { AuthService as AuthServiceBase } from "jslib-common/services/auth.servi
import { StateService } from "../abstractions/state.service"; import { StateService } from "../abstractions/state.service";
import { OrganizationLogInStrategy } from "../misc/logInStrategies/organizationLogIn.strategy"; import { OrganizationLogInStrategy } from "../misc/logInStrategies/organizationLogIn.strategy";
@Injectable()
export class AuthService extends AuthServiceBase { export class AuthService extends AuthServiceBase {
constructor( constructor(
cryptoService: CryptoService, cryptoService: CryptoService,

View File

@@ -1,3 +1,6 @@
import { Inject, Injectable } from "@angular/core";
import { SECURE_STORAGE, STATE_FACTORY } from "jslib-common/abstractions/injectionTokens";
import { LogService } from "jslib-common/abstractions/log.service"; import { LogService } from "jslib-common/abstractions/log.service";
import { StateMigrationService } from "jslib-common/abstractions/stateMigration.service"; import { StateMigrationService } from "jslib-common/abstractions/stateMigration.service";
import { StorageService } from "jslib-common/abstractions/storage.service"; import { StorageService } from "jslib-common/abstractions/storage.service";
@@ -7,6 +10,7 @@ import { StorageOptions } from "jslib-common/models/domain/storageOptions";
import { StateService as BaseStateService } from "jslib-common/services/state.service"; import { StateService as BaseStateService } from "jslib-common/services/state.service";
import { StateService as StateServiceAbstraction } from "src/abstractions/state.service"; import { StateService as StateServiceAbstraction } from "src/abstractions/state.service";
import { USE_SECURE_STORAGE_FOR_SECRETS } from "src/app/services/injectionTokens";
import { DirectoryType } from "src/enums/directoryType"; import { DirectoryType } from "src/enums/directoryType";
import { IConfiguration } from "src/models/IConfiguration"; import { IConfiguration } from "src/models/IConfiguration";
import { Account } from "src/models/account"; import { Account } from "src/models/account";
@@ -17,6 +21,7 @@ import { OktaConfiguration } from "src/models/oktaConfiguration";
import { OneLoginConfiguration } from "src/models/oneLoginConfiguration"; import { OneLoginConfiguration } from "src/models/oneLoginConfiguration";
import { SyncConfiguration } from "src/models/syncConfiguration"; import { SyncConfiguration } from "src/models/syncConfiguration";
const SecureStorageKeys = { const SecureStorageKeys = {
ldap: "ldapPassword", ldap: "ldapPassword",
gsuite: "gsuitePrivateKey", gsuite: "gsuitePrivateKey",
@@ -38,17 +43,18 @@ const keys = {
const StoredSecurely = "[STORED SECURELY]"; const StoredSecurely = "[STORED SECURELY]";
@Injectable()
export class StateService export class StateService
extends BaseStateService<GlobalState, Account> extends BaseStateService<GlobalState, Account>
implements StateServiceAbstraction implements StateServiceAbstraction
{ {
constructor( constructor(
protected storageService: StorageService, protected storageService: StorageService,
protected secureStorageService: StorageService, @Inject(SECURE_STORAGE) protected secureStorageService: StorageService,
protected logService: LogService, protected logService: LogService,
protected stateMigrationService: StateMigrationService, protected stateMigrationService: StateMigrationService,
private useSecureStorageForSecrets = true, @Inject(USE_SECURE_STORAGE_FOR_SECRETS) private useSecureStorageForSecrets = true,
protected stateFactory: StateFactory<GlobalState, Account> @Inject(STATE_FACTORY) protected stateFactory: StateFactory<GlobalState, Account>
) { ) {
super(storageService, secureStorageService, logService, stateMigrationService, stateFactory); super(storageService, secureStorageService, logService, stateMigrationService, stateFactory);
} }
@@ -238,50 +244,6 @@ export class StateService
); );
} }
async getUserDelta(options?: StorageOptions): Promise<string> {
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
if (options?.userId == null) {
return null;
}
return await this.secureStorageService.get<string>(
`${options.userId}_${SecureStorageKeys.userDelta}`
);
}
async setUserDelta(value: string, options?: StorageOptions): Promise<void> {
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
if (options?.userId == null) {
return;
}
await this.secureStorageService.save(
`${options.userId}_${SecureStorageKeys.userDelta}`,
value,
options
);
}
async getGroupDelta(options?: StorageOptions): Promise<string> {
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
if (options?.userId == null) {
return null;
}
return await this.secureStorageService.get<string>(
`${options.userId}_${SecureStorageKeys.groupDelta}`
);
}
async setGroupDelta(value: string, options?: StorageOptions): Promise<void> {
options = this.reconcileOptions(options, await this.defaultSecureStorageOptions());
if (options?.userId == null) {
return;
}
await this.secureStorageService.save(
`${options.userId}_${SecureStorageKeys.groupDelta}`,
value,
options
);
}
async getConfiguration(type: DirectoryType): Promise<IConfiguration> { async getConfiguration(type: DirectoryType): Promise<IConfiguration> {
switch (type) { switch (type) {
case DirectoryType.Ldap: case DirectoryType.Ldap:
@@ -514,6 +476,40 @@ export class StateService
await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions)); await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
} }
async getUserDelta(options?: StorageOptions): Promise<string> {
return (
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
)?.directorySettings?.userDelta;
}
async setUserDelta(value: string, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);
account.directorySettings.userDelta = value;
await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);
}
async getGroupDelta(options?: StorageOptions): Promise<string> {
return (
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
)?.directorySettings?.groupDelta;
}
async setGroupDelta(value: string, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);
account.directorySettings.groupDelta = value;
await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultOnDiskOptions())
);
}
async clearSyncSettings(hashToo = false) { async clearSyncSettings(hashToo = false) {
await this.setUserDelta(null); await this.setUserDelta(null);
await this.setGroupDelta(null); await this.setGroupDelta(null);

View File

@@ -1,3 +1,5 @@
import { Injectable } from "@angular/core";
import { StateVersion } from "jslib-common/enums/stateVersion"; import { StateVersion } from "jslib-common/enums/stateVersion";
import { StateMigrationService as BaseStateMigrationService } from "jslib-common/services/stateMigration.service"; import { StateMigrationService as BaseStateMigrationService } from "jslib-common/services/stateMigration.service";
@@ -19,8 +21,6 @@ const SecureStorageKeys: { [key: string]: any } = {
directoryConfigPrefix: "directoryConfig_", directoryConfigPrefix: "directoryConfig_",
sync: "syncConfig", sync: "syncConfig",
directoryType: "directoryType", directoryType: "directoryType",
userDelta: "userDeltaToken",
groupDelta: "groupDeltaToken",
organizationId: "organizationId", organizationId: "organizationId",
}; };
@@ -33,10 +33,17 @@ const Keys: { [key: string]: any } = {
lastSyncHash: "lastSyncHash", lastSyncHash: "lastSyncHash",
syncingDir: "syncingDir", syncingDir: "syncingDir",
syncConfig: "syncConfig", syncConfig: "syncConfig",
userDelta: "userDeltaToken",
groupDelta: "groupDeltaToken",
tempDirectoryConfigs: "tempDirectoryConfigs", tempDirectoryConfigs: "tempDirectoryConfigs",
tempDirectorySettings: "tempDirectorySettings", tempDirectorySettings: "tempDirectorySettings",
}; };
const StateKeys = {
global: "global",
authenticatedAccounts: "authenticatedAccounts",
};
const ClientKeys: { [key: string]: any } = { const ClientKeys: { [key: string]: any } = {
clientIdOld: "clientId", clientIdOld: "clientId",
clientId: "apikey_clientId", clientId: "apikey_clientId",
@@ -44,6 +51,7 @@ const ClientKeys: { [key: string]: any } = {
clientSecret: "apikey_clientSecret", clientSecret: "apikey_clientSecret",
}; };
@Injectable()
export class StateMigrationService extends BaseStateMigrationService { export class StateMigrationService extends BaseStateMigrationService {
async migrate(): Promise<void> { async migrate(): Promise<void> {
let currentStateVersion = await this.getCurrentStateVersion(); let currentStateVersion = await this.getCurrentStateVersion();
@@ -53,6 +61,8 @@ export class StateMigrationService extends BaseStateMigrationService {
await this.migrateClientKeys(); await this.migrateClientKeys();
await this.migrateStateFrom1To2(); await this.migrateStateFrom1To2();
break; break;
case StateVersion.Two:
await this.migrateStateFrom2To3();
} }
currentStateVersion += 1; currentStateVersion += 1;
} }
@@ -116,6 +126,8 @@ export class StateMigrationService extends BaseStateMigrationService {
lastSyncHash: await this.get<string>(Keys.lastSyncHash), lastSyncHash: await this.get<string>(Keys.lastSyncHash),
syncingDir: await this.get<boolean>(Keys.syncingDir), syncingDir: await this.get<boolean>(Keys.syncingDir),
sync: await this.get<SyncConfiguration>(Keys.syncConfig), sync: await this.get<SyncConfiguration>(Keys.syncConfig),
userDelta: await this.get<string>(Keys.userDelta),
groupDelta: await this.get<string>(Keys.groupDelta),
}; };
// (userId == null) = no authed account, stored data temporarily to be applied and cleared on next auth // (userId == null) = no authed account, stored data temporarily to be applied and cleared on next auth
@@ -155,4 +167,34 @@ export class StateMigrationService extends BaseStateMigrationService {
} }
} }
} }
protected async migrateStateFrom2To3(useSecureStorageForSecrets = true): Promise<void> {
if (useSecureStorageForSecrets) {
const authenticatedUserIds = await this.get<string[]>(StateKeys.authenticatedAccounts);
await Promise.all(
authenticatedUserIds.map(async (userId) => {
const account = await this.get<Account>(userId);
// Fix for userDelta and groupDelta being put into secure storage when they should not have
if (await this.secureStorageService.has(`${userId}_${Keys.userDelta}`)) {
account.directorySettings.userDelta = await this.secureStorageService.get(
`${userId}_${Keys.userDelta}`
);
await this.secureStorageService.remove(`${userId}_${Keys.userDelta}`);
}
if (await this.secureStorageService.has(`${userId}_${Keys.groupDelta}`)) {
account.directorySettings.groupDelta = await this.secureStorageService.get(
`${userId}_${Keys.groupDelta}`
);
await this.secureStorageService.remove(`${userId}_${Keys.groupDelta}`);
}
await this.set(userId, account);
})
);
}
const globals = await this.getGlobals();
globals.stateVersion = StateVersion.Three;
await this.set(StateKeys.global, globals);
}
} }

View File

@@ -1,3 +1,5 @@
import { Injectable } from "@angular/core";
import { ApiService } from "jslib-common/abstractions/api.service"; import { ApiService } from "jslib-common/abstractions/api.service";
import { CryptoFunctionService } from "jslib-common/abstractions/cryptoFunction.service"; import { CryptoFunctionService } from "jslib-common/abstractions/cryptoFunction.service";
import { EnvironmentService } from "jslib-common/abstractions/environment.service"; import { EnvironmentService } from "jslib-common/abstractions/environment.service";
@@ -20,6 +22,7 @@ import { LdapDirectoryService } from "./ldap-directory.service";
import { OktaDirectoryService } from "./okta-directory.service"; import { OktaDirectoryService } from "./okta-directory.service";
import { OneLoginDirectoryService } from "./onelogin-directory.service"; import { OneLoginDirectoryService } from "./onelogin-directory.service";
@Injectable()
export class SyncService { export class SyncService {
private dirType: DirectoryType; private dirType: DirectoryType;

View File

@@ -39,6 +39,7 @@ const plugins = [
resourceRegExp: /^encoding$/, resourceRegExp: /^encoding$/,
contextRegExp: /node-fetch/, contextRegExp: /node-fetch/,
}), }),
new webpack.NormalModuleReplacementPlugin(/@angular\/core/, "jslib-node/angular-core.noop"),
]; ];
const config = { const config = {