fix: o on an Azure secret opens its page in the portal
Not the vault's list of secrets: the secret's own page (asset/ Microsoft_Azure_KeyVault/Secret/<id>), and in the versions view, the version's (<id>/<version>), keys' and certificates' versions too. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
3 files changed
+30
-6
No files matched your search
@@ -30,6 +30,7 @@ import (
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets"
|
||||
|
||||
"git.kebcloud.no/keb/lazysecrets/internal/provider"
|
||||
)
|
||||
@@ -334,6 +335,21 @@ func TestPortalURLs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSecretPages(t *testing.T) {
|
||||
c := provider.Container{Detail: "https://kv-app.vault.azure.net/"}
|
||||
base := "https://portal.azure.com/#@contoso.onmicrosoft.com/asset/Microsoft_Azure_KeyVault/Secret/https://kv-app.vault.azure.net/secrets/db"
|
||||
for id, want := range map[string]string{
|
||||
"https://kv-app.vault.azure.net/secrets/db": base, // listed: the secret's page
|
||||
"https://kv-app.vault.azure.net/secrets/db/06140fa2b9a64869a96ef040f6d4dcab": base + "/06140fa2b9a64869a96ef040f6d4dcab", // a version's
|
||||
} {
|
||||
sid := azsecrets.ID(id)
|
||||
o := secretObject(c, &azsecrets.SecretProperties{ID: &sid}, "contoso.onmicrosoft.com")
|
||||
if o.URL != want {
|
||||
t.Errorf("%s: %q, want %q", id, o.URL, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestVersionedReference(t *testing.T) {
|
||||
sec := provider.Object{Type: provider.TypeSecret, Version: "v1",
|
||||
Reference: "@Microsoft.KeyVault(SecretUri=https://kv.vault.azure.net/secrets/s)"}
|
||||
|
||||
Reference in new issue
Block a user