Skip to content

refactor(internal-plugin-encryption): pkijs v3 + node 20 engines#4951

Open
Tiuipuv wants to merge 7 commits into
webex:nextfrom
Evernorth:refactor/internal-plugin-encryption-pkijs-v3
Open

refactor(internal-plugin-encryption): pkijs v3 + node 20 engines#4951
Tiuipuv wants to merge 7 commits into
webex:nextfrom
Evernorth:refactor/internal-plugin-encryption-pkijs-v3

Conversation

@Tiuipuv

@Tiuipuv Tiuipuv commented May 5, 2026

Copy link
Copy Markdown
Contributor

This pull request addresses

Reduce the size of the dependency tree massively (which will allow consumers to remove --omit=optional from npm installs) due to the entire expo/react native tree being installed.

Before, when running npm install webex-js-sdk in a fresh directory will yield this:

  • 1957 deps (415 mb)
  • 68 vulnerabilities (66 moderate, 2 critical)

With this fix branch, it will yield this:

  • 672 deps (134 MB)
  • 59 vulnerabilities (57 moderate, 2 critical)

Lastly, this branch standardizes node ver to >=20 (up from ~18)

by making the following changes

This is done by removing deps in internal-plugin-encryption that are only used by that package, and are replaced with built-in functionality of modern browsers + nodejs.

The following deps are removed:

  • valid-url (replaced by new URL() constructor)
  • asn1js (functionality exposed by modern pkijs)
  • safe-buffer (exposed on global, pattern already used in other packages)
  • isomorphic-webcrypto (modern pkijs no longer requires a separate crypto implementation. this is where the massive react native dependencies is pulled in via optional deps)

The following were updated:

  • pkijs: v2.1.84 to v3.4.0

Also, this standardizes minimum NodeJS by addressing old engines.node fields stuck at v8, v14, v16, and v18, bumping up to v20. Similar to #4288

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

Ran unit tests, and attempted manual bad path injection to verify code coverage of kms.

For reviewing speed purposes, the actual logic changes occur just under internal-plugin-encryption, with the following files:

  • src/kms.js
  • src/kms-certificate-validation.js
  • test/integration/spec/kms.js

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

Tiuipuv added 2 commits May 5, 2026 12:17
update pkijs to v3, and fix call points
remove asn1js (using new pkijs features)
remove valid-url (use native URL constructor)
remove isomorphic-webcrypto (use new pkijs features)
remove safe-buffer (use native Buffer constructor)
remove uuid (use native uuid v4 via global crypto)
fix jsdocs
@Tiuipuv Tiuipuv requested review from a team as code owners May 5, 2026 18:46
@Tiuipuv Tiuipuv changed the title Refactor/internal plugin encryption pkijs v3 refactor(internal-plugin-encryption): pkijs v3 + node 20 engines May 5, 2026
@aws-amplify-us-east-2

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4951.d3m3l2kee0btzx.amplifyapp.com

@bhabalan bhabalan added the validated If the pull request is validated for automation. label May 14, 2026

@mkesavan13 mkesavan13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please remove all changes to mandate node v20 or is it that the package that you import supports only above node 20? Kindly clarify. Also, please update the branch. It has conflicts

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 513979b5aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/@webex/internal-plugin-encryption/src/kms.js Outdated
Tiuipuv added 2 commits May 26, 2026 12:59
…20 bumps

- Replace all crypto.randomUUID() with uuid.v4()
- Re-add uuid@^3.3.2 to package dependencies
- Reverse package.json engines.node bumps

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d16ea4fbc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e4cdd0618

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

return Certificate.fromBER(Buffer.from(pem, 'base64'));

P1 Badge Restore explicit Buffer shim for certificate decoding

decodeCert() now calls Buffer.from(...) without importing Buffer, so browser builds that do not auto-polyfill Node globals (common in modern webpack/vite setups) will throw ReferenceError: Buffer is not defined during KMS JWT validation. This is a runtime regression introduced by dropping the previous safe-buffer import, and it blocks credential validation before any fallback logic can run.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Tiuipuv

Tiuipuv commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

@mkesavan13 package is up to date with latest from next.

The reason for the bump to v20 was because of crypto not being exposed globally until v19 (effectively v20 for LTS) of NodeJS. However, I reverted back to the very old uuid v3 lib so we can reduce scope for the PR. Its worth noting that some of the sub packages are already requiring v20 in engines (@webex/contact-center), so they really probably should be synced across the repo up to v20 for clarity on what the effective minimum version is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants