Skip to content

Commit d45e863

Browse files
authored
Merge pull request #194 from supabase/fix/advisor-security-report
fix
2 parents 43e6c9c + 5b0f2d0 commit d45e863

File tree

6 files changed

+389
-461
lines changed

6 files changed

+389
-461
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
drop view if exists public.accounts;
2+
3+
create view
4+
public.accounts
5+
with
6+
(security_invoker = true) as
7+
select
8+
acc.id,
9+
acc.handle,
10+
obj.name as avatar_path,
11+
acc.display_name,
12+
acc.bio,
13+
acc.created_at
14+
from
15+
app.accounts acc
16+
left join storage.objects obj on acc.avatar_id = obj.id;
17+
18+
drop view if exists public.organizations;
19+
20+
create view
21+
public.organizations
22+
with
23+
(security_invoker = true) as
24+
select
25+
org.id,
26+
org.handle,
27+
obj.name as avatar_path,
28+
org.display_name,
29+
org.bio,
30+
org.created_at
31+
from
32+
app.organizations org
33+
left join storage.objects obj on org.avatar_id = obj.id;

website/data/database.types.ts

Lines changed: 223 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export type Json =
66
| { [key: string]: Json | undefined }
77
| Json[]
88

9-
export interface Database {
9+
export type Database = {
1010
graphql_public: {
1111
Tables: {
1212
[_ in never]: never
@@ -41,7 +41,6 @@ export interface Database {
4141
Row: {
4242
avatar_path: string | null
4343
bio: string | null
44-
contact_email: string | null
4544
created_at: string | null
4645
display_name: string | null
4746
handle: string | null
@@ -51,6 +50,7 @@ export interface Database {
5150
{
5251
foreignKeyName: 'accounts_id_fkey'
5352
columns: ['id']
53+
isOneToOne: true
5454
referencedRelation: 'users'
5555
referencedColumns: ['id']
5656
},
@@ -68,12 +68,14 @@ export interface Database {
6868
{
6969
foreignKeyName: 'downloads_package_id_fkey'
7070
columns: ['package_id']
71+
isOneToOne: false
7172
referencedRelation: 'packages'
7273
referencedColumns: ['id']
7374
},
7475
{
7576
foreignKeyName: 'downloads_package_id_fkey'
7677
columns: ['package_id']
78+
isOneToOne: false
7779
referencedRelation: 'packages'
7880
referencedColumns: ['id']
7981
},
@@ -102,24 +104,28 @@ export interface Database {
102104
{
103105
foreignKeyName: 'members_account_id_fkey'
104106
columns: ['account_id']
107+
isOneToOne: false
105108
referencedRelation: 'accounts'
106109
referencedColumns: ['id']
107110
},
108111
{
109112
foreignKeyName: 'members_account_id_fkey'
110113
columns: ['account_id']
114+
isOneToOne: false
111115
referencedRelation: 'accounts'
112116
referencedColumns: ['id']
113117
},
114118
{
115119
foreignKeyName: 'members_organization_id_fkey'
116120
columns: ['organization_id']
121+
isOneToOne: false
117122
referencedRelation: 'organizations'
118123
referencedColumns: ['id']
119124
},
120125
{
121126
foreignKeyName: 'members_organization_id_fkey'
122127
columns: ['organization_id']
128+
isOneToOne: false
123129
referencedRelation: 'organizations'
124130
referencedColumns: ['id']
125131
},
@@ -129,7 +135,6 @@ export interface Database {
129135
Row: {
130136
avatar_path: string | null
131137
bio: string | null
132-
contact_email: string | null
133138
created_at: string | null
134139
display_name: string | null
135140
handle: string | null
@@ -152,12 +157,14 @@ export interface Database {
152157
{
153158
foreignKeyName: 'package_upgrades_package_id_fkey'
154159
columns: ['package_id']
160+
isOneToOne: false
155161
referencedRelation: 'packages'
156162
referencedColumns: ['id']
157163
},
158164
{
159165
foreignKeyName: 'package_upgrades_package_id_fkey'
160166
columns: ['package_id']
167+
isOneToOne: false
161168
referencedRelation: 'packages'
162169
referencedColumns: ['id']
163170
},
@@ -180,12 +187,14 @@ export interface Database {
180187
{
181188
foreignKeyName: 'package_versions_package_id_fkey'
182189
columns: ['package_id']
190+
isOneToOne: false
183191
referencedRelation: 'packages'
184192
referencedColumns: ['id']
185193
},
186194
{
187195
foreignKeyName: 'package_versions_package_id_fkey'
188196
columns: ['package_id']
197+
isOneToOne: false
189198
referencedRelation: 'packages'
190199
referencedColumns: ['id']
191200
},
@@ -209,6 +218,7 @@ export interface Database {
209218
{
210219
foreignKeyName: 'packages_handle_fkey'
211220
columns: ['handle']
221+
isOneToOne: false
212222
referencedRelation: 'handle_registry'
213223
referencedColumns: ['handle']
214224
},
@@ -443,11 +453,107 @@ export interface Database {
443453
{
444454
foreignKeyName: 'objects_bucketId_fkey'
445455
columns: ['bucket_id']
456+
isOneToOne: false
446457
referencedRelation: 'buckets'
447458
referencedColumns: ['id']
448459
},
449460
]
450461
}
462+
s3_multipart_uploads: {
463+
Row: {
464+
bucket_id: string
465+
created_at: string
466+
id: string
467+
in_progress_size: number
468+
key: string
469+
owner_id: string | null
470+
upload_signature: string
471+
version: string
472+
}
473+
Insert: {
474+
bucket_id: string
475+
created_at?: string
476+
id: string
477+
in_progress_size?: number
478+
key: string
479+
owner_id?: string | null
480+
upload_signature: string
481+
version: string
482+
}
483+
Update: {
484+
bucket_id?: string
485+
created_at?: string
486+
id?: string
487+
in_progress_size?: number
488+
key?: string
489+
owner_id?: string | null
490+
upload_signature?: string
491+
version?: string
492+
}
493+
Relationships: [
494+
{
495+
foreignKeyName: 's3_multipart_uploads_bucket_id_fkey'
496+
columns: ['bucket_id']
497+
isOneToOne: false
498+
referencedRelation: 'buckets'
499+
referencedColumns: ['id']
500+
},
501+
]
502+
}
503+
s3_multipart_uploads_parts: {
504+
Row: {
505+
bucket_id: string
506+
created_at: string
507+
etag: string
508+
id: string
509+
key: string
510+
owner_id: string | null
511+
part_number: number
512+
size: number
513+
upload_id: string
514+
version: string
515+
}
516+
Insert: {
517+
bucket_id: string
518+
created_at?: string
519+
etag: string
520+
id?: string
521+
key: string
522+
owner_id?: string | null
523+
part_number: number
524+
size?: number
525+
upload_id: string
526+
version: string
527+
}
528+
Update: {
529+
bucket_id?: string
530+
created_at?: string
531+
etag?: string
532+
id?: string
533+
key?: string
534+
owner_id?: string | null
535+
part_number?: number
536+
size?: number
537+
upload_id?: string
538+
version?: string
539+
}
540+
Relationships: [
541+
{
542+
foreignKeyName: 's3_multipart_uploads_parts_bucket_id_fkey'
543+
columns: ['bucket_id']
544+
isOneToOne: false
545+
referencedRelation: 'buckets'
546+
referencedColumns: ['id']
547+
},
548+
{
549+
foreignKeyName: 's3_multipart_uploads_parts_upload_id_fkey'
550+
columns: ['upload_id']
551+
isOneToOne: false
552+
referencedRelation: 's3_multipart_uploads'
553+
referencedColumns: ['id']
554+
},
555+
]
556+
}
451557
}
452558
Views: {
453559
[_ in never]: never
@@ -478,7 +584,7 @@ export interface Database {
478584
Args: {
479585
name: string
480586
}
481-
Returns: unknown
587+
Returns: string[]
482588
}
483589
get_size_by_bucket: {
484590
Args: Record<PropertyKey, never>
@@ -487,6 +593,37 @@ export interface Database {
487593
bucket_id: string
488594
}[]
489595
}
596+
list_multipart_uploads_with_delimiter: {
597+
Args: {
598+
bucket_id: string
599+
prefix_param: string
600+
delimiter_param: string
601+
max_keys?: number
602+
next_key_token?: string
603+
next_upload_token?: string
604+
}
605+
Returns: {
606+
key: string
607+
id: string
608+
created_at: string
609+
}[]
610+
}
611+
list_objects_with_delimiter: {
612+
Args: {
613+
bucket_id: string
614+
prefix_param: string
615+
delimiter_param: string
616+
max_keys?: number
617+
start_after?: string
618+
next_token?: string
619+
}
620+
Returns: {
621+
name: string
622+
id: string
623+
metadata: Json
624+
updated_at: string
625+
}[]
626+
}
490627
search: {
491628
Args: {
492629
prefix: string
@@ -516,3 +653,85 @@ export interface Database {
516653
}
517654
}
518655
}
656+
657+
type PublicSchema = Database[Extract<keyof Database, 'public'>]
658+
659+
export type Tables<
660+
PublicTableNameOrOptions extends
661+
| keyof (PublicSchema['Tables'] & PublicSchema['Views'])
662+
| { schema: keyof Database },
663+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
664+
? keyof (Database[PublicTableNameOrOptions['schema']]['Tables'] &
665+
Database[PublicTableNameOrOptions['schema']]['Views'])
666+
: never = never,
667+
> = PublicTableNameOrOptions extends { schema: keyof Database }
668+
? (Database[PublicTableNameOrOptions['schema']]['Tables'] &
669+
Database[PublicTableNameOrOptions['schema']]['Views'])[TableName] extends {
670+
Row: infer R
671+
}
672+
? R
673+
: never
674+
: PublicTableNameOrOptions extends keyof (PublicSchema['Tables'] &
675+
PublicSchema['Views'])
676+
? (PublicSchema['Tables'] &
677+
PublicSchema['Views'])[PublicTableNameOrOptions] extends {
678+
Row: infer R
679+
}
680+
? R
681+
: never
682+
: never
683+
684+
export type TablesInsert<
685+
PublicTableNameOrOptions extends
686+
| keyof PublicSchema['Tables']
687+
| { schema: keyof Database },
688+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
689+
? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
690+
: never = never,
691+
> = PublicTableNameOrOptions extends { schema: keyof Database }
692+
? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
693+
Insert: infer I
694+
}
695+
? I
696+
: never
697+
: PublicTableNameOrOptions extends keyof PublicSchema['Tables']
698+
? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
699+
Insert: infer I
700+
}
701+
? I
702+
: never
703+
: never
704+
705+
export type TablesUpdate<
706+
PublicTableNameOrOptions extends
707+
| keyof PublicSchema['Tables']
708+
| { schema: keyof Database },
709+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
710+
? keyof Database[PublicTableNameOrOptions['schema']]['Tables']
711+
: never = never,
712+
> = PublicTableNameOrOptions extends { schema: keyof Database }
713+
? Database[PublicTableNameOrOptions['schema']]['Tables'][TableName] extends {
714+
Update: infer U
715+
}
716+
? U
717+
: never
718+
: PublicTableNameOrOptions extends keyof PublicSchema['Tables']
719+
? PublicSchema['Tables'][PublicTableNameOrOptions] extends {
720+
Update: infer U
721+
}
722+
? U
723+
: never
724+
: never
725+
726+
export type Enums<
727+
PublicEnumNameOrOptions extends
728+
| keyof PublicSchema['Enums']
729+
| { schema: keyof Database },
730+
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
731+
? keyof Database[PublicEnumNameOrOptions['schema']]['Enums']
732+
: never = never,
733+
> = PublicEnumNameOrOptions extends { schema: keyof Database }
734+
? Database[PublicEnumNameOrOptions['schema']]['Enums'][EnumName]
735+
: PublicEnumNameOrOptions extends keyof PublicSchema['Enums']
736+
? PublicSchema['Enums'][PublicEnumNameOrOptions]
737+
: never

website/lib/validations.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const SignUpSchema = z.object({
2121
export const UpdateProfileSchema = z.object({
2222
displayName,
2323
handle,
24-
contactEmail: email.or(z.literal('')),
2524
bio: z.string().max(255),
2625
})
2726

0 commit comments

Comments
 (0)