Skip to content

🔒 SECURITY: Implement Secrets Management for Credential Storage #323

@sfloess

Description

@sfloess

Problem Statement

Credentials (usernames, passwords, API keys) are currently stored in plaintext in YAML descriptor files, configuration properties, and logs, creating significant security risks for credential exposure.

Current Behavior

Location: jplatform-classloader/src/main/java/org/flossware/jplatform/classloader/IsolatedClassLoader.java:199-205

String username = props.get("classpath." + host + ".auth.username");
String password = props.get("classpath." + host + ".auth.password");
if (username != null && password != null) {
    return AuthConfig.basic(username, password);  // ⚠️ Plaintext
}

Risks:

  • Credentials visible in YAML files committed to version control
  • Passwords logged in debugging output
  • Credentials exposed in configuration backups
  • No encryption at rest
  • No credential rotation mechanism

Expected Behavior

Credentials should be:

  1. Stored encrypted in external secret management system (Vault, AWS Secrets Manager)
  2. Referenced by path, not stored inline
  3. Rotatable without code changes
  4. Auditable with access logging
  5. Never logged in plaintext

Proposed Solution

Option 1: HashiCorp Vault Integration

Add Vault configuration source module (stub exists at jplatform-config-vault):

// In descriptor YAML:
classpath:
  - url: https://repo.example.com/libs
    auth:
      type: vault
      path: secret/data/platform/repo-credentials
      usernameKey: username
      passwordKey: password

Option 2: AWS Secrets Manager

classpath:
  - url: https://repo.example.com/libs
    auth:
      type: aws-secrets
      secretId: platform/repo-credentials
      region: us-east-1

Option 3: Environment Variable Substitution (Minimum)

classpath:
  - url: https://repo.example.com/libs
    auth:
      username: ${REPO_USERNAME}
      password: ${REPO_PASSWORD}

Implementation Tasks

  1. Complete jplatform-config-vault module
  2. Add environment variable substitution to descriptor parser
  3. Create SecretsProvider interface in jplatform-api
  4. Update IsolatedClassLoader to use secrets provider
  5. Add credential masking to logging (see issue #XXX)
  6. Document secrets management in new SECRETS_MANAGEMENT.md

Acceptance Criteria

  • Vault integration functional with sample configuration
  • Environment variable substitution working
  • Credentials never logged in plaintext
  • Unit tests for secrets provider implementations
  • Documentation with deployment examples
  • Migration guide for existing plaintext configs

Verification Steps

  1. Configure Vault with test credentials
  2. Deploy application with Vault-sourced credentials
  3. Verify authentication works without plaintext in descriptors
  4. Check logs to confirm no credential leakage
  5. Test credential rotation without restart

Impact

Severity: HIGH

  • Current risk: Credential exposure in version control, logs, backups
  • Compliance: Required for SOC 2, PCI-DSS, HIPAA
  • Production blocker: Cannot deploy to regulated environments

References


Priority: HIGH | Production Readiness Review Score: 8.3/10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions