Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an autocorrect for insecure gitlab/github source/issue url metadata #82

Merged
merged 3 commits into from
Jul 16, 2019

Conversation

tas50
Copy link
Contributor

@tas50 tas50 commented Jul 16, 2019

These represent almost all of the community cookbook and this makes sure folks are using secure URLs

Signed-off-by: Tim Smith tsmith@chef.io

@tas50 tas50 requested review from a team as code owners July 16, 2019 05:52
These represent almost all of the community cookbook and this makes sure folks are using secure URLs

Signed-off-by: Tim Smith <tsmith@chef.io>
Signed-off-by: Tim Smith <tsmith@chef.io>

def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.expression, node.source.gsub(%r{http://(www.)*}, 'https://'))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this replacer will remove www from the string since it will match on it. I think you could just .gsub(%r{^http://}, 'https://') instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing www is part of it. Those just redirect on both sites

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I did not realize that

Signed-off-by: Tim Smith <tsmith@chef.io>

def autocorrect(node)
lambda do |corrector|
corrector.replace(node.loc.expression, node.source.gsub(%r{http://(www.)*}, 'https://'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks! I did not realize that

@tas50 tas50 merged commit b8685d6 into master Jul 16, 2019
@tas50 tas50 added the Expeditor: Bump Version Minor Used by github.minor_bump_labels to bump the Minor version number. label Jul 16, 2019
@chef-ci chef-ci deleted the insecure_url branch July 16, 2019 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expeditor: Bump Version Minor Used by github.minor_bump_labels to bump the Minor version number.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants