Skip to content

Commit

Permalink
Merge branch 'main' into PM-18636-showcoachmark-conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-livefront committed Feb 26, 2025
2 parents b5a85c4 + d04ac5e commit 3cc1690
Show file tree
Hide file tree
Showing 25 changed files with 140 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .checkmarx/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ checkmarx:
configs:
sast:
# Exclude test directories
filter: "!app/src/test/**"
filter: "**/test/**,!**/androidTest/**,!**/commonTest/**,!**/jvmTest/**,!**/jsTest/**,!**/iosTest/**"
84 changes: 84 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-bwa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Authenticator Android App Bug Report
description: File a bug report
labels: [ "app:authenticator", "bug" ]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please do not submit feature requests. The [Community Forums](https://community.bitwarden.com) has a section for submitting, voting for, and discussing product feature requests.
- type: textarea
id: reproduce
attributes:
label: Steps To Reproduce
description: How can we reproduce the behavior.
value: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. Click on '...'
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Result
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual Result
description: A clear and concise description of what is happening.
validations:
required: true
- type: textarea
id: screenshots
attributes:
label: Screenshots or Videos
description: If applicable, add screenshots and/or a short video to help explain your problem.
- type: textarea
id: additional-context
attributes:
label: Additional Context
description: Add any other context about the problem here.
- type: input
id: version
attributes:
label: Build Version
description: What version of our software are you running?
validations:
required: true
- type: dropdown
id: server-region
attributes:
label: What server are you connecting to?
options:
- US
- EU
- Self-host
- N/A
validations:
required: true
- type: input
id: server-version
attributes:
label: Self-host Server Version
description: If self-hosting, what version of Bitwarden Server are you running?
- type: textarea
id: environment-details
attributes:
label: Environment Details
placeholder: |
- Device: [e.g. Pixel Tablet, Samsung Galaxy S24 ]
- OS Version: [e.g. API 32, Tiramisu ]
- type: checkboxes
id: issue-tracking-info
attributes:
label: Issue Tracking Info
description: |
Issue tracking information
options:
- label: I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Android Bug Report
name: Password Manager Android App Bug Report
description: File a bug report
labels: [ bug ]
labels: [ "app:password-manager", "bug" ]
body:
- type: markdown
attributes:
Expand Down
3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Legacy Android Bug Reports
url: https://github.com/bitwarden/mobile/issues
about: Bugs found in the publicly available .NET MAUI app should be reported in [bitwarden/mobile](https://github.com/bitwarden/mobile)
- name: Feature Requests
url: https://community.bitwarden.com/c/feature-requests/
about: Request new features using the Community Forums. Please search existing feature requests before making a new one.
Expand Down
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
- Contributor guidelines followed
- All formatters and local linters executed and passed
- Written new unit and / or integration tests where applicable
- Protected functional changes with optionality (feature flags)
- Used internationalization (i18n) for all UI strings
- CI builds passed
- Communicated to DevOps any deployment requirements
- Updated any necessary documentation or informed the documentation team
- Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

## 🦮 Reviewer guidelines

Expand All @@ -27,8 +28,7 @@
- 👍 (`:+1:`) or similar for great changes
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
- ❓ (`:question:`) for questions
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed
issue and could potentially benefit from discussion
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
- 🎨 (`:art:`) for suggestions / improvements
- ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention
- 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt
Expand Down
1 change: 1 addition & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"description": "Kotlin and Compose dependencies that must be updated together to maintain compatibility.",
"matchPackagePatterns": [
"androidx.compose:compose-bom",
"androidx.lifecycle:*",
"org.jetbrains.kotlin.*",
"com.google.devtools.ksp"
],
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ user.properties

# Secrets
/keystores/*.jks
/app/src/standardDebug/google-services.json
/app/src/standardBeta/google-services.json
/app/src/standardRelease/google-services.json
/authenticator/src/google-services.json
31 changes: 21 additions & 10 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
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!
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!

# Disclosure Policy

- 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.
- 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.
- 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).
- 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.
- 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.
- 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).

While researching, we'd like to ask you to refrain from:

- Denial of service
- Spamming
- Social engineering (including phishing) of Bitwarden staff or contractors
- Any physical attempts against Bitwarden property or data centers
- Denial of service
- Spamming
- Social engineering (including phishing) of Bitwarden staff or contractors
- 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.
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!
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import com.x8bit.bitwarden.data.vault.datasource.network.model.OrganizationType
* @property name The name of the organization (if applicable).
* @property shouldManageResetPassword Indicates that this user has the permission to manage their
* own password.
* @property shouldManagePolicies Indicates that this user has the permission to manage policies.
* @property shouldUseKeyConnector Indicates that the organization uses a key connector.
* @property role The user's role in the organization.
*/
data class Organization(
val id: String,
val name: String?,
val shouldManageResetPassword: Boolean,
val shouldManagePolicies: Boolean,
val shouldUseKeyConnector: Boolean,
val role: OrganizationType,
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ fun SyncResponseJson.Profile.Organization.toOrganization(): Organization =
shouldUseKeyConnector = this.shouldUseKeyConnector,
role = this.type,
shouldManageResetPassword = this.permissions.shouldManageResetPassword,
shouldManagePolicies = this.permissions.shouldManagePolicies,
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,21 @@ class PolicyManagerImpl(
organization: SyncResponseJson.Profile.Organization,
policyType: PolicyTypeJson,
): Boolean =
if (policyType == PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT) {
organization.type == OrganizationType.OWNER
} else if (policyType == PolicyTypeJson.PASSWORD_GENERATOR) {
false
} else {
(organization.type == OrganizationType.OWNER ||
organization.type == OrganizationType.ADMIN) ||
organization.permissions.shouldManagePolicies
when (policyType) {
PolicyTypeJson.MAXIMUM_VAULT_TIMEOUT -> {
organization.type == OrganizationType.OWNER
}

PolicyTypeJson.PASSWORD_GENERATOR,
PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN,
-> {
false
}

else -> {
(organization.type == OrganizationType.OWNER ||
organization.type == OrganizationType.ADMIN) ||
organization.permissions.shouldManagePolicies
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import com.x8bit.bitwarden.R
import com.x8bit.bitwarden.data.auth.repository.AuthRepository
import com.x8bit.bitwarden.data.auth.repository.model.Organization
import com.x8bit.bitwarden.data.auth.repository.model.PolicyInformation
import com.x8bit.bitwarden.data.auth.repository.model.UserFingerprintResult
import com.x8bit.bitwarden.data.auth.repository.util.policyInformation
Expand All @@ -22,9 +21,7 @@ import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeout
import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeoutAction
import com.x8bit.bitwarden.data.platform.repository.util.baseWebVaultUrlOrDefault
import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow
import com.x8bit.bitwarden.data.vault.datasource.network.model.OrganizationType
import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson
import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson
import com.x8bit.bitwarden.data.vault.repository.VaultRepository
import com.x8bit.bitwarden.ui.platform.base.BaseViewModel
import com.x8bit.bitwarden.ui.platform.base.util.Text
Expand Down Expand Up @@ -116,10 +113,10 @@ class AccountSecurityViewModel @Inject constructor(
.launchIn(viewModelScope)

policyManager
.getActivePoliciesFlow(type = (PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN))
.getActivePoliciesFlow(type = PolicyTypeJson.REMOVE_UNLOCK_WITH_PIN)
.map { policies ->
AccountSecurityAction.Internal.RemovePinPolicyUpdateReceive(
removeUnlockWithPinPolicyEnabled = arePoliciesValid(policies),
removeUnlockWithPinPolicyEnabled = policies.isNotEmpty(),
)
}
.onEach(::sendAction)
Expand Down Expand Up @@ -169,20 +166,6 @@ class AccountSecurityViewModel @Inject constructor(
}
}

private fun arePoliciesValid(policies: List<SyncResponseJson.Policy>) =
policies.any { policy ->
authRepository.userStateFlow.value?.activeAccount?.organizations?.any { org ->
(policy.organizationId == org.id) && !isExemptFromPolicy(org)
} == true
}

private fun isExemptFromPolicy(
userOrg: Organization,
) = userOrg.role == OrganizationType.OWNER ||
userOrg.role == OrganizationType.ADMIN ||
(userOrg.role == OrganizationType.CUSTOM &&
userOrg.shouldManagePolicies)

override fun handleAction(action: AccountSecurityAction): Unit = when (action) {
AccountSecurityAction.AccountFingerprintPhraseClick -> handleAccountFingerprintPhraseClick()
is AccountSecurityAction.AuthenticatorSyncToggle -> handleAuthenticatorSyncToggle(action)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4450,7 +4450,6 @@ class AuthRepositoryTest {
every { name } returns "orgName"
every { permissions } returns mockk {
every { shouldManageResetPassword } returns false
every { shouldManagePolicies } returns false
}
every { shouldUseKeyConnector } returns true
every { type } returns OrganizationType.USER
Expand All @@ -4476,7 +4475,6 @@ class AuthRepositoryTest {
every { name } returns "orgName"
every { permissions } returns mockk {
every { shouldManageResetPassword } returns false
every { shouldManagePolicies } returns false
}
every { shouldUseKeyConnector } returns true
every { type } returns OrganizationType.USER
Expand Down Expand Up @@ -4513,7 +4511,6 @@ class AuthRepositoryTest {
every { name } returns "orgName"
every { permissions } returns mockk {
every { shouldManageResetPassword } returns false
every { shouldManagePolicies } returns false
}
every { shouldUseKeyConnector } returns true
every { type } returns OrganizationType.USER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ class AuthDiskSourceExtensionsTest {
shouldManageResetPassword = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
shouldManagePolicies = false,
),
),
),
Expand All @@ -205,7 +204,6 @@ class AuthDiskSourceExtensionsTest {
id = "mockId-2",
name = "mockName-2",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand All @@ -218,7 +216,6 @@ class AuthDiskSourceExtensionsTest {
id = "mockId-3",
name = "mockName-3",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand Down Expand Up @@ -366,7 +363,6 @@ class AuthDiskSourceExtensionsTest {
id = "mockId-1",
name = "mockName-1",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand Down Expand Up @@ -398,7 +394,6 @@ class AuthDiskSourceExtensionsTest {
id = "mockId-1",
name = "mockName-1",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand All @@ -411,7 +406,6 @@ class AuthDiskSourceExtensionsTest {
id = "mockId-2",
name = "mockName-2",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class SyncResponseJsonExtensionsTest {
id = "mockId-1",
name = "mockName-1",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.ADMIN,
),
Expand All @@ -37,15 +36,13 @@ class SyncResponseJsonExtensionsTest {
id = "mockId-1",
name = "mockName-1",
shouldManageResetPassword = false,
shouldManagePolicies = false,
shouldUseKeyConnector = true,
role = OrganizationType.ADMIN,
),
Organization(
id = "mockId-2",
name = "mockName-2",
shouldManageResetPassword = true,
shouldManagePolicies = false,
shouldUseKeyConnector = false,
role = OrganizationType.USER,
),
Expand Down
Loading

0 comments on commit 3cc1690

Please sign in to comment.