jwt_auth_cognito 1.0.0.pre.beta.2 → 1.0.0.pre.beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9296db47172be874a7d6204b54c3e5fc8de7f77a77a7e02f4b1d8d4b70bc9b8d
4
- data.tar.gz: 55a4df3b1c9077b9803508ac925715510af9974ef79c40ed097cc0a86eb5b7a3
3
+ metadata.gz: 87913fe629cb36042e7d267bbb0cf3a814a8eb1289971a7192f600be8cf781b3
4
+ data.tar.gz: fe5b1f73de56acc80cc5f646a095093436255ee3b857534d6f5db2b0c34c2274
5
5
  SHA512:
6
- metadata.gz: 19b0aa21809ac6d94c74e358d48d30b4246836610eff67121f41368552a6c385696952aec47a5bb8291c9141e6e0c1de398a028679f1fb05c8a3c71904d58446
7
- data.tar.gz: 4cff441b707184fab34cc16f8368ae67334b8aad174f28b2c1649292a7d2b0b99ad66d60920ef9d503c95a162cd01e2ae621081e0129f38f3dc11c95f40c810c
6
+ metadata.gz: 41826e498618bd98a002e66a4f015610249645a15652528b540545114af8d8336c52f6186edc9a85dcd23159798ed6fdbd8f3038073704ef5fa9c61ec03ed0cf
7
+ data.tar.gz: 643d331d2b80d775d7011f86d1a76614425064d36e0513dc50e18a3a96fb1757c71a13303690d017743d70c1c783c60bd532c060f6b4299c64145855cb8eb98b
data/.rubocop.yml CHANGED
@@ -75,4 +75,7 @@ Metrics/CyclomaticComplexity:
75
75
  Enabled: false
76
76
 
77
77
  Metrics/PerceivedComplexity:
78
+ Enabled: false
79
+
80
+ Metrics/ClassLength:
78
81
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.0-beta.3] - 2025-01-16
11
+
12
+ ### Fixed
13
+
14
+ - **System API Key Bypass**: Fixed appId validation to correctly bypass for system API keys
15
+ - System API keys now have transversal access to all applications as intended
16
+ - App API keys continue to be restricted to their specific application
17
+ - Uses existing `can_access_app?` method from `ApiKeyValidator` for consistent logic
18
+ - Maintains security while allowing system-level administrative access
19
+
20
+ ## [1.0.0-beta.2] - 2025-01-16
21
+
10
22
  ### Improved
11
23
 
12
24
  - **Documentation Enhancement**: Added Redis configuration documentation to main usage patterns
data/CLAUDE.md CHANGED
@@ -145,6 +145,12 @@ ENV['REDIS_CA_CERT'] = "-----BEGIN CERTIFICATE-----..."
145
145
  - **Backward Compatibility**: All functionality works without client secret configuration
146
146
  - **Security Integration**: Secret hash automatically included in blacklist operations when configured
147
147
 
148
+ ### System API Key Support
149
+ - **System API Key Bypass**: API keys with scope 'system' can access any application (transversal access)
150
+ - **App API Key Restrictions**: API keys with scope 'app' are restricted to their specific application
151
+ - **Automatic Detection**: Uses existing `can_access_app?` method from `ApiKeyValidator` for consistent logic
152
+ - **Security Maintained**: Preserves security boundaries while enabling administrative functionality
153
+
148
154
  ## 🚀 Main Usage Pattern with Redis Connection
149
155
 
150
156
  ### ✨ Complete Setup with Redis Connection
@@ -420,6 +420,14 @@ module JwtAuthCognito
420
420
 
421
421
  return { valid: true } unless app_id
422
422
 
423
+ # Check API key access to the application using existing logic
424
+ api_key_data_symbolized = api_key_data.transform_keys(&:to_sym)
425
+ return { valid: false, error: "API key does not have access to application #{app_id}" } unless @api_key_validator.can_access_app?(api_key_data_symbolized, app_id)
426
+
427
+ # System API keys can access any application (bypass user validation)
428
+ return { valid: true } if api_key_data['scope'] == 'system'
429
+
430
+ # For non-system API keys, verify user has access to the application
423
431
  user_id = payload['sub']
424
432
  return { valid: false, error: 'Token missing user ID (sub claim)' } unless user_id
425
433
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JwtAuthCognito
4
- VERSION = '1.0.0-beta.2'
4
+ VERSION = '1.0.0-beta.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jwt_auth_cognito
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.2
4
+ version: 1.0.0.pre.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Optimal