Fix IDOR vulnerability in saved_views API (Fixes #1761)#2045
Open
YUVRAJ-SINGH-3178 wants to merge 1 commit into
Open
Fix IDOR vulnerability in saved_views API (Fixes #1761)#2045YUVRAJ-SINGH-3178 wants to merge 1 commit into
YUVRAJ-SINGH-3178 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey! This PR fixes the IDOR vulnerability reported in #1761.
Previously, anyone could mess with other users' saved views by guessing the view ID. To fix this, I completely locked down the
saved_viewsAPI so everything is strictly scoped to the authenticated user.Here's what I did:
owner_idcolumn to thesaved_viewstable and made theUNIQUEconstraint apply to(owner_id, name)instead of just globally on the name.database.pythat will upgrade the schema and backfill existing views to a default owner so older setups don't break.get_current_ownerauth dependency into all the routes insaved_views.pyand updated every single SQL query (SELECT, INSERT, UPDATE, DELETE) to useWHERE owner_id = ?.Users can now only touch their own stuff. Let me know if you want any changes!