Skip to content

Conversation

@tangowithfoxtrot
Copy link
Contributor

@tangowithfoxtrot tangowithfoxtrot commented Nov 5, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/SM-1738

📔 Objective

Update sdk-internal crates. This, unfortunately required some pretty heavy, less-than-ideal changes, which I've added comments for throughout the PR.

⏰ Reminders before review

  • 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 (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+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
  • 🎨 (: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
  • ⛏ (:pick:) for minor or nitpick changes

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

Logo
Checkmarx One – Scan Summary & Details8ec8c38e-032f-42bc-8731-18068dc508c9

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 15.34%. Comparing base (26924d4) to head (fcf482f).

Files with missing lines Patch % Lines
crates/bws/src/command/project.rs 0.00% 9 Missing ⚠️
crates/bws/src/command/secret.rs 0.00% 9 Missing ⚠️
crates/bws/src/command/run.rs 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1370      +/-   ##
==========================================
- Coverage   15.42%   15.34%   -0.08%     
==========================================
  Files          21       21              
  Lines        1193     1199       +6     
==========================================
  Hits          184      184              
- Misses       1009     1015       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

schemars >1.x uses https://json-schema.org/draft/2020-12/schema
instead of https://json-schema.org/draft-07/schema#.

I'm not exactly sure why, but something about this
seems to have changed our schema output to use names
like Response7 instead of ResponseForSecretsResponse,
which breaks the language bindings that rely on them.

Introduce a manual JsonSchema impl that restores
the SchemaTypes.json output to what it was before
foldhash v0.1.5
└── hashbrown v0.15.5
    └── hashlink v0.10.0
        └── rusqlite v0.37.0
            └── bitwarden-state v1.0.0
                └── bitwarden-core v1.0.0
                    ├── bitwarden v1.0.0
                    │   └── bws 1.0.0
                    ├── bitwarden-generators v1.0.0
                    │   └── bitwarden 1.0.0
                    └── bitwarden-sm v1.0.0
                        └── bitwarden v1.0.0
"Unicode-DFS-2016",
"Unicode-3.0",
"OpenSSL",
"Zlib",
Copy link
Contributor Author

@tangowithfoxtrot tangowithfoxtrot Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The need for this comes from bitwarden-state, which has a direct dependency on rusqlite, which has an indirect dependency on foldhash, which is Zlib-licensed:

foldhash v0.1.5
└── hashbrown v0.15.5
    └── hashlink v0.10.0
        └── rusqlite v0.37.0
            └── bitwarden-state v1.0.0
                └── bitwarden-core v1.0.0
                    ├── bitwarden v1.0.0
                    │   └── bws 1.0.0
                    ├── bitwarden-generators v1.0.0
                    │   └── bitwarden 1.0.0
                    └── bitwarden-sm v1.0.0
                        └── bitwarden v1.0.0

pub data: Option<T>,
}

impl<T: Serialize + JsonSchema> JsonSchema for Response<T> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is far from ideal, but schemars 1.0 changed how schema generation is handled and it was breaking our wrappers. Without the manual JsonSchema impl, our generated schemas would contain unusable objects, like Response7 instead of ResponseForSecretsDeleteRequest etc.

The manual impl restores the generated schemas in such a way that does not break our language wrappers.

Copy link
Contributor Author

@tangowithfoxtrot tangowithfoxtrot Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems we can avoid this by using #[schemars(rename = "Response_for_{T}")], as described here.

Removed the manual impl in ab2dfdf.

@tangowithfoxtrot tangowithfoxtrot marked this pull request as ready for review November 17, 2025 13:00
@tangowithfoxtrot tangowithfoxtrot requested a review from a team as a code owner November 17, 2025 13:00
Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDK changes LGTM!

@tangowithfoxtrot
Copy link
Contributor Author

Setting this back to a draft until bitwarden/sdk-internal#562 is merged to fix the WASM builds.

@tangowithfoxtrot tangowithfoxtrot marked this pull request as draft November 18, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants