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

Improve security in TagController show/update/delete methods #643

Closed
reichert621 opened this issue Mar 16, 2021 · 1 comment
Closed

Improve security in TagController show/update/delete methods #643

reichert621 opened this issue Mar 16, 2021 · 1 comment
Assignees
Labels
backend bug Something isn't working elixir good first issue Good for newcomers

Comments

@reichert621
Copy link
Collaborator

Problem
Right now any user with a valid auth token can retrieve any tag resource as long as they know the ID of the resource. We should return a 404 (Not found) error if someone tries to retrieve/update/delete a resource that does not have a matching account_id

Solution
In the show, update, and delete methods of the tag controller, let's add an authorize plug (middleware) to handle this.

Check out #639 for an example

Describe alternatives you've considered
We could also just include the account_id in the query when we fetch the resource 🤷

Testing
Please add/update tests to take these updates into account!

Questions, or need help getting started?
Feel free to ask below, or ping us on Slack :)

(You can also check out our CONTRIBUTING.md)

@reichert621 reichert621 added bug Something isn't working good first issue Good for newcomers backend elixir labels Mar 16, 2021
@a8t
Copy link
Contributor

a8t commented Mar 16, 2021

I can do this one too, assuming my other PR is approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend bug Something isn't working elixir good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants