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

Can't overwrite policy? #398

Open
cgrimm013 opened this issue May 21, 2018 · 2 comments
Open

Can't overwrite policy? #398

cgrimm013 opened this issue May 21, 2018 · 2 comments

Comments

@cgrimm013
Copy link
Contributor

While debugging subscriptions, I found that I cannot overwrite an existing policy for a pico without explicitly deleting the policy. Even though our most recent subscription code changes pass all the tests, somehow policies are not included in the tests, which I discovered was breaking the code (I didn't alter the wellknown policy to include some event name changes). When I tried reregistering and reinstalling the subscription ruleset, the updated policy does not get created on an already existing pico. Take a look at this:

uploads/85bec3ca-7437-4a2c-9837-7c9bcd68d2ef/Screen Shot 2018-05-21 at 11.08.07 AM.png

This is on the root pico. Essentially, calling engine:newPolicy does not overwrite an existing policy, so the wellknown policy stays the same and doesn't get my new changes. Is this the desired functionality? It registers a new policy per pico under the name, but there is no way to change it save for explicitly calling engine:removePolicy. Maybe we could add an engine:updatePolicy action? How do we restrict developers so they can only update their own policies?

One security hole with this current problem: a ruleset could create a new policy called wellknown that allows every event. Then when subscriptions is installed, it will use the falsified policy instead of its intended one.. Maybe we could have system policies reserved so no one else can make one with the same name and mess something up? (the terminal could log an error for trying to register a policy with a system policy name)

@cgrimm013
Copy link
Contributor Author

Also, let's say I'm a developer and make some new events or otherwise I want others with that policy to be able to raise. I don't want to have to call removePolicy, then newPolicy, then reissue subscriptions for everyone that had that policy just to be able to make an update to my code..

@b1conrad
Copy link
Member

Maybe we need something like wrangler:updatePolicy an event with attributes eci, policy_id which would replace the current policy in the designated channel with the policy_id provided. on success, it would raise wrangler:channel_policy_updated with original attributes and an additional former_policy_id. This would be added to the io.picolabs.wrangler ruleset as a KRL rule. It would require an engine action
(got this from a classic page at https://picolabs.atlassian.net/wiki/spaces/docs/pages/11403288/Managing+Channels )

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

No branches or pull requests

2 participants