Skip to content

Commit

Permalink
Merge branch 'main' into release/2024.10-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
KatherineInCode authored Oct 23, 2024
2 parents 230d94e + fe3f6bd commit 6af9eec
Show file tree
Hide file tree
Showing 1,302 changed files with 9,186 additions and 3,443 deletions.
2 changes: 1 addition & 1 deletion .github/actions/dispatch-and-download/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ runs:
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Dispatch an action and get the run ID and URL
uses: codex-/return-dispatch@8e5959a15e0ef0a34b9569395f994e61fed5dd26 # v1.16.0
uses: codex-/return-dispatch@06d9405c91c1696f12c0bf915ab9c5161c8f06fc # v2.0.1
id: return_dispatch
with:
token: ${{ inputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/CI-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT
echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT
- name: Upload version info artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: version-info
path: version-info/version_info.json
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/_version.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Calculate Version Name and Number


Expand Down Expand Up @@ -43,7 +42,7 @@ jobs:

- name: Check out repository
if: ${{ !inputs.skip_checkout || false }}
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0

Expand Down Expand Up @@ -119,7 +118,7 @@ jobs:
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload version info artifact
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: version-info
path: version_info.json
19 changes: 12 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ on:
type: boolean
env:
BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }}
XCODE_VERSION: ${{ inputs.xcode-version || '15.4' }}
XCODE_VERSION: ${{ inputs.xcode-version }}

jobs:
build:
Expand All @@ -88,7 +88,7 @@ jobs:
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Check out repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
filter: tree:0
Expand Down Expand Up @@ -126,21 +126,26 @@ jobs:
content=$(cat version-info/version_info.json)
echo "version_name=$(echo $content | jq -r .version_name)" >> $GITHUB_OUTPUT
echo "version_number=$(echo $content | jq -r .version_number)" >> $GITHUB_OUTPUT
- name: Upload version info artifact
if: ${{ inputs.upload_version_info }}
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: version-info
path: version-info/version_info.json

- name: Read default Xcode version
run: |
echo "DEFAULT_XCODE_VERSION=$(cat .xcode-version | tr -d '\n')" >> "$GITHUB_ENV"
- name: Set Xcode version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: ${{ env.XCODE_VERSION }}
xcode-version: ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }}

- name: Cache Mint packages
id: mint-cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: .mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
Expand Down Expand Up @@ -302,7 +307,7 @@ jobs:
plutil -replace aps-environment -string production Bitwarden/Application/Support/Bitwarden.entitlements
- name: Configure Ruby
uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1.194.0
uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.0
with:
bundler-cache: true

Expand Down Expand Up @@ -340,7 +345,7 @@ jobs:
cp -rv build/Bitwarden.xcarchive/dSYMs/*.dSYM export/dSYMs
- name: Upload IPA & dSYM files
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION }}
path: export
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
_CROWDIN_PROJECT_ID: "269690"
steps:
- name: Checkout repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
_CROWDIN_PROJECT_ID: "269690"
steps:
- name: Check out repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Log in to Azure
uses: Azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:

steps:
- name: Check out repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Scan with Checkmarx
uses: checkmarx/ast-github-action@ed196cdaec9cd1bc5aacac4ca2010dd773b20893 # 2.0.35
uses: checkmarx/ast-github-action@f0869bd1a37fddc06499a096101e6c900e815d81 # 2.0.36
env:
INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
with:
Expand All @@ -46,7 +46,7 @@ jobs:
--output-path . ${{ env.INCREMENTAL }}
- name: Upload Checkmarx results to GitHub
uses: github/codeql-action/upload-sarif@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
uses: github/codeql-action/upload-sarif@f779452ac5af1c261dce0346a8f964149f49322b # v3.26.13
with:
sarif_file: cx_result.sarif

Expand All @@ -60,13 +60,13 @@ jobs:

steps:
- name: Check out repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Scan with SonarCloud
uses: sonarsource/sonarcloud-github-action@eb211723266fe8e83102bac7361f0a05c3ac1d1b # v3.0.0
uses: sonarsource/sonarcloud-github-action@383f7e52eae3ab0510c3cb0e7d9d150bbaeab838 # v3.1.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
55 changes: 45 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,37 @@ on:
- "hotfix-rc"
pull_request_target:
types: [opened, synchronize]
workflow_dispatch:
inputs:
xcode-version:
description: "Xcode version override - e.g. '15.2'"
type: string
simulator-name:
description: "Simulator name override - e.g. 'iPhone 16 Pro'"
type: string
simulator-version:
description: "Simulator iOS version override - e.g. '18.0.1'"
type: string
workflow_call:
inputs:
xcode-version:
description: "Xcode version override - e.g. '15.2'"
type: string
simulator-name:
description: "Simulator name override - e.g. 'iPhone 16 Pro'"
type: string
simulator-version:
description: "Simulator iOS version override - e.g. '18.0.1'"
type: string

env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
COVERAGE_PATH: build/coverage.xml
MINT_LINK_PATH: .mint/bin
MINT_PATH: .mint/lib
SIMULATOR_DESTINATION: platform=iOS Simulator,name=iPhone 15 Pro,OS=17.0.1
RESULT_BUNDLE_PATH: build/BitwardenTests.xcresult
COVERAGE_PATH: build/coverage.xml
XCODE_VERSION: 15.4
SIMULATOR_NAME: ${{ inputs.simulator-name || 'iPhone 15 Pro' }}
SIMULATOR_VERSION: ${{ inputs.simulator-version || '18.0' }}
XCODE_VERSION: ${{ inputs.xcode-version }}

jobs:
check-run:
Expand All @@ -33,31 +55,44 @@ jobs:
pull-requests: write

steps:
- name: Log inputs to job summary
run: |
echo "<details><summary>Build Workflow Inputs</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```json' >> $GITHUB_STEP_SUMMARY
echo '${{ toJson(inputs) }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
- name: Check out repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Read default Xcode version
run: |
echo "DEFAULT_XCODE_VERSION=$(cat .xcode-version | tr -d '\n')" >> "$GITHUB_ENV"
- name: Set Xcode version
uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: ${{ env.XCODE_VERSION }}
xcode-version: ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }}

- name: Configure Ruby
uses: ruby/setup-ruby@c04af2bb7258bb6a03df1d3c1865998ac9390972 # v1.194.0
uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.0
with:
bundler-cache: true

- name: Cache Mint packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: .mint
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- name: Cache SPM packages
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
with:
path: build/DerivedData/SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
Expand All @@ -82,7 +117,7 @@ jobs:
-project Bitwarden.xcodeproj \
-scheme Bitwarden \
-configuration Debug \
-destination "${{ env.SIMULATOR_DESTINATION }}" \
-destination "platform=iOS Simulator,name=${{ env.SIMULATOR_NAME }},OS=${{ env.SIMULATOR_VERSION }}" \
-resultBundlePath ${{ env.RESULT_BUNDLE_PATH }} \
-derivedDataPath build/DerivedData \
| xcbeautify --renderer github-actions
Expand Down
1 change: 0 additions & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
15.4

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import Foundation
public struct AuthenticatorBridgeItemDataModel: Codable, Equatable {
// MARK: Properties

/// The domain of the Bitwarden account that owns this item. (e.g. https://vault.bitwarden.com)
public let accountDomain: String?

/// The email of the Bitwarden account that owns this item.
public let accountEmail: String?

/// Bool indicating if this item is a favorite.
public let favorite: Bool

Expand All @@ -18,6 +24,6 @@ public struct AuthenticatorBridgeItemDataModel: Codable, Equatable {
/// The TOTP key used to generate codes.
public let totpKey: String?

/// The username of the Bitwarden account that owns this iteam.
/// The username of the item.
public let username: String?
}
22 changes: 19 additions & 3 deletions AuthenticatorBridgeKit/AuthenticatorBridgeItemDataView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import Foundation
public struct AuthenticatorBridgeItemDataView: Codable, Equatable {
// MARK: Properties

/// The domain of the Bitwarden account that owns this item. (e.g. https://vault.bitwarden.com)
public let accountDomain: String?

/// The email of the Bitwarden account that owns this item.
public let accountEmail: String?

/// Bool indicating if this item is a favorite.
public let favorite: Bool

Expand All @@ -18,19 +24,29 @@ public struct AuthenticatorBridgeItemDataView: Codable, Equatable {
/// The TOTP key used to generate codes.
public let totpKey: String?

/// The username of the Bitwarden account that owns this iteam.
/// The username of the item.
public let username: String?

/// Initialize an `AuthenticatorBridgeItemDataView` with the values provided.
///
/// - Parameters:
/// - accountDomain: The domain of the Bitwarden account that owns this item.
/// - accountEmail: The email of the Bitwarden account that owns this item
/// - favorite: Bool indicating if this item is a favorite.
/// - id: The unique id of the item.
/// - name: The name of the item.
/// - totpKey: The TOTP key used to generate codes.
/// - username: The username of the Bitwarden account that owns this item.
/// - username: The username of the item.
///
public init(favorite: Bool, id: String, name: String, totpKey: String?, username: String?) {
public init(accountDomain: String?,
accountEmail: String?,
favorite: Bool,
id: String,
name: String,
totpKey: String?,
username: String?) {
self.accountDomain = accountDomain
self.accountEmail = accountEmail
self.favorite = favorite
self.id = id
self.name = name
Expand Down
4 changes: 4 additions & 0 deletions AuthenticatorBridgeKit/SharedCryptographyService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService

return items.map { item in
AuthenticatorBridgeItemDataView(
accountDomain: (try? decrypt(item.accountDomain, withKey: symmetricKey)) ?? "",
accountEmail: (try? decrypt(item.accountEmail, withKey: symmetricKey)) ?? "",
favorite: item.favorite,
id: item.id,
name: (try? decrypt(item.name, withKey: symmetricKey)) ?? "",
Expand All @@ -79,6 +81,8 @@ public class DefaultAuthenticatorCryptographyService: SharedCryptographyService

return items.map { item in
AuthenticatorBridgeItemDataModel(
accountDomain: encrypt(item.accountDomain, withKey: symmetricKey) ?? "",
accountEmail: encrypt(item.accountEmail, withKey: symmetricKey) ?? "",
favorite: item.favorite,
id: item.id,
name: encrypt(item.name, withKey: symmetricKey) ?? "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ final class AuthenticatorBridgeItemDataTests: AuthenticatorBridgeKitTestCase {
context: dataStore.persistentContainer.viewContext,
userId: "userId",
authenticatorItem: AuthenticatorBridgeItemDataModel(
favorite: true, id: "is", name: "name", totpKey: "TOTP Key", username: "username"
accountDomain: "https://vault.example.com",
accountEmail: "[email protected]",
favorite: true,
id: "is",
name: "name",
totpKey: "TOTP Key",
username: "username"
)
)

Expand Down
10 changes: 10 additions & 0 deletions AuthenticatorBridgeKit/Tests/SharedCryptographyServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ final class SharedCryptographyServiceTests: AuthenticatorBridgeKitTestCase {

// Encrypted values should not remain equal, unless they were `nil`
XCTAssertNotEqual(item.name, encryptedItem.name)
if item.accountDomain != nil {
XCTAssertNotEqual(item.accountDomain, encryptedItem.accountDomain)
} else {
XCTAssertNil(encryptedItem.accountDomain)
}
if item.accountEmail != nil {
XCTAssertNotEqual(item.accountEmail, encryptedItem.accountEmail)
} else {
XCTAssertNil(encryptedItem.accountEmail)
}
if item.totpKey != nil {
XCTAssertNotEqual(item.totpKey, encryptedItem.totpKey)
} else {
Expand Down
Loading

0 comments on commit 6af9eec

Please sign in to comment.