1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-06-20 01:17:49 +02:00

Allow dots in S3 bucket names when using path-style URIs.

The reasoning in the FAQ and code about RFC-2818 is only valid when using host style URIs. According to AWS S3 bucket naming standard the allowed characters is any lowercase alphanumeric including dash and dot.

Most self hosted S3 services utilize path based URIs where dots are valid in a bucket name so this check should only apply for host based buckets. Even though its use is not recommended and path-based access is being phased out of AWS S3 it is still valid and should function for other providers.
This commit is contained in:
Joakim Hindersson
2025-12-07 06:59:12 +01:00
committed by GitHub
parent 8a4df08bd2
commit 3fdb4a1ea0
4 changed files with 36 additions and 1 deletions
+11
View File
@@ -18,6 +18,17 @@
</release-feature-list>
<release-improvement-list>
<release-item>
<github-pull-request id="2713"/>
<release-item-contributor-list>
<release-item-contributor id="joakim.hindersson"/>
<release-item-reviewer id="david.steele"/>
</release-item-contributor-list>
<p>Allow dots in S3 bucket names when using path-style URIs.</p>
</release-item>
<release-item>
<github-issue id="2679"/>
<github-pull-request id="2701"/>
+5
View File
@@ -582,6 +582,11 @@
<contributor-id type="github">Underhunden</contributor-id>
</contributor>
<contributor id="joakim.hindersson">
<contributor-name-display>Joakim Hindersson</contributor-name-display>
<contributor-id type="github">jhindersson</contributor-id>
</contributor>
<contributor id="joe.ayers">
<contributor-name-display>Joe Ayers</contributor-name-display>
</contributor>
+2 -1
View File
@@ -273,10 +273,11 @@ cfgLoadUpdateOption(void)
}
}
// For each possible repo, error if an S3 bucket name contains dots
// For each possible repo, error if an S3 bucket name contains dots when using host style URIs
for (unsigned int repoIdx = 0; repoIdx < cfgOptionGroupIdxTotal(cfgOptGrpRepo); repoIdx++)
{
if (cfgOptionIdxTest(cfgOptRepoS3Bucket, repoIdx) && cfgOptionIdxBool(cfgOptRepoStorageVerifyTls, repoIdx) &&
cfgOptionIdxStrId(cfgOptRepoS3UriStyle, repoIdx) == CFGOPTVAL_REPO_S3_URI_STYLE_HOST &&
strChr(cfgOptionIdxStr(cfgOptRepoS3Bucket, repoIdx), '.') != -1)
{
THROW_FMT(
+18
View File
@@ -423,6 +423,24 @@ testRun(void)
"HINT: TLS/SSL verification cannot proceed with this bucket name.\n"
"HINT: remove dots from the bucket name.");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("bucket name with dot succeeds with path-style URIs");
argList = strLstNew();
hrnCfgArgRawZ(argList, cfgOptStanza, "db");
hrnCfgArgRawZ(argList, cfgOptPgPath, "/path/to/pg");
hrnCfgArgKeyRawZ(argList, cfgOptRepoType, 111, "s3");
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3Bucket, 111, "ok.bucket");
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3Region, 111, "region");
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3Endpoint, 111, "endpoint");
hrnCfgArgKeyRawZ(argList, cfgOptRepoS3UriStyle, 111, "path");
hrnCfgArgKeyRawZ(argList, cfgOptRepoPath, 111, "/repo");
hrnCfgArgRawZ(argList, cfgOptRepo, "111");
HRN_CFG_LOAD(cfgCmdArchiveGet, argList, .comment = "dot bucket with uri-style=path");
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptRepoS3Bucket), "ok.bucket", "check bucket value");
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3Key, 111);
hrnCfgEnvKeyRemoveRaw(cfgOptRepoS3KeySecret, 111);