Commit bf258dd
authored
fix(server): force USE_SSL=false on the S3 secret when cache proxy is set (#526)
The previous "force plaintext HTTP" mechanism — three SET GLOBAL
statements at session level — was based on a misread of duckdb-httpfs
behaviour. The code comment claimed DuckDB ignored secret settings and
tunnelled HTTPS for AWS endpoints; what's actually happening is the
inverse:
// duckdb-httpfs/src/include/s3fs.hpp:30-38
template <class TYPE>
SettingLookupResult TryGetSecretKeyOrSetting(...) {
Value temp_result;
auto setting_scope = reader.TryGetSecretKeyOrSetting(...);
if (!temp_result.IsNull() &&
!(setting_scope.GetScope() == SettingScope::GLOBAL
&& !use_env_variables_for_secret_settings)) {
result = temp_result.GetValue<TYPE>();
}
return setting_scope;
}
DuckDB explicitly *drops* GLOBAL-scope settings when reading the s3
secret's use_ssl / url_style, unless the env-var-for-secret-settings
flag is enabled. So `SET GLOBAL s3_use_ssl = false` was a no-op on the
secret-backed S3 path. Reads happened to render as HTTP because
DuckLake's parquet read path consults the *raw* http_proxy setting and
session-level URL form — different code, doesn't read the secret. Writes
go through the full s3fs path which honours the secret, gets
use_ssl=true, and tunnels via HTTPS CONNECT — invisible to the cache
proxy except as opaque byte counts.
Operationally that meant every parquet write produced zero
forward-proxy log lines and an upstream-rejected write surfaced only as
a generic DuckDB-side "HTTP code 501" with no proxy-side breadcrumb to
correlate against.
Fix: embed USE_SSL=false / URL_STYLE='path' on the secret itself when
HTTPProxy is set, in all three secret builders (config, credential
chain, AWS SDK). resolveS3SecretTransport centralises the decision so
the three sites stay in lock-step. Drop the two SET GLOBAL no-ops and
rewrite the comment to reflect the actual mechanism. http_proxy stays
because that *is* a session-level setting DuckDB honours.
Side effect: with the secret forcing path-style, the credential-chain
branch now also emits URL_STYLE/USE_SSL when no explicit endpoint is
configured (previously it skipped the clause when both endpoint was
empty AND no proxy was set). The proxy-set case is the only one that
materially changes shape; the no-proxy / no-endpoint case is still
left untouched (resolveS3SecretTransport falls through to the org's
preferred values).
Tests:
- TestResolveS3SecretTransport: 5 cases covering proxy-overrides-vhost,
proxy-with-defaults, no-proxy defaults, vhost+ssl honoured,
explicit-path preserved.
- TestBuildConfigSecretEmitsHTTPWhenProxySet: asserts the SQL contains
URL_STYLE 'path' / USE_SSL false with proxy set, and the org's
configured vhost/true otherwise.
- TestBuildCredentialChainSecretEmitsHTTPWhenProxySet: pinned the new
behaviour where the credential-chain secret emits URL_STYLE/USE_SSL
when proxy is set even with no endpoint, and stays minimal when
neither proxy nor endpoint is set.
Followup to #524 / #525: with this in place, the forwardUncached
logging from those PRs now actually fires on writes, restoring full
request/response visibility for parquet uploads.1 parent 3e1f16a commit bf258dd
2 files changed
Lines changed: 187 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1375 | 1375 | | |
1376 | 1376 | | |
1377 | 1377 | | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
1390 | 1392 | | |
1391 | 1393 | | |
1392 | 1394 | | |
| |||
1777 | 1779 | | |
1778 | 1780 | | |
1779 | 1781 | | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
1780 | 1813 | | |
1781 | 1814 | | |
1782 | 1815 | | |
1783 | 1816 | | |
1784 | 1817 | | |
1785 | 1818 | | |
1786 | 1819 | | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
1790 | | - | |
1791 | | - | |
1792 | | - | |
1793 | | - | |
1794 | | - | |
1795 | | - | |
| 1820 | + | |
1796 | 1821 | | |
1797 | 1822 | | |
1798 | 1823 | | |
| |||
1847 | 1872 | | |
1848 | 1873 | | |
1849 | 1874 | | |
1850 | | - | |
1851 | | - | |
1852 | | - | |
1853 | | - | |
1854 | | - | |
1855 | | - | |
1856 | | - | |
1857 | | - | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
1858 | 1885 | | |
| 1886 | + | |
1859 | 1887 | | |
1860 | | - | |
1861 | | - | |
1862 | | - | |
1863 | | - | |
1864 | | - | |
1865 | 1888 | | |
1866 | 1889 | | |
1867 | 1890 | | |
| |||
1919 | 1942 | | |
1920 | 1943 | | |
1921 | 1944 | | |
1922 | | - | |
1923 | | - | |
1924 | | - | |
1925 | | - | |
1926 | | - | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
1927 | 1948 | | |
| 1949 | + | |
1928 | 1950 | | |
1929 | | - | |
1930 | | - | |
1931 | | - | |
1932 | | - | |
1933 | 1951 | | |
1934 | 1952 | | |
1935 | 1953 | | |
| |||
0 commit comments