Skip to content

PR back to optum#2

Merged
Esity merged 148 commits into
Optum:mainfrom
LegionIO:main
Jun 25, 2026
Merged

PR back to optum#2
Esity merged 148 commits into
Optum:mainfrom
LegionIO:main

Conversation

@Esity

@Esity Esity commented Apr 17, 2026

Copy link
Copy Markdown
Member

No description provided.

Esity and others added 30 commits March 12, 2026 20:56
- add vault config tests (env vars, defaults, all keys)
- 33 -> 52 specs
- add Legion::Crypt::JWT module with issue/verify/decode operations
- support HS256 (cluster secret) and RS256 (RSA keypair) algorithms
- add convenience methods on Legion::Crypt (issue_token, verify_token)
- add jwt settings block with configurable defaults
- add jwt gem dependency (>= 2.7)
- 88 specs passing, rubocop clean
Add VaultJwtAuth module for Vault JWT auth backend login and worker login
helpers. Update cluster_secret for improved key handling. Expose JWT helpers
through main Legion::Crypt entry point.
runs after ci passes on push to main. calls reusable release workflow
for version detection, github release, and rubygems publish.
resolves non-deterministic ordering dependency in cluster_secret_spec.
adds comprehensive specs for vault_jwt_auth module.
add JwksClient module for fetching and caching JWKS public keys,
JWT.verify_with_jwks for RS256 token verification with issuer/audience
validation, and Crypt.verify_external_token convenience method.
bump to v1.4.0.
Legion::Crypt::MockVault provides thread-safe in-memory key-value
store that eliminates the Vault dependency for local development.
Supports read, write, delete, list, and connected? interface.
- Ed25519: key generation, signing, verification, Vault key storage
- PartitionKeys: HKDF per-tenant key derivation with AES-256-GCM
- Erasure: cryptographic erasure via Vault master key deletion
- Attestation: signed identity claims with freshness checking
- Add ed25519 gem dependency (~> 1.3)
- Bump to 1.4.2
Esity and others added 10 commits April 8, 2026 14:59
LeaseManager#cache_lease was not storing the :path from static lease
definitions, so reissue_lease could never fire as a fallback when
sys.renew failed or leases hit max_ttl. All three service credentials
(RabbitMQ, PostgreSQL, Redis) would silently expire after their Vault
TTL with no recovery.

Also adds trigger_reconnect dispatch for PG/Redis reissue, and
comprehensive INFO/WARN logging across the full lease lifecycle.
12 rescue blocks across 4 files (crypt.rb, vault_entity.rb,
jwks_client.rb, vault_cluster.rb) were logging but not calling
handle_exception for structured exception tracking. Also consolidated
duplicate rescue branches in vault_entity.rb#ensure_entity.
add VaultEntity module for Phase 7 Vault identity tracking
…reissue leases on reauth

Vault Kerberos auth issues non-renewable service tokens (2h TTL). When the token
expires, Vault cascade-revokes all child leases (RabbitMQ, PostgreSQL, Redis),
killing all three credential sets simultaneously regardless of their own TTLs.

TokenRenewer now detects renewable=false and skips renew_self (which always fails
for non-renewable tokens), going straight to reauth_kerberos. After reauth, it
triggers LeaseManager.reissue_all to re-issue all leases under the new token.

LeaseManager changes:
- Add reissue_all method for bulk lease re-issuance after token rotation
- Fix symbol/string key mismatch in push_to_settings (resolve_secrets! registers
  string keys via lease:// URIs, but cache_lease stores symbol keys from JSON parse)
- Fix trigger_reconnect for PostgreSQL: use Sequel pool disconnect/reconnect instead
  of Data.shutdown+setup which tears down unrelated connections (Apollo SQLite)
- Fix trigger_reconnect for Redis: use Cache.restart (the actual method) instead of
  Cache.reconnect (which doesn't exist)

Closes #29

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…behavior

- Version bump 1.5.8 → 1.5.9
- Changelog documents all fixes from #29
- Update trigger_reconnect specs: PostgreSQL now tests Sequel pool
  disconnect/reconnect, Redis now tests Cache.restart

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vocation

fix vault lease cascade revocation — handle non-renewable tokens and reissue on reauth
@CLAassistant

CLAassistant commented Apr 17, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 3 committers have signed the CLA.

✅ Esity
❌ Codex
❌ Iverson


Iverson seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Esity Esity requested review from a team and tylerkastenschmidt April 17, 2026 15:37
@Esity Esity self-assigned this Apr 17, 2026
Esity and others added 15 commits April 19, 2026 23:30
…ebug

Pass caller's level: through to Legion::Logging.log_exception instead of
defaulting to :error. Also fix exception_log_message to suppress
backtrace for :debug level (was only suppressed when backtrace was
empty). Fixes LegionIO/LegionIO#155
fix: handle_exception respects level: kwarg (#155)
…rotation

trigger_reconnect(:postgresql) previously called sequel.disconnect +
sequel.test_connection, but Sequel bakes credentials into the pool at
Sequel.connect time. The old approach silently reused stale credentials
after Vault lease rotation, causing Apollo and other DB-backed services
to lose access to data without any error indication.

Now calls Legion::Data::Connection.reconnect_with_fresh_creds (added in
legion-data 1.6.26) which tears down the pool and rebuilds it from
current Settings values. Falls back to legacy path for older legion-data
versions with an explicit warning.

Reconnect failures now log at :error level (was :warn) since a failed
reconnect means services are unavailable.

Bump to 1.5.11.
fix(lease_manager): use reconnect_with_fresh_creds for PG credential rotation
legion-crypt had two shim files (lib/legion/logging.rb and
lib/legion/logging/helper.rb) that redefined Legion::Logging::Helper#log
with a CompatLogger. This permanently prevented TaggedLogger segment
tags from appearing in log output for every module loaded after crypt.

Since legion-logging >= 1.5.0 is a hard gemspec dependency, these
shims serve no purpose. Also adds missing legion-json dependency.
Remove logging compat shims that shadowed TaggedLogger segments
@Esity Esity merged commit 6ec1684 into Optum:main Jun 25, 2026
15 of 16 checks passed
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.

3 participants