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

Fix/billing report security #1175

Merged
merged 4 commits into from
Sep 5, 2023
Merged

Fix/billing report security #1175

merged 4 commits into from
Sep 5, 2023

Conversation

jshearer
Copy link
Contributor

@jshearer jshearer commented Sep 1, 2023

Description:

The only actual change to the billing report is to use current_setting('role') instead of session_role to check the role of the caller outside of security definer.

This also updates run_sql_tests.sh to return a non-zero exit code on test failure so we can fail the CI run when we break SQL tests in the future.

NOTE: not to be merged quite yet, I put an artificial failure in there to make sure the CI run fails as expected.
CI failure works as expected!


This change is Reviewable

Copy link
Member

@psFried psFried left a comment

Choose a reason for hiding this comment

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

LGTM

supabase/run_sql_tests.sh Outdated Show resolved Hide resolved
@@ -0,0 +1,166 @@
begin;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need to explicitly begin/commit transactions in migrations, since the supabase cli would do that already. Unless I'm missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I was just copying the other migrations that seemed to all say

-- Always use a transaction, y'all.
begin;

at the top, though I am seeing some that don't have it... do you feel strongly that it should be removed? If not I think it's probably marginally safer to keep it

Copy link
Member

Choose a reason for hiding this comment

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

I usually apply them with psql, so it's good practice imo. Postgres doesn't mind if they're nested. Also I'm 70% that supabase doesn't wrap in a txn.

@jshearer jshearer merged commit d0e947d into master Sep 5, 2023
3 checks passed
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