Skip to content

feat: multi-type PAM provider, xUnit tests, TLS env var, and compliance remediation for v1.3.0#16

Open
spbsoluble wants to merge 41 commits intorelease-1.3from
feat/debug-token-request-logging
Open

feat: multi-type PAM provider, xUnit tests, TLS env var, and compliance remediation for v1.3.0#16
spbsoluble wants to merge 41 commits intorelease-1.3from
feat/debug-token-request-logging

Conversation

@spbsoluble
Copy link
Copy Markdown
Contributor

@spbsoluble spbsoluble commented Apr 16, 2026

Summary

New PAM Types

  • Extracts all shared logic into abstract base class SecretServerPamBase. All four concrete types delegate to GetPasswordCore in the base.
  • Adds three new concrete PAM types, each with a hardcoded grant type:
    • SecretServerPamPasswordDelinea-SecretServer-Password (Username + Password)
    • SecretServerPamClientCredentialsDelinea-SecretServer-ClientCredentials (ClientId + ClientSecret)
    • SecretServerPamWindowsDelinea-SecretServer-Windows (IWA, no credentials)
  • Each type-specific variant exposes only the fields relevant to its auth flow, removing the requirement for users to fill in irrelevant credential fields.
  • The existing Delinea-SecretServer type and all its parameters are unchanged — fully backwards compatible.

TLS Env Var

  • KEYFACTOR_PAM_SKIP_TLS_VALIDATION=true (or 1) disables TLS validation at the host level, in addition to the existing SkipTlsValidation config parameter.

Compliance Remediation (SOX/SOC2)

  • Correlation ID threading, structured audit log events, stopwatch timing on all HTTP calls, token error truncation, duplicate SecretResponse class removal, DataType corrections for non-secret fields, and more. See CHANGELOG.md for full details.

Testing

  • Replaced TestConsole with a proper xUnit test project (delinea-secretserver-pam.Tests, net8.0): 45 tests, all passing.
  • Integration tests skip automatically when SECRET_SERVER_* env vars are not set.

Bug Fixes

  • BuildDelineaConfiguration client_credentials case was setting GrantType = "password" on the config object — fixed to "client_credentials".
  • SecretFieldName validation now rejects whitespace-only values.
  • .Result replaced with .GetAwaiter().GetResult() in GetPassword to prevent exception masking.

Test plan

  • dotnet test delinea-secretserver-pam.sln -c Release — 45 passed, 0 failed
  • dotnet build delinea-secretserver-pam.sln -c Release — 0 warnings, 0 errors
  • Integration tests verified against live Secret Server (expired cert environment) using both SkipTlsValidation config param and KEYFACTOR_PAM_SKIP_TLS_VALIDATION env var

Backwards compatibility

The existing Delinea-SecretServer PAM type, its parameter names, and its default behaviour are all unchanged. Existing installations require no reconfiguration.

Logs the token endpoint request body (with password/client_secret redacted)
and the raw response body on non-2xx status codes to aid troubleshooting
of authentication failures without exposing credentials.
Adds .env, scripts/, and client_pam.json to .gitignore to prevent
accidental commit of credentials, bearer tokens, and local test output.
Validate() was never invoked — validation is enforced imperatively in
ValidateServerConfigurationParams() and ValidateInstanceParams(). Calling
Validator.TryValidateObject() would also incorrectly fail for the
client_credentials flow (which stores GrantType="password" internally to
satisfy the Delinea API). Data annotation attributes are retained for
documentation value.
- Log caller identity (Environment.UserName, MachineName), SecretId,
  field name, target URL, and grant type on every GetPassword invocation
- Record API call duration (Stopwatch) for both token and secret endpoints
- Include SecretId, field, grant type, and URL in success and failure log events
- Improve auth failure log with URL, grant type, and caller identity context
- Truncate Secret Server error response bodies to 500 chars before logging
- Remove raw token response body from deserialization failure log path
- Switch .Result to .GetAwaiter().GetResult() to avoid exception masking
@spbsoluble spbsoluble changed the title Feat/debug token request logging feat(logging): SOX/SOC2 compliance audit logging and remediation for v1.3.0 Apr 16, 2026
@spbsoluble spbsoluble force-pushed the feat/debug-token-request-logging branch from a94af3b to 8621b38 Compare April 16, 2026 20:32
spbsoluble and others added 8 commits April 16, 2026 13:42
…c PAM types

