1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-05 23:53:21 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Brandon
396b6282ad fix null error 2025-05-14 12:05:01 -04:00
7 changed files with 1255 additions and 1263 deletions

View File

@@ -9,9 +9,6 @@ on:
- "hotfix-rc" - "hotfix-rc"
workflow_dispatch: {} workflow_dispatch: {}
permissions:
contents: read
jobs: jobs:
cloc: cloc:
name: CLOC name: CLOC
@@ -98,6 +95,11 @@ jobs:
- name: Zip - name: Zip
run: zip -j dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip dist-cli/linux/bwdc keytar/linux/build/Release/keytar.node run: zip -j dist-cli/bwdc-linux-$_PACKAGE_VERSION.zip dist-cli/linux/bwdc keytar/linux/build/Release/keytar.node
- name: Create checksums
run: |
shasum -a 256 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: |
sudo apt-get update sudo apt-get update
@@ -127,6 +129,13 @@ jobs:
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
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error
macos-cli: macos-cli:
name: Build Mac CLI name: Build Mac CLI
@@ -181,6 +190,11 @@ jobs:
- name: Zip - name: Zip
run: zip -j dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip dist-cli/macos/bwdc keytar/macos/build/Release/keytar.node run: zip -j dist-cli/bwdc-macos-$_PACKAGE_VERSION.zip dist-cli/macos/bwdc keytar/macos/build/Release/keytar.node
- name: Create checksums
run: |
shasum -a 256 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: |
mkdir -p test/macos mkdir -p test/macos
@@ -203,6 +217,12 @@ jobs:
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
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error
windows-cli: windows-cli:
name: Build Windows CLI name: Build Windows CLI
@@ -329,6 +349,11 @@ jobs:
Throw "Version test failed." Throw "Version test failed."
} }
- name: Create checksums
run: |
checksum -f="./dist-cli/bwdc-windows-${env:_PACKAGE_VERSION}.zip" `
-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@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with: with:
@@ -336,6 +361,13 @@ jobs:
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
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
with:
name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error
windows-gui: windows-gui:
name: Build Windows GUI name: Build Windows GUI

View File

@@ -3,9 +3,6 @@ name: Enforce PR labels
on: on:
pull_request: pull_request:
types: [labeled, unlabeled, opened, edited, synchronize] types: [labeled, unlabeled, opened, edited, synchronize]
permissions:
contents: read
pull-requests: read
jobs: jobs:
enforce-label: enforce-label:
name: EnforceLabel name: EnforceLabel

View File

@@ -13,9 +13,6 @@ on:
- Redeploy - Redeploy
- Dry Run - Dry Run
permissions:
contents: read
jobs: jobs:
setup: setup:
name: Setup name: Setup
@@ -74,6 +71,9 @@ jobs:
artifacts: "./bwdc-windows-${{ env.PKG_VERSION }}.zip, artifacts: "./bwdc-windows-${{ env.PKG_VERSION }}.zip,
./bwdc-macos-${{ env.PKG_VERSION }}.zip, ./bwdc-macos-${{ env.PKG_VERSION }}.zip,
./bwdc-linux-${{ env.PKG_VERSION }}.zip, ./bwdc-linux-${{ env.PKG_VERSION }}.zip,
./bwdc-windows-sha256-${{ env.PKG_VERSION }}.txt,
./bwdc-macos-sha256-${{ env.PKG_VERSION }}.txt,
./bwdc-linux-sha256-${{ env.PKG_VERSION }}.txt,
./Bitwarden-Connector-Portable-${{ env.PKG_VERSION }}.exe, ./Bitwarden-Connector-Portable-${{ env.PKG_VERSION }}.exe,
./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe, ./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe,
./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe.blockmap, ./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe.blockmap,

View File

@@ -5,23 +5,13 @@ on:
push: push:
branches: branches:
- "main" - "main"
pull_request:
types: [opened, synchronize, reopened]
branches-ignore:
- main
pull_request_target: pull_request_target:
types: [opened, synchronize, reopened] types: [opened, synchronize]
branches:
- "main"
permissions: {}
jobs: jobs:
check-run: check-run:
name: Check PR run name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
permissions:
contents: read
sast: sast:
name: SAST scan name: SAST scan
@@ -76,7 +66,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Scan with SonarCloud - name: Scan with SonarCloud
uses: sonarsource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0 uses: sonarsource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
env: env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with: with:

2401
package-lock.json generated

File diff suppressed because it is too large Load Diff

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": "2025.6.0", "version": "2025.5.0",
"keywords": [ "keywords": [
"bitwarden", "bitwarden",
"password", "password",
@@ -73,15 +73,15 @@
"test:types": "npx tsc --noEmit" "test:types": "npx tsc --noEmit"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "17.3.17", "@angular-devkit/build-angular": "17.3.11",
"@angular-eslint/eslint-plugin-template": "17.5.3", "@angular-eslint/eslint-plugin-template": "17.5.3",
"@angular-eslint/template-parser": "17.5.3", "@angular-eslint/template-parser": "17.5.3",
"@angular/compiler-cli": "17.3.12", "@angular/compiler-cli": "17.3.12",
"@electron/notarize": "2.5.0", "@electron/notarize": "2.5.0",
"@electron/rebuild": "3.7.2", "@electron/rebuild": "3.7.1",
"@fluffy-spoon/substitute": "1.208.0", "@fluffy-spoon/substitute": "1.208.0",
"@microsoft/microsoft-graph-types": "2.40.0", "@microsoft/microsoft-graph-types": "2.40.0",
"@ngtools/webpack": "17.3.17", "@ngtools/webpack": "17.3.11",
"@types/inquirer": "8.2.10", "@types/inquirer": "8.2.10",
"@types/jest": "29.5.14", "@types/jest": "29.5.14",
"@types/lowdb": "1.0.15", "@types/lowdb": "1.0.15",
@@ -90,37 +90,38 @@
"@types/node-forge": "1.3.11", "@types/node-forge": "1.3.11",
"@types/proper-lockfile": "4.1.4", "@types/proper-lockfile": "4.1.4",
"@types/tldjs": "2.3.4", "@types/tldjs": "2.3.4",
"@typescript-eslint/eslint-plugin": "8.32.1", "@typescript-eslint/eslint-plugin": "8.23.0",
"@typescript-eslint/parser": "8.32.1", "@typescript-eslint/parser": "8.23.0",
"clean-webpack-plugin": "4.0.0", "clean-webpack-plugin": "4.0.0",
"concurrently": "9.1.2", "concurrently": "9.1.2",
"copy-webpack-plugin": "12.0.2", "copy-webpack-plugin": "12.0.2",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"css-loader": "7.1.2", "css-loader": "7.1.2",
"dotenv": "16.5.0", "dotenv": "16.4.7",
"electron": "34.1.1", "electron": "34.1.1",
"electron-builder": "24.13.3", "electron-builder": "24.13.3",
"electron-log": "5.4.1", "electron-log": "5.2.4",
"electron-reload": "2.0.0-alpha.1", "electron-reload": "2.0.0-alpha.1",
"electron-store": "8.2.0", "electron-store": "8.2.0",
"electron-updater": "6.6.2", "electron-updater": "6.3.9",
"eslint": "8.57.1", "eslint": "8.57.1",
"eslint-config-prettier": "10.1.5", "eslint-config-prettier": "10.0.1",
"eslint-import-resolver-typescript": "3.7.0", "eslint-import-resolver-typescript": "3.7.0",
"eslint-plugin-import": "2.31.0", "eslint-plugin-import": "2.31.0",
"eslint-plugin-rxjs": "5.0.3", "eslint-plugin-rxjs": "5.0.3",
"eslint-plugin-rxjs-angular": "2.0.1", "eslint-plugin-rxjs-angular": "2.0.1",
"form-data": "4.0.3", "form-data": "4.0.1",
"html-loader": "5.1.0", "html-loader": "5.1.0",
"html-webpack-plugin": "5.6.3", "html-webpack-plugin": "5.6.3",
"husky": "9.1.7", "husky": "9.1.7",
"jest": "29.7.0", "jest": "29.7.0",
"jest-junit": "16.0.0", "jest-junit": "16.0.0",
"jest-mock-extended": "3.0.7", "jest-mock-extended": "3.0.7",
"jest-preset-angular": "14.5.5", "jest-preset-angular": "14.5.0",
"lint-staged": "15.5.2", "lint-staged": "15.4.1",
"mini-css-extract-plugin": "2.9.2", "mini-css-extract-plugin": "2.9.2",
"node-abi": "3.75.0", "minimatch": "3.1.2",
"node-abi": "3.74.0",
"node-forge": "1.3.1", "node-forge": "1.3.1",
"node-loader": "2.1.0", "node-loader": "2.1.0",
"pkg": "5.8.1", "pkg": "5.8.1",
@@ -128,11 +129,11 @@
"rimraf": "6.0.1", "rimraf": "6.0.1",
"rxjs": "7.8.2", "rxjs": "7.8.2",
"sass": "1.79.4", "sass": "1.79.4",
"sass-loader": "16.0.5", "sass-loader": "16.0.4",
"ts-jest": "29.4.0", "ts-jest": "29.2.5",
"ts-loader": "9.5.2", "ts-loader": "9.5.2",
"tsconfig-paths-webpack-plugin": "4.2.0", "tsconfig-paths-webpack-plugin": "4.2.0",
"type-fest": "4.41.0", "type-fest": "4.32.0",
"typescript": "5.4.5", "typescript": "5.4.5",
"webpack": "5.97.1", "webpack": "5.97.1",
"webpack-cli": "6.0.1", "webpack-cli": "6.0.1",
@@ -156,22 +157,21 @@
"browser-hrtime": "1.1.8", "browser-hrtime": "1.1.8",
"chalk": "4.1.2", "chalk": "4.1.2",
"commander": "13.1.0", "commander": "13.1.0",
"core-js": "3.42.0", "core-js": "3.40.0",
"form-data": "4.0.3", "form-data": "4.0.1",
"google-auth-library": "9.15.1", "google-auth-library": "9.15.1",
"googleapis": "144.0.0", "googleapis": "144.0.0",
"https-proxy-agent": "7.0.6", "https-proxy-agent": "7.0.6",
"inquirer": "8.2.6", "inquirer": "8.2.6",
"keytar": "7.9.0", "keytar": "7.9.0",
"ldapts": "7.4.0", "ldapts": "7.3.1",
"lowdb": "1.0.0", "lowdb": "1.0.0",
"ngx-toastr": "19.0.0", "ngx-toastr": "19.0.0",
"node-fetch": "2.7.0", "node-fetch": "2.7.0",
"proper-lockfile": "4.1.2", "proper-lockfile": "4.1.2",
"rxjs": "7.8.2", "rxjs": "7.8.2",
"tldjs": "2.3.1", "tldjs": "2.3.1",
"zone.js": "0.14.10", "zone.js": "0.14.10"
"parse5": "7.2.1"
}, },
"engines": { "engines": {
"node": "~22.13.0", "node": "~22.13.0",

View File

@@ -18,9 +18,7 @@ import { BaseDirectoryService } from "./baseDirectory.service";
import { IDirectoryService } from "./directory.service"; import { IDirectoryService } from "./directory.service";
const AzurePublicIdentityAuhtority = "login.microsoftonline.com"; const AzurePublicIdentityAuhtority = "login.microsoftonline.com";
const AzurePublicGraphEndpoint = "https://graph.microsoft.com";
const AzureGovermentIdentityAuhtority = "login.microsoftonline.us"; const AzureGovermentIdentityAuhtority = "login.microsoftonline.us";
const AzureGovernmentGraphEndpoint = "https://graph.microsoft.us";
const NextLink = "@odata.nextLink"; const NextLink = "@odata.nextLink";
const DeltaLink = "@odata.deltaLink"; const DeltaLink = "@odata.deltaLink";
@@ -209,7 +207,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
if (keyword === "excludeadministrativeunit" || keyword === "includeadministrativeunit") { if (keyword === "excludeadministrativeunit" || keyword === "includeadministrativeunit") {
for (const p of pieces) { for (const p of pieces) {
let auMembers = await this.client let auMembers = await this.client
.api(`${this.getGraphApiEndpoint()}/v1.0/directory/administrativeUnits/${p}/members`) .api(`https://graph.microsoft.com/v1.0/directory/administrativeUnits/${p}/members`)
.get(); .get();
// eslint-disable-next-line // eslint-disable-next-line
while (true) { while (true) {
@@ -480,7 +478,7 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
client_id: this.dirConfig.applicationId, client_id: this.dirConfig.applicationId,
client_secret: this.dirConfig.key, client_secret: this.dirConfig.key,
grant_type: "client_credentials", grant_type: "client_credentials",
scope: `${this.getGraphApiEndpoint()}/.default`, scope: "https://graph.microsoft.com/.default",
}); });
const req = https const req = https
@@ -544,10 +542,4 @@ export class AzureDirectoryService extends BaseDirectoryService implements IDire
exp.setSeconds(exp.getSeconds() + expSeconds); exp.setSeconds(exp.getSeconds() + expSeconds);
this.accessTokenExpiration = exp; this.accessTokenExpiration = exp;
} }
private getGraphApiEndpoint(): string {
return this.dirConfig.identityAuthority === AzureGovermentIdentityAuhtority
? AzureGovernmentGraphEndpoint
: AzurePublicGraphEndpoint;
}
} }