Skip to content

[BEEEP][SM-997] Add appsettings.json Importer Option#6652

Closed
justindbaur wants to merge 8 commits into
mainfrom
add-key-value-pair-importer
Closed

[BEEEP][SM-997] Add appsettings.json Importer Option#6652
justindbaur wants to merge 8 commits into
mainfrom
add-key-value-pair-importer

Conversation

@justindbaur

Copy link
Copy Markdown
Member

Type of change

- [ ] Bug fix
- [x] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Adds an importer option for importing general JSON into a series of key-value pairs. Example files that this importer is designed to handle can be found in our own server repo. This is essentially a rewrite of how JSON configuration works in .NET (see). The only rule is that it has to be valid JSON with no comments and the top level node must be an object.

Screen.Recording.2023-10-20.at.3.22.18.PM.mov

I also took the opportunity to rework the code a bit to make it even easier to add additional importers. Another example could be a .env file format.

Code changes

  • bitwarden_license/bit-web/src/app/secrets-manager/settings/importers/appsettings-json.importer.ts: The appsettings json importer including a helper parser class for reading any json content into key value pairs via a given separator.
  • bitwarden_license/bit-web/src/app/secrets-manager/settings/importers/bitwarden-json.importer.ts: Boilerplate for the existing JSON importer.
  • bitwarden_license/bit-web/src/app/secrets-manager/settings/importers/importer.abstraction.ts: Defines all the abstract types and classes that are needed to create a custom importer.
  • bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-dynamic-import-option.component.html: Defines a component that can take an importer option and render the UI dynamically. Currently the only options it supports are text boxes and dropdowns but others could be added.
  • bitwarden_license/bit-web/src/app/secrets-manager/settings/porting/sm-import.component.ts: Refactored to support dynamic importers.

Screenshots

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

@github-actions github-actions Bot added the needs-qa Marks a PR as requiring QA approval label Oct 20, 2023
@justindbaur
justindbaur marked this pull request as ready for review October 20, 2023 20:43
@justindbaur
justindbaur requested a review from a team as a code owner October 20, 2023 20:43
@justindbaur justindbaur changed the title [BEEEP] Add appsettings.json Importer Option [BEEEP][SM-997] Add appsettings.json Importer Option Oct 20, 2023
@bitwarden-bot

bitwarden-bot commented Oct 20, 2023

Copy link
Copy Markdown
Collaborator

Logo
Checkmarx One – Scan Summary & Details6ad000e3-235c-4a62-9999-90fe2a2d97c0

Fixed Issues

Severity Issue Source File / Package
LOW Use_Of_Hardcoded_Password /apps/desktop/src/platform/preload.ts: 25
LOW Use_Of_Hardcoded_Password /apps/desktop/src/platform/preload.ts: 23
LOW Use_Of_Hardcoded_Password /apps/desktop/src/platform/preload.ts: 21
LOW Use_Of_Hardcoded_Password /apps/desktop/src/platform/preload.ts: 19

@justindbaur
justindbaur removed request for a team December 15, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-qa Marks a PR as requiring QA approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants