8000 Update tutorial revoking function execution permission from public by kenips · Pull Request #419 · graphile/crystal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update tutorial revoking function execution permission from public #419

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

Merged
merged 1 commit into from
Mar 30, 2017

Conversation

kenips
Copy link
Contributor
@kenips kenips commented Mar 30, 2017

Fixes #416

@kenips kenips force-pushed the bug/default_execution branch 2 times, most recently from 5242d39 to 3957c7b Compare March 30, 2017 16:03
4. `grant select ...` and `grant insert, update, delete ...`: We do the same thing with these two grants as we did with the grants above. The only difference her 8000 e is that we also give signed in users the ability to `insert` into `forum_example.post`. We do not allow anyone to insert directly into `forum_example.person`, instead users should use the `forum_example.register_person` function.
5. `grant usage on sequence forum_example.post_id_seq to forum_example_person`: When a user creates a new `forum_example.post` they will also need to get the next value in the `forum_example.post_id_seq` because we use the `serial` data type for the `id` column. A sequence also exists for our person table (`forum_example.person_id_seq`), but since we are only creating people through `forum_example.register_person` and that function specifies `security definer`, we don’t need to grant access to the person id sequence.
6. `grant execute ...`: We have to give the anonymous user and logged in users access to all of the Postgres functions we define. All of the functions are executable by both types of users, except `forum_example.register_person` which we only let anonymous users execute. There’s no need for logged in users to register a new user!
1. `alter default privileges ...`: By default, functions can be executable by public. Since we're applying our fine-grained control over function permissions here, we remove the default grant. Note that this line needs to be placed before any function defition.
Copy link
Member

Choose a reason for hiding this comment

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

*definition

Copy link
Member
@benjie benjie left a comment

Choose a reason for hiding this comment

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

One tiny nit, then good to go 👍

@kenips kenips force-pushed the bug/default_execution branch from 3957c7b to a63fe5c Compare March 30, 2017 17:16
@kenips
Copy link
Contributor Author
kenips commented Mar 30, 2017

Thanks! Fixed.

@benjie benjie merged commit b8b3f96 into graphile:master Mar 30, 2017
@kenips kenips deleted the bug/default_execution branch March 31, 2017 18:11
@calebmer
Copy link
Collaborator
calebmer commented Apr 1, 2017

Thanks so much! It may be worth noting for the future that the TUTORIAL.md file builds into the schema file that we recommend people execute with the build-schema script. It would be interesting to see how this change effects the built schema 😊

Belline pushed a commit to Belline/postgraphql that referenced this pull request Dec 18, 2017
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.

3 participants
0