Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Security hole - it might be possible to get a list of all id's for a model #45

Open

Description

@catmando

this

cache_item.build_new_cache_item(cache_item.value.collect { |record| record.id }, method, method)

reads every id, but is not protected by the check_permission_with_acting_user method

it should read:

collection = cache_item.value.collect do |record| 
  record.check_permission_with_acting_user(@acting_user, :view_permitted?, :id)
  record.id
end
cache_item.build_new_cache_item(collection, method, method)

Similar to #43 .

Hopefully adding that line will not kill performance!

Activity

  1. added this to the Release 0.15 milestone on Dec 13, 2017
  2. catmando commented on Dec 13, 2017

    @catmando
    ContributorAuthor

    Be aware however that any record that has ANY attribute accessible to a channel will automatically be grant access of the id to that channel. This is to allow push synchronization. So for example if my User instance channel has access to the user's name (for example) then each user will also have access to the :id of each record that belongs to them.

    I don't think this is an issue FYI... but if it is then we would have to implement an optional encryption of the id before transmission (and decryption after reception.) I would make optional so that if you are not worried about it you don't have to pay for the encrypt/decrypt overhead. Also would probably be handy during development not to encyrpt/decrypt the ids.

  3. catmando commented on Dec 13, 2017

    @catmando
    ContributorAuthor

    FYI aggregations might have a similar problem, however i think we should just Make a caveat, as those things are so hard to deal with. I would rather we just had a config switch that turned them off.

  4. janbiedermann commented on Dec 14, 2017

    @janbiedermann
    Contributor

    Thanks for generously assigning this to me. I will immediately put it, in bold, to make sure of its importance, on my hyperloop todo list. To fix it ASAP, i put it at the end of the list, so it will be the first item after all the other items on my list.

  5. catmando commented on Dec 14, 2017

    @catmando
    ContributorAuthor

    :-)

  6. catmando commented on Dec 14, 2017

    @catmando
    ContributorAuthor

    I'll try to get done as well

  7. catmando commented on Dec 14, 2017

    @catmando
    ContributorAuthor

    @janbiedermann sorry abt assigning problem. Fix should be just as shown, but I am concerned about perf impact. You r kind of master if that. If you check it out perf wise I will do test cases etc.

  8. janbiedermann commented on Dec 29, 2017

    @janbiedermann
    Contributor

    in progress. So far:

    lib/active_record_base.rb:

    • added def hyper_model_scopes
    • added def server_methods

    lib/reactive_record/permissions.rb

    • moved Hyperloop::InternalPolicy to lib/hyperloop/internal_policy.rb
    • moved ReactiveRecord::AccessViolation to lib/reactive_record/access_violation.rb

    (hyper-mesh.rb modified accordingly)

    lib/hyperloop/internal_policy.rb
    added:

    • def self.guard_root_fetch_method!(model, method)
      => true|ReactiveRecord::AccessViolation
    • def self.guard_record_fetch_method!(record, method)
      => true|ReactiveRecord::AccessViolation
    • def self.guard_relation_fetch_method!(relation, method)
      => true|ReactiveRecord::AccessViolation
    • def self.raise_access_violation

    added in lib/reactive_record/proxy

    • attribute_node.rb
      class AttributeNode
      a = ReactiveRecord::Proxy::AttributeNode.new(record, attribute, value)
      a.value(Rails)
      param: must pass Rails object to ensure local call
      => value|ReactiveRecord::AccessViolation
    • record_node.rb
      r = ReactiveRecord::Proxy::RecordNode.new(record, acting_user)
    • relation_node.rb
      r = ReactiveRecord::Proxy::RelationNode.new(relation, acting_user)
    • root_node.rb
      r = ReactiveRecord::Proxy::RootNode.new(model_name, acting_user)

    Proxy Interface may change slightly with further progress, maybe.

    added lib/reactive_record/graph.rb
    class ReactiveRecord::Graph < BasicObject
    class Node < BasicObject internal to Graph
    interface still in flux

    Ill update this to keep track.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions