Obvious Fix: Added "files" property to only include index.js / index.d.js / properties.json in npm package#83
Open
MattSidor wants to merge 3 commits intojwtk:masterfrom
Open
Conversation
ThroughMyEyes
approved these changes
Nov 10, 2021
ThroughMyEyes
approved these changes
Nov 10, 2021
ThroughMyEyes
approved these changes
Nov 10, 2021
zzacal
approved these changes
Nov 10, 2021
zzacal
left a comment
There was a problem hiding this comment.
Great work. No reason for test keys to be published.
Collaborator
|
@MattSidor can you also include properties.json into list? |
Author
|
@oleksandrpravosudko-okta Yes! I've updated my PR. Thanks for catching that. |
oleksandrpravosudko-okta
approved these changes
Feb 3, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
My project uses a CI/CD security scanning tool for our node apps. This tool flagged the encryption keys in the
test/folder of this library and would not allow us to publish the app. Our workaround was torm -rf node_modules/njwt/testafternpm installas part of our build step in the pipeline.The security scanner is naive to the context of the encryption keys in
test/and cannot see that those files won't actually be used by the apps that import this library.However, since the
test/files are not necessary to be included for consumers of this library, I believe the best solution is to only declare the files that are necessary. npm allows us to do this via thefilesproperty ofpackage.json: https://docs.npmjs.com/cli/v6/configuring-npm/package-json#filesThis PR updates the
filesproperty ofpackage.jsonto only includeindex.js,index.d.ts, andproperties.json.These other files from the library will always be included as part of the npm package, regardless of settings: