Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
2bd4353
update dependency version floors for ruby 3.4 compatibility
Esity Mar 13, 2026
174a7e4
rubocop -A auto-corrections
Esity Mar 13, 2026
d273352
fix rubocop offenses: rename iv parameter, move dev deps to gemfile, …
Esity Mar 13, 2026
c6e2bc9
reindex documentation to reflect current codebase
Esity Mar 13, 2026
ddbb2f8
expand settings spec coverage
Esity Mar 13, 2026
59fb0eb
add jwt support to legion-crypt
Esity Mar 13, 2026
84e0d3f
switch to org-level reusable ci workflow
Esity Mar 13, 2026
f1cb0bc
reindex documentation to reflect current codebase state
Esity Mar 13, 2026
9db1a13
add vault jwt auth backend, update cluster secret and crypt entry point
Esity Mar 14, 2026
80eac66
trigger ci with updated shared workflow
Esity Mar 15, 2026
ced7887
add release job to ci workflow
Esity Mar 15, 2026
dc94cdb
fix flaky cluster_secret spec and add vault_jwt_auth specs
Esity Mar 15, 2026
ba29bf7
add leases key to vault default settings
Esity Mar 16, 2026
e702598
add LeaseManager core: singleton, start, fetch, shutdown # pipeline-c…
Esity Mar 16, 2026
084606c
add push_to_settings with reverse index for lease rotation
Esity Mar 16, 2026
400c5f8
add background renewal thread with rotation detection
Esity Mar 16, 2026
cc853a8
wire LeaseManager into crypt start and shutdown lifecycle
Esity Mar 16, 2026
4112a27
bump legion-crypt to 1.3.0: vault lease manager
Esity Mar 16, 2026
af43d16
update readme with lease manager docs
Esity Mar 16, 2026
6c7a38e
add jwks-based jwt validation for external identity providers
Esity Mar 16, 2026
32d5401
update readme with jwks external token verification docs
Esity Mar 16, 2026
06206e8
update claude.md with jwks client and external token verification docs
Esity Mar 16, 2026
7ad4ba2
add mock vault for local development mode
Esity Mar 16, 2026
7d01831
add ed25519, partition keys, erasure, and attestation modules
Esity Mar 16, 2026
47d7985
add tls configuration module for mtls between components
Esity Mar 17, 2026
83e03e7
add VaultKerberosAuth for SPNEGO-based Vault token exchange
Esity Mar 18, 2026
9b0033e
add default and clusters keys to vault settings schema
Esity Mar 18, 2026
e9b6244
add VaultCluster module with multi-cluster client management
Esity Mar 18, 2026
1234013
add LdapAuth module for per-cluster LDAP authentication
Esity Mar 18, 2026
d3bd1e9
wire VaultCluster and LdapAuth into Legion::Crypt with multi-cluster …
Esity Mar 18, 2026
7440700
update VaultRenewer to support multi-cluster token renewal with singl…
Esity Mar 18, 2026
9e39a64
bump to 1.4.4, add changelog for multi-cluster vault
Esity Mar 18, 2026
1be3169
reindex documentation to reflect current codebase state
Esity Mar 19, 2026
49296e5
refactor: standardize TLS module with resolve pattern
Esity Mar 20, 2026
4a52393
add codeowners
Esity Mar 22, 2026
4c85896
fix vault url construction when address contains scheme
Esity Mar 22, 2026
c3331d6
expand codeowners with path-based template
Esity Mar 22, 2026
2298e79
add comprehensive logging across crypt operations
Esity Mar 22, 2026
d2a4b1e
add logging to silent rescue blocks
Esity Mar 22, 2026
9812e2b
add Legion::Crypt::Helper module for injectable vault mixin (v1.4.9)
Esity Mar 23, 2026
5be98b1
add Legion::Crypt.delete for Vault KV path deletion
Esity Mar 24, 2026
b6373ce
bump legion-crypt 1.4.10 — add Crypt.delete for Vault KV deletion
Esity Mar 24, 2026
4eb1519
add .worktrees to gitignore
Esity Mar 24, 2026
d49769b
add Crypt::Mtls module for Vault PKI cert issuance
Esity Mar 24, 2026
84ab922
add Crypt::Mtls and CertRotation for Vault PKI mTLS
Esity Mar 24, 2026
4166f2f
bump version to 1.4.11, update CHANGELOG
Esity Mar 24, 2026
e640657
merge feature/mtls-internal-comms into main
Esity Mar 25, 2026
c779561
fix ruby 4.0 frozen hash in vault gem setup (1.4.12)
Esity Mar 25, 2026
f8293c2
add repo governance files (CODEOWNERS, dependabot, CI)
Esity Mar 25, 2026
e6eff15
add kerberos settings defaults to vault config
Esity Mar 26, 2026
e7a2110
add KerberosAuth module for Vault auto-auth via SPNEGO
Esity Mar 26, 2026
216ed87
add auth_method dispatch to connect_all_clusters (kerberos, ldap, tok…
Esity Mar 26, 2026
86602b9
add TokenRenewer with three-layer lifecycle (renew, re-auth, backoff)…
Esity Mar 26, 2026
7293313
wire KerberosAuth and TokenRenewer into Crypt start/shutdown lifecycle
Esity Mar 26, 2026
3e55afe
bump to 1.4.13, add changelog for kerberos auto-auth
Esity Mar 26, 2026
8ad9bc7
fix vault kerberos auth: header, namespace, accessor, bump to 1.4.14
Esity Mar 26, 2026
5cf5e40
update CLAUDE.md version to 1.4.14
Esity Mar 26, 2026
8f8a898
route vault kv operations through default cluster client (#1)
Esity Mar 26, 2026
4244c45
add vault namespace-aware kerberos auth, lease manager cluster routin…
Esity Mar 26, 2026
55c76e8
apply copilot review suggestions (#2)
Esity Mar 26, 2026
ee9871a
apply copilot review suggestions (#2)
Esity Mar 26, 2026
eb811c0
Merge pull request #2 from LegionIO/feature/vault-namespace-kerberos
Esity Mar 26, 2026
ffa6e87
add kerberos principal storage and vault namespace routing (#3)
Esity Mar 26, 2026
cc99a0f
fix vault cluster auth pipeline bugs (#4)
Esity Mar 27, 2026
9bb2c81
fix kv v2 envelope unwrapping and add vault debug logging
Esity Mar 27, 2026
f46c388
replace split error logging with log_exception
Esity Mar 27, 2026
2c41c11
apply copilot review suggestions, bump version to 1.4.21 (#5)
Esity Mar 27, 2026
8c21244
apply copilot review suggestions round 2 (#5)
Esity Mar 27, 2026
11f840f
apply copilot review suggestions round 3 (#5)
Esity Mar 27, 2026
cf73dd6
apply copilot review suggestions round 4 (#5)
Esity Mar 27, 2026
e999c98
apply copilot review suggestions round 5 (#5)
Esity Mar 27, 2026
7f279f5
Merge pull request #5 from LegionIO/feature/structured-exception-logging
Esity Mar 27, 2026
d2bc724
fix vault health check to accept standby nodes (429, 472, 473)
Esity Mar 27, 2026
5af83a4
Merge branch 'main' into feature/structured-exception-logging
Esity Mar 28, 2026
25ab20a
Merge pull request #7 from LegionIO/feature/structured-exception-logging
Esity Mar 28, 2026
9f4219f
fix lease proliferation: cache and reuse Vault dynamic credentials (c…
Esity Mar 28, 2026
b2b3623
route Vault KV through default cluster client in multi-cluster mode (…
Esity Mar 29, 2026
ab56054
add optional SPIFFE workload identity support (closes #8)
Esity Mar 29, 2026
3faadd9
Merge pull request #9 from LegionIO/feature/structured-exception-logging
Esity Mar 29, 2026
0335e87
rescue vault errors in push_cs_to_vault
Esity Mar 29, 2026
81c0d02
fix connect_vault namespace for namespaced vault environments
Esity Mar 31, 2026
618b4b7
fix vault_write to accept keyword args for Crypt.write compatibility
Esity Mar 31, 2026
93bf505
disable cluster secret by default, fix || true settings bug
Esity Mar 31, 2026
22b42c6
clean up dev dependencies: add rubocop-legion
Esity Mar 31, 2026
de298f9
start 1.5.0 release line
Esity Apr 2, 2026
fd3c814
add legion-logging runtime support
Esity Apr 2, 2026
ace0f9a
uplift helper-based logging across legion-crypt
Esity Apr 2, 2026
1e289d9
fix cluster secret vault synchronization
Esity Apr 2, 2026
32ed7c0
harden external jwt and jwks verification
Esity Apr 2, 2026
8b840c9
fix multi-cluster vault auth and renewal behavior
Esity Apr 2, 2026
2de2974
make spiffe workload api fail closed by default
Esity Apr 2, 2026
bedf3cf
fix broken vault helper usage in ed25519 and erasure
Esity Apr 2, 2026
fd83233
fix background worker lifecycle and thread safety
Esity Apr 2, 2026
eed36ea
sync vault connected state for multi-cluster auth
Esity Apr 2, 2026
99871f0
remove remaining log wrapper helpers
Esity Apr 2, 2026
b9e035f
harden shared symmetric encryption
Esity Apr 2, 2026
87ee7f2
harden rsa keypair encryption padding
Esity Apr 2, 2026
5d73a3a
require legion-logging 1.5.0
Esity Apr 2, 2026
316c78e
fix legion-logging 1.5.0 spec compatibility
Esity Apr 2, 2026
8d320a9
Update lib/legion/crypt/vault_cluster.rb
Esity Apr 2, 2026
cb669bb
Update lib/legion/crypt/lease_manager.rb
Esity Apr 2, 2026
01e293e
Update lib/legion/crypt/jwks_client.rb
Esity Apr 2, 2026
61f93da
fix jwks cached unknown-kid spec
Esity Apr 2, 2026
3a796cc
Merge pull request #16 from LegionIO/dev-v1-5-0
Esity Apr 2, 2026
4530e44
fix vault read path prefix and add at_exit lease cleanup
Esity Apr 3, 2026
e9b5d07
add debug logging for vault lease checkout responses
Esity Apr 3, 2026
a4ddfee
add 10s timeout to at_exit lease shutdown to prevent hang on blocked …
Esity Apr 3, 2026
4b5abc9
add jwks background refresh and bootstrap_lease_ttl (phase 2)
Esity Apr 6, 2026
0497c22
bump version to 1.5.3, update changelog
Esity Apr 6, 2026
bad67a8
apply copilot review suggestions (#24)
Esity Apr 6, 2026
9488662
Merge pull request #24 from LegionIO/feature/unified-identity-phase2
Esity Apr 6, 2026
77d1d02
add JWT.issue_identity_token for wire format phase 3
Esity Apr 7, 2026
a9999ab
Add specs for identity token helper
Codex Apr 7, 2026
283d080
apply copilot review suggestions (#25)
Esity Apr 7, 2026
f6b7e21
Merge pull request #25 from LegionIO/feature/wire-format-phase3-jwt-i…
Esity Apr 7, 2026
0fc4149
implement Phase 5 credential scoping — Group 3 (credential swap)
Esity Apr 7, 2026
f5a2b88
apply copilot review suggestions (#26)
Esity Apr 7, 2026
ec02244
apply copilot review suggestions (#26)
Esity Apr 7, 2026
c10cd5d
apply copilot review suggestions (#26)
Esity Apr 7, 2026
ce5c59a
Merge pull request #26 from LegionIO/feature/credential-scoping-crypt
Esity Apr 7, 2026
26e816b
add VaultEntity module for Phase 7 Vault identity tracking
Esity Apr 8, 2026
3b0bbc0
apply copilot review suggestions (#27)
Esity Apr 8, 2026
cb45d60
apply copilot review suggestions (#27)
Esity Apr 8, 2026
b45612c
fix static lease reissue by storing path in cache_lease (fixes #28)
Esity Apr 8, 2026
a18c409
apply copilot review suggestions (#27)
Esity Apr 8, 2026
2568b6a
apply copilot review suggestions (#27)
Esity Apr 8, 2026
5fe3f63
add handle_exception to all rescue blocks missing it (#27)
Esity Apr 8, 2026
9327277
Merge pull request #27 from LegionIO/feature/phase7-vault-entity
Esity Apr 8, 2026
515f7b4
add configurable ssl verification for vault and jwks connections
Esity Apr 9, 2026
731ee17
fix vault_cluster specs to expect ssl_verify parameter
Esity Apr 9, 2026
50bdd87
fix vault lease cascade revocation — handle non-renewable tokens and …
Apr 10, 2026
d8b4801
bump to 1.5.9, update changelog, fix specs for new trigger_reconnect …
Apr 10, 2026
403a7ac
Merge pull request #30 from LegionIO/fix/vault-lease-token-cascade-re…
Esity Apr 10, 2026
f6e6bf0
fix: handle_exception respects level: kwarg, suppress backtrace for d…
Esity Apr 20, 2026
15a2a0a
chore: bump to 1.5.10, add changelog for #155 fix
Esity Apr 20, 2026
a94d8d6
Merge pull request #31 from LegionIO/fix/handle-exception-level-kwarg
Esity Apr 20, 2026
e7f9d9b
fix(lease_manager): use reconnect_with_fresh_creds for PG credential …
Apr 27, 2026
0bef728
improve cipher decrypt diagnostics
Esity Apr 28, 2026
4b5ec44
merge cipher diagnostics into pg lease reconnect
Esity Apr 28, 2026
0e4f236
Merge pull request #33 from LegionIO/fix/pg-lease-reconnect
Esity Apr 28, 2026
2e8f6b1
separate crypt release versions
Esity Apr 28, 2026
4515891
satisfy rescue logging lint
Esity Apr 28, 2026
fc7b4b3
Merge pull request #34 from LegionIO/fix/actionable-cipher-decrypt-er…
Esity Apr 28, 2026
1c2b18e
Remove logging compat shims that shadowed Legion::Logging::Helper
Esity May 9, 2026
6d21963
Merge pull request #35 from LegionIO/fix/remove-logging-shims
Esity May 9, 2026
a8867bb
Bump v1.5.13, add CHANGELOG entry
Esity May 9, 2026
8d1a604
Merge branch 'main' into fix/remove-logging-shims
Esity May 9, 2026
6532347
Merge pull request #36 from LegionIO/fix/remove-logging-shims
Esity May 9, 2026
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
7 changes: 7 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Auto-generated from team-config.yml
# Team: core
#
# To apply: scripts/apply-codeowners.sh legion-crypt

* @LegionIO/maintainers
* @LegionIO/core
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: bundler
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
labels:
- "type:dependencies"
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
labels:
- "type:dependencies"
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 9 * * 1'

jobs:
ci:
uses: LegionIO/.github/.github/workflows/ci.yml@main

lint:
uses: LegionIO/.github/.github/workflows/lint-patterns.yml@main

security:
uses: LegionIO/.github/.github/workflows/security-scan.yml@main

version-changelog:
uses: LegionIO/.github/.github/workflows/version-changelog.yml@main

dependency-review:
uses: LegionIO/.github/.github/workflows/dependency-review.yml@main

stale:
if: github.event_name == 'schedule'
uses: LegionIO/.github/.github/workflows/stale.yml@main

release:
needs: [ci, lint]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: LegionIO/.github/.github/workflows/release.yml@main
secrets:
rubygems-api-key: ${{ secrets.RUBYGEMS_API_KEY }}
41 changes: 0 additions & 41 deletions .github/workflows/rubocop-analysis.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/sourcehawk-scan.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
/tmp/
/legion/.idea/
/.idea/
*.gem
*.key
# rspec failure tracking
.rspec_status
legionio.key

# git worktrees
.worktrees/
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Standard LegionIO pre-commit configuration
# Install: pre-commit install
# Manual: pre-commit run --all-files
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-json
exclude: Gemfile\.lock
- id: check-merge-conflict

- repo: local
hooks:
- id: rubocop
name: RuboCop (autofix)
entry: scripts/pre-commit-rubocop.sh
language: script
types: [ruby]
pass_filenames: true

- id: ruby-syntax
name: Ruby syntax check
entry: ruby -c
language: system
types: [ruby]
pass_filenames: true
55 changes: 41 additions & 14 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
AllCops:
TargetRubyVersion: 3.4
NewCops: enable
SuggestExtensions: false

Layout/LineLength:
Max: 140
Max: 160

Layout/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: space

Layout/HashAlignment:
EnforcedHashRocketStyle: table
EnforcedColonStyle: table

Metrics/MethodLength:
Max: 50

Metrics/ClassLength:
Max: 1500

Metrics/ModuleLength:
Max: 1500

Metrics/BlockLength:
Max: 50
Metrics/CyclomaticComplexity:
Max: 14
Max: 40
Exclude:
- 'spec/**/*'

Metrics/AbcSize:
Max: 17
Max: 60

Metrics/CyclomaticComplexity:
Max: 15

Metrics/PerceivedComplexity:
Max: 16
Naming/MethodParameterName:
Enabled: false
Max: 17

Style/Documentation:
Enabled: false
AllCops:
TargetRubyVersion: 2.6
NewCops: enable
SuggestExtensions: false

Style/SymbolArray:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always

Naming/FileName:
Enabled: false

Naming/PredicateMethod:
Enabled: false
Gemspec/RequiredRubyVersion:
Enabled: false
47 changes: 47 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# legion-crypt Agent Notes

## Scope

`legion-crypt` handles cryptography and secret workflows for Legion: cipher ops, Vault integration, JWT/JWKS verification, key lifecycle, mTLS, and lease/token renewers.

## Fast Start

```bash
bundle install
bundle exec rspec
bundle exec rubocop
```

## Primary Entry Points

- `lib/legion/crypt.rb`
- `lib/legion/crypt/cipher.rb`
- `lib/legion/crypt/jwt.rb`
- `lib/legion/crypt/jwks_client.rb`
- `lib/legion/crypt/vault.rb`
- `lib/legion/crypt/lease_manager.rb`
- `lib/legion/crypt/token_renewer.rb`
- `lib/legion/crypt/mtls.rb`

## Guardrails

- Treat all changes as security-sensitive. Never log secrets, tokens, private keys, or decrypted plaintext.
- Preserve JWT behavior across HS256/RS256 and external JWKS validation.
- Keep Vault-dependent logic optional and safely guarded for environments without Vault.
- Background renewal/rotation threads must stop cleanly on shutdown and handle failure with bounded retry.
- Maintain compatibility for Kerberos, LDAP, and JWT Vault auth paths.
- Cryptographic defaults and key lifecycle behavior are contract-sensitive; change only with test coverage.

## Known Risks

- Vault-backed cluster secret sync is inconsistent today: config key mismatch, read/write path mismatch, and push happens before the new secret is stored.
- External JWKS verification currently accepts tokens without issuer/audience enforcement unless the caller passes both explicitly; fail closed when touching this path.
- Multi-cluster Vault behavior has correctness gaps around LDAP token propagation, default-cluster routing, and lease-manager client selection.
- SPIFFE X.509 fetch currently falls back to a self-signed SVID on Workload API failure; treat that path as security-sensitive and avoid expanding the fallback behavior.
- `Ed25519` and `Erasure` include helper paths that call `Legion::Crypt::Vault.read/write` directly; verify runtime behavior before relying on those helpers.
- Current specs pass, but some of the highest-risk paths above are under-covered or only covered with mocks that preserve the existing behavior.

## Validation

- Run targeted specs for changed auth/crypto paths first.
- Before handoff, run full `bundle exec rspec` and `bundle exec rubocop`.
Loading
Loading