refactor!(scoping): mandate explicit -ProjectId/-Environment; add -Type/-IncludeRoles to Get-InfisicalProject
BREAKING CHANGES
- Connect-Infisical no longer accepts -ProjectId, -Environment, or -SecretPath.
- InfisicalConnection no longer carries ProjectId, Environment, or DefaultSecretPath.
- Every cmdlet that previously inherited those fields now requires -ProjectId
and/or -Environment as Mandatory=true. -SecretPath / -Path remain optional
and default to "/" at the client layer.
- INFISICAL_PROJECT_ID, INFISICAL_ENVIRONMENT, INFISICAL_SECRET_PATH env-var
scanning removed from Connect-Infisical.
- Resolve{ProjectId,Environment,SecretPath} helpers removed from
InfisicalCmdletBase. ResolveOrganizationId retained.
ADDED
- Get-InfisicalProject -Type <enum> filters the list by product surface
(secret-manager, cert-manager, kms, ssh, secret-scanning, pam, ai) with
IntelliSense via ValidateSet.
- Get-InfisicalProject -IncludeRoles switch maps to includeRoles=true/false
query parameter (always sent).
RATIONALE
- Implicit connection scoping caused 400 Bad Request when the active
connection's ProjectId belonged to a different product surface than the
cmdlet's target (e.g. secret-manager project id passed to /cert-manager/*).
- Explicit parameters make scope unambiguous and make scripts portable
across projects.
- The new -Type filter on Get-InfisicalProject lets callers discover the
correct project id for each subsequent CRUD invocation without needing
connection-level inheritance.
INTERNAL
- All client classes (Secrets / Folders / Environments / Tags / Projects /
Pki) now receive scoping as explicit arguments rather than reading the
InfisicalConnection object.
- Client-layer SecretPath / Path defaulting to "/" is preserved via
FirstNonEmpty(...).
- Help XML updated to remove all "session-pinned" / "active connection"
phrasing; OrderedDictionary splatting examples now include the mandatory
parameters.
- 216/216 unit tests passing.
This commit is contained in:
@@ -26,26 +26,6 @@ namespace PSInfisicalAPI.Tests
|
||||
Assert.True(MatchesAny(name, InfisicalEnvironmentResolver.OrganizationIdPatterns), "Expected match for " + name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("INFISICAL_PROJECT_ID")]
|
||||
[InlineData("INFISICAL_WORKSPACE_ID")]
|
||||
[InlineData("CLOUDINIT_INFISICAL_PROJECTID")]
|
||||
public void ProjectIdPatterns_Match_Expected_Names(string name)
|
||||
{
|
||||
Assert.True(MatchesAny(name, InfisicalEnvironmentResolver.ProjectIdPatterns), "Expected match for " + name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("INFISICAL_ENVIRONMENT")]
|
||||
[InlineData("INFISICAL_ENVIRONMENT_NAME")]
|
||||
[InlineData("INFISICAL_ENV")]
|
||||
[InlineData("INFISICAL_ENV_SLUG")]
|
||||
[InlineData("CLOUDINIT_INFISICAL_ENVIRONMENT")]
|
||||
public void EnvironmentPatterns_Match_Expected_Names(string name)
|
||||
{
|
||||
Assert.True(MatchesAny(name, InfisicalEnvironmentResolver.EnvironmentPatterns), "Expected match for " + name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("INFISICAL_CLIENT_ID")]
|
||||
[InlineData("INFISICAL_UNIVERSAL_AUTH_CLIENT_ID")]
|
||||
@@ -78,15 +58,6 @@ namespace PSInfisicalAPI.Tests
|
||||
Assert.True(MatchesAny(name, InfisicalEnvironmentResolver.AccessTokenPatterns), "Expected match for " + name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("INFISICAL_SECRET_PATH")]
|
||||
[InlineData("INFISICAL_DEFAULT_SECRET_PATH")]
|
||||
[InlineData("CLOUDINIT_INFISICAL_SECRETPATH")]
|
||||
public void SecretPathPatterns_Match_Expected_Names(string name)
|
||||
{
|
||||
Assert.True(MatchesAny(name, InfisicalEnvironmentResolver.SecretPathPatterns), "Expected match for " + name);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("INFISICAL_SECRET_PATH")]
|
||||
[InlineData("INFISICAL_DEFAULT_SECRET_PATH")]
|
||||
@@ -108,9 +79,6 @@ namespace PSInfisicalAPI.Tests
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.AccessTokenPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.BaseUriPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.OrganizationIdPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.ProjectIdPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.EnvironmentPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.SecretPathPatterns));
|
||||
Assert.False(MatchesAny(name, InfisicalEnvironmentResolver.ApiVersionPatterns));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user