Extract all shared HTTP, validation, and secret-retrieval logic into an
abstract base class SecretServerPamBase. Add three concrete subclasses —
SecretServerPamPassword, SecretServerPamClientCredentials, and
SecretServerPamWindows — each implementing IPAMProvider with a hardcoded
grant type. The existing SecretServerPam class is unchanged (backwards
compatible).

Also fixes a pre-existing bug where BuildDelineaConfiguration set
GrantType = "password" on the DelineaConfiguration returned for the
client_credentials case; it now correctly sets "client_credentials".

SecretFieldName validation is tightened to reject whitespace-only values
(previously only empty string was rejected).

InternalsVisibleTo("delinea-secretserver-pam.Tests") added via AssemblyInfo.cs
to allow the xUnit test project to reach the internal test constructors.
Adds delinea-secretserver-pam.Tests (net8.0) with 38 tests covering:
- Happy path for password, client_credentials, and windows grant types
- Missing required server and instance parameters
- Non-success HTTP responses from token and secret endpoints
- Empty/null token responses
- Field-not-found in secret response
- Token request body field name verification (Delinea API constraint:
  client_credentials still uses username/password key names)
- Windows auth correctly targets winauthwebservices endpoint and never
  calls the token endpoint
- All four PAM type Names are distinct

TestHttpMessageHandler fake allows request interception without network access.
integration-manifest.json: add Delinea-SecretServer-Password,
Delinea-SecretServer-ClientCredentials, and Delinea-SecretServer-Windows
PAM type blocks. Each exposes only the fields relevant to its auth flow,
removing the Command UI requirement to fill in irrelevant credentials.

manifest.json: add InitializationInfo example blocks for the three new
types alongside the existing Delinea-SecretServer block.

CHANGELOG.md and README.md updated to document all four types, including
recommended usage guidance and kfutil commands for the new variants.
…octool

- Add docsource/overview.md documenting all four PAM types
- Add per-type docsource files for Password, ClientCredentials, Windows variants
- Update docsource/delinea-secretserver.md for backwards-compat type
- Remove deprecated readme-src/ directory
- Regenerate README.md and docs/ via doctool (adam_dotNetVpython_Fixes branch)
spbsoluble and others added 4 commits April 23, 2026 13:44
Allows TLS certificate validation to be disabled via environment variable
in addition to the existing SkipTlsValidation configuration parameter.
Either setting is sufficient to disable validation; the env var does not
need to be set if the config parameter is already true.
…SKIP_TLS_VALIDATION env var

- SkipTlsValidation config param: verified succeeds when set to true
- KEYFACTOR_PAM_SKIP_TLS_VALIDATION env var: verified true and 1 both enable skip
- Env var set to false does not interfere when config param is also false
- client_credentials token body: asserts grant_type=password (Delinea API constraint)
- Integration-tested both TLS skip paths against live Secret Server instance
…t set

Adds IntegrationFactAttribute which sets Skip at attribute construction time
if any of the required SECRET_SERVER_* env vars are absent, producing a clean
skip rather than a failure in CI environments without live server access.
@spbsoluble spbsoluble changed the title feat(logging): SOX/SOC2 compliance audit logging and remediation for v1.3.0 feat: multi-type PAM provider, xUnit tests, TLS env var, and compliance remediation for v1.3.0 Apr 23, 2026
spbsoluble and others added 8 commits April 23, 2026 14:20
Adds NormalizeConfig which maps 'N/A' (case-insensitive, whitespace-trimmed)
to empty string before validation runs, so users can enter N/A as a dummy
value in the Keyfactor Command UI for fields irrelevant to their auth flow.
Verifies that N/A dummy values in connection config fields irrelevant to
the password auth flow are stripped by NormalizeConfig before validation
and do not prevent secret retrieval from a live Secret Server instance.
- Add .github/workflows/dotnet-ci.yml: unit-test job runs on every PR/push
  with no env vars (integration tests auto-skip); integration-test job is
  gated by vars.INTEGRATION_TESTS_ENABLED and uses the integration-tests
  GitHub environment provisioned by Terraform.
- Add terraform/ config backfilling the existing repo, team access, and
  branch ruleset; creates the integration-tests environment with
  SECRET_SERVER_* secrets and INTEGRATION_TESTS_ENABLED repo variable.
- State stored in Azure Blob (kfghtfstatesn84ro / tfstate container).
@spbsoluble spbsoluble deployed to integration-tests April 23, 2026 22:21 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant