Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .changeset/azure-sas-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"github.com/livekit/protocol": patch
---

Add `sas_token` to `AzureBlobUpload`, so egress can upload to Azure Blob Storage with a shared access signature instead of the account key.
6 changes: 3 additions & 3 deletions auth/grants.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ func checkOutputForCredentials(output any) error {
return ErrSensitiveCredentials
}
case *livekit.EncodedFileOutput_Azure:
if msg.Azure.AccountKey != "" {
if msg.Azure.AccountKey != "" || msg.Azure.SasToken != "" {
return ErrSensitiveCredentials
}
case *livekit.SegmentedFileOutput_Azure:
if msg.Azure.AccountKey != "" {
if msg.Azure.AccountKey != "" || msg.Azure.SasToken != "" {
return ErrSensitiveCredentials
}
case *livekit.AutoTrackEgress_Azure:
if msg.Azure.AccountKey != "" {
if msg.Azure.AccountKey != "" || msg.Azure.SasToken != "" {
return ErrSensitiveCredentials
}
case *livekit.EncodedFileOutput_AliOSS:
Expand Down
21 changes: 21 additions & 0 deletions auth/grants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,27 @@ func TestRoomConfiguration_CheckCredentials(t *testing.T) {
require.ErrorIs(t, config.CheckCredentials(), ErrSensitiveCredentials)
})

t.Run("room file output with Azure SAS token fails", func(t *testing.T) {
config := &RoomConfiguration{
Egress: &livekit.RoomEgress{
Room: &livekit.RoomCompositeEgressRequest{
FileOutputs: []*livekit.EncodedFileOutput{
{
Output: &livekit.EncodedFileOutput_Azure{
Azure: &livekit.AzureBlobUpload{
AccountName: "account",
SasToken: "sv=2024-11-04&sig=abc", // This should trigger error
ContainerName: "container",
},
},
},
},
},
},
}
require.ErrorIs(t, config.CheckCredentials(), ErrSensitiveCredentials)
})

t.Run("room segment output with AliOSS secret fails", func(t *testing.T) {
config := &RoomConfiguration{
Egress: &livekit.RoomEgress{
Expand Down
1 change: 1 addition & 0 deletions egress/redact.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func RedactUpload(req UploadRequest) {
if azure := req.GetAzure(); azure != nil {
azure.AccountName = utils.Redact(azure.AccountName, "{account_name}")
azure.AccountKey = utils.Redact(azure.AccountKey, "{account_key}")
azure.SasToken = utils.Redact(azure.SasToken, "{sas_token}")
return
}

Expand Down
2 changes: 2 additions & 0 deletions egress/redact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ var (
Azure: &livekit.AzureBlobUpload{
AccountName: "ACCOUNT_NAME",
AccountKey: "ACCOUNT_KEY",
SasToken: "SAS_TOKEN",
},
},
}
Expand Down Expand Up @@ -105,6 +106,7 @@ func TestRedactUpload(t *testing.T) {

require.Equal(t, "{account_name}", cl.(*livekit.DirectFileOutput).Output.(*livekit.DirectFileOutput_Azure).Azure.AccountName)
require.Equal(t, "{account_key}", cl.(*livekit.DirectFileOutput).Output.(*livekit.DirectFileOutput_Azure).Azure.AccountKey)
require.Equal(t, "{sas_token}", cl.(*livekit.DirectFileOutput).Output.(*livekit.DirectFileOutput_Azure).Azure.SasToken)
}

func TestRedactStreamOutput(t *testing.T) {
Expand Down
14 changes: 12 additions & 2 deletions livekit/livekit_egress.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading