Skip to content

Commit c79146e

Browse files
committed
chore: make unique ami name
2 parents 6668758 + 792a59c commit c79146e

File tree

16 files changed

+156
-138
lines changed

16 files changed

+156
-138
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
EXTENSIONS_TO_DISABLE=(
1313
"pg_graphql"
1414
"pg_stat_monitor"
15+
"pg_backtrace"
1516
)
1617

1718
PG14_EXTENSIONS_TO_DISABLE=(
@@ -217,6 +218,7 @@ function initiate_upgrade {
217218
SHARED_PRELOAD_LIBRARIES=$(echo "$SHARED_PRELOAD_LIBRARIES" | sed "s/pg_net//" | xargs)
218219
SHARED_PRELOAD_LIBRARIES=$(echo "$SHARED_PRELOAD_LIBRARIES" | sed "s/check_role_membership//" | xargs)
219220
SHARED_PRELOAD_LIBRARIES=$(echo "$SHARED_PRELOAD_LIBRARIES" | sed "s/safeupdate//" | xargs)
221+
SHARED_PRELOAD_LIBRARIES=$(echo "$SHARED_PRELOAD_LIBRARIES" | sed "s/pg_backtrace//" | xargs)
220222

221223
# Exclude empty-string entries, as well as leading/trailing commas and spaces resulting from the above lib exclusions
222224
# i.e. " , pg_stat_statements, , pgsodium, " -> "pg_stat_statements, pgsodium"

ansible/files/envoy_config/lds.supabase.yaml

Lines changed: 4 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -37,51 +37,6 @@ resources:
3737
rules:
3838
action: DENY
3939
policies:
40-
api_key_missing:
41-
permissions:
42-
- any: true
43-
principals:
44-
- not_id:
45-
or_ids:
46-
ids:
47-
- header:
48-
name: apikey
49-
present_match: true
50-
- header:
51-
name: ':path'
52-
string_match:
53-
contains: apikey=
54-
api_key_not_valid:
55-
permissions:
56-
- any: true
57-
principals:
58-
- not_id:
59-
or_ids:
60-
ids:
61-
- header:
62-
name: apikey
63-
string_match:
64-
exact: anon_key
65-
- header:
66-
name: apikey
67-
string_match:
68-
exact: service_key
69-
- header:
70-
name: apikey
71-
string_match:
72-
exact: supabase_admin_key
73-
- header:
74-
name: ':path'
75-
string_match:
76-
contains: apikey=anon_key
77-
- header:
78-
name: ':path'
79-
string_match:
80-
contains: apikey=service_key
81-
- header:
82-
name: ':path'
83-
string_match:
84-
contains: apikey=supabase_admin_key
8540
origin_protection_key_missing:
8641
permissions:
8742
- any: true
@@ -234,6 +189,10 @@ resources:
234189
prefix: /metrics/aggregated
235190
invert_match: true
236191
status_code: 401
192+
headers_to_add:
193+
- header:
194+
key: x-sb-error-code
195+
value: '%RESPONSE_CODE_DETAILS%'
237196
body_format_override:
238197
json_format:
239198
message: >-
@@ -383,24 +342,6 @@ resources:
383342
route:
384343
cluster: admin_api
385344
prefix_rewrite: /privileged/
386-
typed_per_filter_config:
387-
envoy.filters.http.rbac:
388-
'@type': >-
389-
type.googleapis.com/envoy.extensions.filters.http.rbac.v3.RBACPerRoute
390-
rbac:
391-
rules:
392-
action: DENY
393-
policies:
394-
basic_auth:
395-
permissions:
396-
- any: true
397-
principals:
398-
- header:
399-
name: authorization
400-
invert_match: true
401-
string_match:
402-
exact: Basic c2VydmljZV9yb2xlOnNlcnZpY2Vfa2V5
403-
treat_missing_header_as_empty: true
404345
- match:
405346
prefix: /metrics/aggregated
406347
request_headers_to_remove:

ansible/files/envoy_config/lds.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ resources:
215215
prefix: /metrics/aggregated
216216
invert_match: true
217217
status_code: 401
218+
headers_to_add:
219+
- header:
220+
key: x-sb-error-code
221+
value: '%RESPONSE_CODE_DETAILS%'
218222
body_format_override:
219223
json_format:
220224
message: >-

ansible/vars.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ postgres_major:
88

99
# Full version strings for each major version
1010
postgres_release:
11-
postgresorioledb-17: "17.0.1.040-orioledb-bo"
12-
postgres15: "15.8.1.045-bo"
11+
postgresorioledb-17: "17.0.1.042-orioledb-wrapper"
12+
postgres15: "15.8.1.049-wrapper"
1313

1414
# Non Postgres Extensions
1515
pgbouncer_release: "1.19.0"

ebssurrogate/scripts/qemu-bootstrap-nix.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,6 @@ function clean_system {
143143

144144
install_nix
145145
execute_stage2_playbook
146+
# we do not want to ship an initialized DB as this is performed as needed
147+
rm -rf /data/pgdata
146148
cloud-init clean --logs

flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@
125125
./nix/ext/postgis.nix
126126
./nix/ext/pgrouting.nix
127127
./nix/ext/pgtap.nix
128-
./nix/ext/pg_backtrace.nix
129128
./nix/ext/pg_cron.nix
130129
./nix/ext/pgsql-http.nix
131130
./nix/ext/pg_plan_filter.nix

migrations/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,18 @@ Additionally, [supabase/postgres](https://github.com/supabase/postgres/blob/deve
7878

7979
### Add a Migration
8080

81+
First, start a local postgres server and apply the migrations
82+
8183
```shell
8284
# Start the database server
83-
docker-compose up
85+
nix run .#dbmate-tool -- --version 15 --flake-url "."
8486

8587
# create a new migration
88+
nix develop
8689
dbmate new '<some message>'
8790
```
8891

89-
Then, populate the migration at `./db/migrations/xxxxxxxxx_<some_message>` and make sure it execute sucessfully with
92+
Then, execute the migration at `./db/migrations/xxxxxxxxx_<some_message>` and make sure it runs sucessfully with
9093

9194
```shell
9295
dbmate up
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
-- migrate:up
2+
do $$
3+
declare
4+
ext_schema text;
5+
extensions_schema_exists boolean;
6+
begin
7+
-- check if the "extensions" schema exists
8+
select exists (
9+
select 1 from pg_namespace where nspname = 'extensions'
10+
) into extensions_schema_exists;
11+
12+
if extensions_schema_exists then
13+
-- check if the "orioledb" extension is in the "public" schema
14+
select nspname into ext_schema
15+
from pg_extension e
16+
join pg_namespace n on e.extnamespace = n.oid
17+
where extname = 'orioledb';
18+
19+
if ext_schema = 'public' then
20+
execute 'alter extension orioledb set schema extensions';
21+
end if;
22+
end if;
23+
end $$;
24+
25+
-- migrate:down
26+

migrations/schema-orioledb-17.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ CREATE SCHEMA vault;
9191
-- Name: orioledb; Type: EXTENSION; Schema: -; Owner: -
9292
--
9393

94-
CREATE EXTENSION IF NOT EXISTS orioledb WITH SCHEMA public;
94+
CREATE EXTENSION IF NOT EXISTS orioledb WITH SCHEMA extensions;
9595

9696

9797
--

nix/tests/expected/security.out

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
-- get a list of security definer functions owned by supabase_admin
2+
-- this list should be vetted to ensure the functions are safe to use as security definer
3+
select
4+
n.nspname, p.proname
5+
from pg_catalog.pg_proc p
6+
left join pg_catalog.pg_namespace n ON n.oid = p.pronamespace
7+
where p.proowner = (select oid from pg_catalog.pg_roles where rolname = 'supabase_admin')
8+
and p.prosecdef = true
9+
order by 1,2;
10+
nspname | proname
11+
----------+--------------------------------
12+
graphql | get_schema_version
13+
graphql | increment_schema_version
14+
pgsodium | disable_security_label_trigger
15+
pgsodium | enable_security_label_trigger
16+
pgsodium | get_key_by_id
17+
pgsodium | get_key_by_name
18+
pgsodium | get_named_keys
19+
pgsodium | mask_role
20+
pgsodium | update_mask
21+
public | dblink_connect_u
22+
public | dblink_connect_u
23+
public | pgaudit_ddl_command_end
24+
public | pgaudit_sql_drop
25+
public | st_estimatedextent
26+
public | st_estimatedextent
27+
public | st_estimatedextent
28+
repack | repack_trigger
29+
(17 rows)
30+

0 commit comments

Comments
 (0)