Claus Ibsen created CAMEL-26284:
-----------------------------------

             Summary: camel-azure-storage-blob - validate the source account 
and container name in copyBlob
                 Key: CAMEL-26284
                 URL: https://issues.apache.org/jira/browse/CAMEL-26284
             Project: Camel
          Issue Type: Improvement
          Components: camel-azure
            Reporter: Claus Ibsen
             Fix For: 4.24.0, 4.22.3, 4.18.6


The copyBlob operation of camel-azure-storage-blob takes the source account 
name from the {{CamelAzureStorageBlobSourceBlobAccountName}} header and the 
source container name from {{CamelAzureStorageBlobSourceBlobContainerName}}. 
{{BlobClientWrapper.copyBlob}} builds the source service URL with 
{{String.format("https://%s.blob.core.windows.net";, accountName)}}, without 
checking the value. A value that is not an Azure storage account name therefore 
gives a source URL with another shape than intended, and the error, if any, 
only comes later from the service. The {{camel-azure-functions}} producer had 
the same kind of URL building (CAMEL-26280).

h3. Change

* In {{BlobOperations.copyBlob}}, validate the source account name against the 
Azure storage account naming rules (3 to 24 characters, lowercase letters and 
digits only) and the source container name against the container naming rules 
(3 to 63 characters, lowercase letters, digits and single hyphens, starting 
with a letter or digit), and fail with a clear {{IllegalArgumentException}} 
when a value breaks them.
* Build the source endpoint from the validated name only.
* Document the two headers on the component page, with the naming rules.
* Upgrade guide entries (4.24, and 4.22 / 4.18 for the backports): copyBlob now 
rejects an invalid source account or container name before calling the service.

h3. Tests

* A unit test for the validation: valid names pass; names with upper case, 
dots, slashes, {{?}}, {{#}}, {{@}}, a port, or a wrong length are rejected.
* An existing copyBlob test keeps passing with valid names.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to