Fix security warnings in migration

- Change security settings for views to SECURITY INVOKER
- Add explicit search_path in cleanup_old_spans function
- Ensure safe, non-deferring access to trace views and cleanup routine
This commit is contained in:
gpt-engineer-app[bot]
2025-11-11 04:24:38 +00:00
parent ca6e95f4f8
commit 177eb540a8
2 changed files with 419 additions and 0 deletions

View File

@@ -3520,6 +3520,60 @@ export type Database = {
}
Relationships: []
}
request_spans: {
Row: {
created_at: string
duration_ms: number | null
end_time: string | null
error_message: string | null
error_stack: string | null
error_type: string | null
id: string
kind: string
name: string
parent_span_id: string | null
request_id: string | null
span_id: string
start_time: string
status: string
trace_id: string
}
Insert: {
created_at?: string
duration_ms?: number | null
end_time?: string | null
error_message?: string | null
error_stack?: string | null
error_type?: string | null
id?: string
kind: string
name: string
parent_span_id?: string | null
request_id?: string | null
span_id: string
start_time: string
status?: string
trace_id: string
}
Update: {
created_at?: string
duration_ms?: number | null
end_time?: string | null
error_message?: string | null
error_stack?: string | null
error_type?: string | null
id?: string
kind?: string
name?: string
parent_span_id?: string | null
request_id?: string | null
span_id?: string
start_time?: string
status?: string
trace_id?: string
}
Relationships: []
}
review_deletions: {
Row: {
content: string | null
@@ -5404,6 +5458,111 @@ export type Database = {
},
]
}
span_attributes: {
Row: {
created_at: string
id: string
key: string
span_id: string
value: string
value_type: string
}
Insert: {
created_at?: string
id?: string
key: string
span_id: string
value: string
value_type?: string
}
Update: {
created_at?: string
id?: string
key?: string
span_id?: string
value?: string
value_type?: string
}
Relationships: [
{
foreignKeyName: "span_attributes_span_id_fkey"
columns: ["span_id"]
isOneToOne: false
referencedRelation: "request_spans"
referencedColumns: ["span_id"]
},
]
}
span_event_attributes: {
Row: {
created_at: string
id: string
key: string
span_event_id: string
value: string
value_type: string
}
Insert: {
created_at?: string
id?: string
key: string
span_event_id: string
value: string
value_type?: string
}
Update: {
created_at?: string
id?: string
key?: string
span_event_id?: string
value?: string
value_type?: string
}
Relationships: [
{
foreignKeyName: "span_event_attributes_span_event_id_fkey"
columns: ["span_event_id"]
isOneToOne: false
referencedRelation: "span_events"
referencedColumns: ["id"]
},
]
}
span_events: {
Row: {
created_at: string
id: string
name: string
sequence_order: number
span_id: string
timestamp: string
}
Insert: {
created_at?: string
id?: string
name: string
sequence_order: number
span_id: string
timestamp: string
}
Update: {
created_at?: string
id?: string
name?: string
sequence_order?: number
span_id?: string
timestamp?: string
}
Relationships: [
{
foreignKeyName: "span_events_span_id_fkey"
columns: ["span_id"]
isOneToOne: false
referencedRelation: "request_spans"
referencedColumns: ["span_id"]
},
]
}
submission_dependencies: {
Row: {
child_entity_type: string
@@ -6439,6 +6598,34 @@ export type Database = {
}
Relationships: []
}
span_hierarchy: {
Row: {
depth: number | null
duration_ms: number | null
kind: string | null
name: string | null
parent_span_id: string | null
path: string[] | null
span_id: string | null
start_time: string | null
status: string | null
trace_id: string | null
}
Relationships: []
}
trace_summary: {
Row: {
error_count: number | null
span_count: number | null
span_ids: string[] | null
span_names: string[] | null
total_duration_ms: number | null
trace_end: string | null
trace_id: string | null
trace_start: string | null
}
Relationships: []
}
}
Functions: {
anonymize_user_submissions: {
@@ -6540,6 +6727,7 @@ export type Database = {
}
cleanup_old_page_views: { Args: never; Returns: undefined }
cleanup_old_request_metadata: { Args: never; Returns: undefined }
cleanup_old_spans: { Args: never; Returns: number }
cleanup_old_submissions: {
Args: { p_retention_days?: number }
Returns: {