Skip to content

Sensitive values handling #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 9, 2025
Merged
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
1 change: 1 addition & 0 deletions .build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- `.\build.ps1 Extension_Build --ExtensionName RestApia.Extensions.Auth.OAuth2` - build NuGet package for the OAuth2 extension
- optional `--ExtensionLibVersion 1.0.0` to specify the version
- `.\build.ps1 Extension_Push --ExtensionName RestApia.Extensions.Auth.OAuth2` - build the OAuth2 extension and push it to the NuGet server
- `.\build.ps1 Extension_Build --ExtensionLibVersion 1.1.4-dev --ExtensionName RestApia.Extensions.ValuesProvider.AzureKeyVault` - to build preview version (will be visible for DEV channel app only)

## Shared library build

Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PlatformTarget>x64</PlatformTarget>
<PlatformTargets>x64;arm64</PlatformTargets>
<DebugSymbols>false</DebugSymbols>
<DebugType>none</DebugType>
<AnalysisLevel>6.0-all</AnalysisLevel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public async Task<ReloadValuesResults> ReloadValuesAsync(IReadOnlyCollection<Val
Name = "Authorization",
Type = ValueTypeEnum.Header,
Value = $"Bearer {tokenString}",
IsSecret = true,
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ public async Task<ReloadValuesResults> ReloadValuesAsync(IReadOnlyCollection<Val
Name = "Authorization",
Type = ValueTypeEnum.Header,
Value = $"Bearer {tokenString}",
IsSecret = true,
},
];
return new ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public static IReadOnlyCollection<ValueModel> GetTokenValues(IReadOnlyCollection
Value = claim.Value,
Type = ValueTypeEnum.Other,
TypeDetails = "JWT Claim",
IsSecret = claim.Type is "upn" or "unique_name" or "preferred_username" or "otp",
}));

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public async Task<ReloadValuesResults> ReloadValuesAsync(IReadOnlyCollection<Val
Name = secretProperty.Name,
Value = secret.Value.Value,
Type = ValueTypeEnum.Variable,
IsSecret = true,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Title>Azure KeyVault Values Provider</Title>
<Description>Extensions provides Azure KeyVault secrets as variables</Description>
<RepositoryUrl>https://github.com/RestApia/RestApia.Shared/tree/main/src/Extensions/RestApia.Extensions.ValuesProvider.AzureKeyVault</RepositoryUrl>
<PackageTags>RestApia, Extension, Values Provider</PackageTags>
<PackageTags>RestApia, RestApia:0.5.0, Extension, Values Provider</PackageTags>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 5 additions & 1 deletion src/RestApia.Shared/Common/Models/BoolResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ public record BoolResult
}

public record TrueResult : BoolResult;
public record FalseResult(string? Message = null) : BoolResult;

public record FalseResult(string? Message = null) : BoolResult
{
public override string ToString() => Message ?? "False";
}
1 change: 1 addition & 0 deletions src/RestApia.Shared/Common/Models/ValueModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public record ValueModel
public required ValueTypeEnum Type { get; init; }
public string TypeDetails { get; init; } = string.Empty;
public string SourceName { get; init; } = string.Empty;
public bool IsSecret { get; init; }
}