Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

fix(@schematics/update): Allow usage strict SSL configuration - #838

Merged
hansl merged 1 commit into
angular:masterfrom
Brocco:ng-update-ssl-fix
May 14, 2018
Merged

hansl merged 1 commit into
angular:masterfrom
Brocco:ng-update-ssl-fix

Conversation

@Brocco

@Brocco Brocco commented May 2, 2018 •

Copy link
Copy Markdown
Contributor

@Brocco
Brocco requested a review from clydin May 2, 2018 19:01
@Brocco
Brocco requested a review from hansl as a code owner May 2, 2018 19:01
clydin
clydin previously approved these changes May 3, 2018
return concat(
getNpmConfigOption('proxy'),
getNpmConfigOption('https-proxy'),
getNpmConfigOption('strict-ssl'),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is getNpmConfigOption('strict-ssl') provides true default when strict-ssl is missing in config?

https: options[1],
},
ssl: {
strict: options[2],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This will give you the string value instead of the boolean. options[2] === 'true' would be more appropriate.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since npm-registry-client's config requires ssl.strict to be a boolean and npm's default config has strict-ssl set to true (https://docs.npmjs.com/misc/config#strict-ssl), the exec npm get strict-ssl in getNpmConfigOption function should yield true if not explicitly set.

options[2] === 'true' should suffice as @alvaro450 mentioned above.

https: options[1],
},
ssl: {
strict: options[2],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since npm-registry-client's config requires ssl.strict to be a boolean and npm's default config has strict-ssl set to true (https://docs.npmjs.com/misc/config#strict-ssl), the exec npm get strict-ssl in getNpmConfigOption function should yield true if not explicitly set.

options[2] === 'true' should suffice as @alvaro450 mentioned above.

https: options[1],
},
ssl: {
strict: options[2] === 'true',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If it is undefined it should stay as undefined to pick up the default.

@AlgoTrader AlgoTrader May 10, 2018 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

undefined will cause strict: false. strict is default to true. The key should go there only if strict is false

if(options[2]==='false') {
  opts = {...opts, {ssl: {strict: false}}}
}

ssl stuff should be maximally explicit

@clydin clydin May 10, 2018 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Actually, undefined will cause it to be true. It is explicitly handled: https://github.com/npm/npm-registry-client/blob/latest/index.js#L32

However, there is not much downside to being explicit here as well. I'd probably go with something similar to the following:

...(options[2] === 'false' ? { strict: false } : (options[2] === 'true' ? { strict: true } : {})),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Addressed and updated

@Brocco
Brocco force-pushed the ng-update-ssl-fix branch from 634156c to 4b22870 Compare May 11, 2018 02:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants