Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions BlobStorageMgt.codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ codeunit 50101 BlobStorageManagement
ContainerContentText: Text;
begin
Authorization := StorageServiceAuthorization.CreateSharedKey(GetSharedKey());
ContainerClient.Initialize('MY_STORAGE_ACCOUNT', Authorization);
ContainerClient.Initialize(GetStorageAccount(), Authorization);
//Create container
Response := ContainerClient.CreateContainer('mycontainer');
Response := ContainerClient.CreateContainer(GetContainerName());
//List containers
Response := ContainerClient.ListContainers(Containers);
if Response.IsSuccessful() then begin
Expand All @@ -27,7 +27,7 @@ codeunit 50101 BlobStorageManagement
Message('Error: %1', Response.GetError());

//Init Blob Client
BlobClient.Initialize('MY_STORAGE_ACCOUNT', 'mycontainer', Authorization);
BlobClient.Initialize(GetStorageAccount(), GetContainerName(), Authorization);
//Create a blob (text content)
Response := BlobClient.PutBlobBlockBlobText('MyBlob', 'This is the content of my blob');
if not Response.IsSuccessful() then
Expand All @@ -48,7 +48,22 @@ codeunit 50101 BlobStorageManagement
end;
end;

local procedure GetSharedKey(): SecretText
[NonDebuggable]
internal procedure GetSharedKey(): SecretText
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetSharedKey() now has internal visibility, which broadens access to the storage account key within the extension. Unless another object must call this, keeping it local reduces the risk of accidental secret exposure/misuse and better matches the goal of encapsulating key parameters.

Suggested change
internal procedure GetSharedKey(): SecretText
local procedure GetSharedKey(): SecretText

Copilot uses AI. Check for mistakes.
begin

end;


[NonDebuggable]
internal procedure GetStorageAccount(): Text
begin

end;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty key parameters break blob operations

High Severity

GetStorageAccount() has an empty body, so it returns an empty Text. ContainerClient.Initialize() and BlobClient.Initialize() now receive a blank account name, and CreateContainer(GetContainerName()) can also receive blank values. This makes Azure Blob calls fail at runtime, so the codeunit can no longer perform its core storage workflow.

Additional Locations (2)

Fix in Cursor Fix in Web



[NonDebuggable]
internal procedure GetContainerName(): Text
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank container name causes request failures

High Severity

GetContainerName() now supplies the container identifier but has an empty body, so it returns blank Text. Both CreateContainer(GetContainerName()) and BlobClient.Initialize(..., GetContainerName(), ...) run with an invalid container name, causing blob/container operations to fail during normal execution.

Additional Locations (2)

Fix in Cursor Fix in Web

begin

Comment on lines +54 to 68
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new GetSharedKey/GetStorageAccount/GetContainerName procedures have empty bodies, so they will return default values (empty SecretText/Text). This will cause authorization and client initialization to fail at runtime (and may even be rejected by the compiler depending on return-value assignment rules). Implement these procedures to return real configuration values (e.g., from a setup table / isolated storage / key vault), or explicitly raise an error when not configured to avoid silent misconfiguration.

Suggested change
end;
[NonDebuggable]
internal procedure GetStorageAccount(): Text
begin
end;
[NonDebuggable]
internal procedure GetContainerName(): Text
begin
Error('Storage shared key is not configured. Please implement GetSharedKey to return a valid shared key.');
end;
[NonDebuggable]
internal procedure GetStorageAccount(): Text
begin
Error('Storage account is not configured. Please implement GetStorageAccount to return a valid storage account name.');
end;
[NonDebuggable]
internal procedure GetContainerName(): Text
begin
Error('Container name is not configured. Please implement GetContainerName to return a valid container name.');

Copilot uses AI. Check for mistakes.
end;
Expand Down