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

Fix Rubocop Security/Open #1447

Merged
merged 3 commits into from Jan 2, 2019
Merged

Fix Rubocop Security/Open #1447

merged 3 commits into from Jan 2, 2019

Conversation

rhymes
Copy link
Contributor

@rhymes rhymes commented Jan 2, 2019

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Documentation Update

Description

The biggest change here is the removal of Kernel#open in favor of HTTParty which is a gem that's used elsewhere.

A couple of reasons:

  • Kernel#open is potentially a security flaw, see rubocop's rule about it
  • Two places out of three don't need to download the whole body: in the first we're only checking the status and in the second one we're only using the HTTP request to get the last URI in a redirect. Both can be accomplished with a HTTP HEAD, which is going to be faster (no body, no reason for Ruby to build unnecessary objects for it)

I've also fixed a couple of cosmetic issues.

Related Tickets & Documents

Mobile & Desktop Screenshots/Recordings (if there are UI changes)

Added to documentation?

  • docs.dev.to
  • readme
  • no documentation needed

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Jan 2, 2019
Copy link
Member

@maestromac maestromac left a comment

Choose a reason for hiding this comment

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

Thanks for this @rhymes ! LGTM!

@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Jan 2, 2019
@maestromac maestromac merged commit dbf5fc6 into forem:master Jan 2, 2019
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Jan 2, 2019
@rhymes rhymes deleted the rhymes/rubocop-layout-security-open branch January 2, 2019 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants