|
5 | 5 | ------+-------+-------+--------+------------+-------------+--------+-------------+----------+-----------
|
6 | 6 | (0 rows)
|
7 | 7 |
|
8 |
| - -- Note: We cannot easily create a test that shows outdated extensions |
9 |
| - -- because we cannot install older versions of extensions in a test environment. |
10 |
| - -- Our test image doesn't have multiple extension versions available. |
11 |
| - -- The test will primarily verify that the query executes without error |
12 |
| - -- and returns the expected column structure. |
13 |
| - -- This lint was tested manually with real outdated extensions. |
| 8 | + create extension amcheck version '1.0'; |
14 | 9 | -- Verify the query structure and column names
|
15 | 10 | select
|
16 | 11 | count(*) as total_outdated_extensions
|
17 | 12 | from lint."0022_extension_versions_outdated";
|
18 | 13 | total_outdated_extensions
|
19 | 14 | ---------------------------
|
20 |
| - 0 |
| 15 | + 1 |
21 | 16 | (1 row)
|
22 | 17 |
|
23 | 18 | -- Test that the query returns proper column structure
|
24 | 19 | -- This will help ensure the lint is properly formed
|
| 20 | + select |
| 21 | + name, |
| 22 | + title, |
| 23 | + level, |
| 24 | + facing, |
| 25 | + categories, |
| 26 | + description, |
| 27 | + detail, |
| 28 | + remediation, |
| 29 | + metadata, |
| 30 | + cache_key |
| 31 | + from lint."0022_extension_versions_outdated"; |
| 32 | + name | title | level | facing | categories | description | detail | remediation | metadata | cache_key |
| 33 | +-----------------------------+-----------------------------+-------+----------+------------+--------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------------------------- |
| 34 | + extension_versions_outdated | Extension Versions Outdated | WARN | EXTERNAL | {SECURITY} | Detects extensions that are not using the default (recommended) version. | Extension `amcheck` is using version `1.0` but version `1.3` is available. Using outdated extension versions may expose the database to security vulnerabilities. | https://supabase.com/docs/guides/database/database-linter?lint=0022_extension_versions_outdated | {"extension_name": "amcheck", "default_version": "1.3", "installed_version": "1.0"} | extension_versions_outdated_amcheck_1.0 |
| 35 | +(1 row) |
| 36 | + |
| 37 | + drop extension amcheck; |
| 38 | + |
| 39 | + -- Versions that aren't in pg_available_extension_versions are ignored |
| 40 | + create extension amcheck; |
| 41 | + update pg_extension set extversion = 'foo' where extname = 'amcheck'; |
25 | 42 | select
|
26 | 43 | name,
|
27 | 44 | title,
|
|
38 | 55 | ------+-------+-------+--------+------------+-------------+--------+-------------+----------+-----------
|
39 | 56 | (0 rows)
|
40 | 57 |
|
| 58 | + drop extension amcheck; |
41 | 59 | rollback;
|
0 commit comments