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

Issue #33677: Replace use of whitelist with allowlist and blacklist with denylist #33678

Closed
wants to merge 3 commits into from
Closed

Conversation

tiegz
Copy link
Contributor

@tiegz tiegz commented Aug 22, 2018

Summary

  • Documentation changes:
    • "whitelist" renamed to "allowlist"
    • "blacklist" renamed to "denylist"
  • Deprecates enforce_raw_sql_whitelist in favor of enforce_raw_sql_allowlist.
  • Renames:
    • ActiveJob::Arguments: TYPE_WHITELIST to TYPE_ALLOWLIST
    • ActionController::Live::SSE: WHITELISTED_OPTIONS to ALLOWLISTED_OPTIONS
    • ActionView::Template::Handlers::ERB: escape_whitelist to escape_allowlist
    • ActiveRecord::AttributeMethods: BLACKLISTED_CLASS_METHODS to DENYLISTED_CLASS_METHODS
    • ActiveRecord::AttributeMethods::GeneratedAttributeMethods: COLUMN_NAME_ORDER_WHITELIST to COLUMN_NAME_ORDER_ALLOWLIST
    • ActiveRecord::AttributeMethods::ClassMethods: COLUMN_NAME_WHITELIST to COLUMN_NAME_ALLOWLIST

Other Information

Fixes #33677

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @georgeclaghorn (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@tiegz
Copy link
Contributor Author

tiegz commented Aug 22, 2018

@rafaelfranca it looks like a newer PR that does the same thing was reviewed instead. Did I do anything incorrectly when submitting?

@rafaelfranca
Copy link
Member

Urgh, sorry. I only saw the other one. But don't worry, I'll make sure you get credits for the change too.

Copy link
Contributor

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

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

Didn't see the PR so started on my own - found a couple things you may have missed.

@@ -14,7 +14,7 @@ class ERB
class_attribute :erb_implementation, default: Erubi

# Do not escape templates of these mime types.
class_attribute :escape_whitelist, default: ["text/plain"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is public, don't think we should just blanket change this. We can add

[self, singleton_class].each do |base|
  base.alias_method :escape_whitelist, :escape_allowlist
  base.alias_method :escape_whitelist=, :escape_allowlist=

  base.deprecate(
    escape_whitelist: 'use #escape_whitelist instead',
    :escape_whitelist= => 'use #escape_whitelist= instead'
  )
end

to deprecate until the next version

@@ -1200,7 +1200,7 @@ to the database as `NULL` instead of passing the `nil` value through YAML (`"---
* Rails 4.0 has removed `attr_accessible` and `attr_protected` feature in favor of Strong Parameters. You can use the [Protected Attributes gem](https://github.com/rails/protected_attributes) for a smooth upgrade path.

* If you are not using Protected Attributes, you can remove any options related to
this gem such as `whitelist_attributes` or `mass_assignment_sanitizer` options.
this gem such as `allowlist_attributes` or `mass_assignment_sanitizer` options.
Copy link
Contributor

Choose a reason for hiding this comment

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

This was a method at the time, so this shouldn't change.

@@ -888,7 +888,7 @@ do that with `local_variables`.

### Settings

* `config.web_console.whitelisted_ips`: Authorized list of IPv4 or IPv6
* `config.web_console.allowlisted_ips`: Authorized list of IPv4 or IPv6
Copy link
Contributor

Choose a reason for hiding this comment

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

These options are passed directly on to web console, and whitelisted_ips didn't change over there so this needs to stay the same.

@tiegz
Copy link
Contributor Author

tiegz commented Aug 23, 2018

Thanks for checking anyway @rafaelfranca @kddeisz ! Looks like most of the terminology discussion is going on in #33681 so I'll close this up.

@tiegz tiegz closed this Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants