-
Notifications
You must be signed in to change notification settings - Fork 14
Feature/add sensitive metadata #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a9c258c
Add sensitive metadata annotation to resource
a51cd1e
Add JwtToken resource for generating JWT tokens
53eeab3
Bump cuenca-validations to version 2.0.5.dev1
6ae522e
Bump version to 2.0.2.dev1
b286db3
Bump version to 2.0.2.dev2
d351e50
Update cuenca-validations type annotations from Metadata to LogConfig
77c7a5b
Bump version to 2.0.2.dev3
58bab31
Release version 2.0.2
1b24464
Update JwtToken example with redacted JWT tokens
c508ed0
Remove unmasked characters length from OTP secret logging
1a1d12e
Simplify JwtToken test by removing session configuration
e01cab2
Add masked logging configuration for UserLogin ID
abfc35b
Add masked logging configuration for card number
47bd151
Bump version to 2.0.2.dev3
8e04b61
Update cuenca-validations to version 2.1.0
722428a
Change unmasked characters length from ApiKey secret logging
79d9af7
Release version 2.1.0
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import datetime as dt | ||
| from typing import Annotated, ClassVar | ||
|
|
||
| from cuenca_validations.types import LogConfig | ||
| from pydantic import ConfigDict | ||
|
|
||
| from ..http import Session, session as global_session | ||
| from .base import Creatable | ||
|
|
||
|
|
||
| class JwtToken(Creatable): | ||
| _resource: ClassVar = 'token' | ||
|
|
||
| id: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)] | ||
| token: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)] | ||
| created_at: dt.datetime | ||
| api_key_uri: str | ||
|
|
||
| model_config = ConfigDict( | ||
| json_schema_extra={ | ||
| 'example': { | ||
| 'id': 'jwt_XXXX...redacted', | ||
| 'token': 'jwt_XXXX...redacted', | ||
| 'created_at': '2025-01-24T22:34:37.659667', | ||
| 'api_key_uri': '/api_key/AKsczy7tsiRd2IbjL_nYFolQ', | ||
| } | ||
| } | ||
| ) | ||
|
|
||
| @classmethod | ||
| def create(cls, session: Session = global_session) -> 'JwtToken': | ||
| return cls._create(session=session) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| __version__ = '2.0.1' | ||
| __version__ = '2.1.0' | ||
| CLIENT_VERSION = __version__ | ||
| API_VERSION = '2020-03-19' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| requests==2.32.3 | ||
| cuenca-validations==2.0.4 | ||
| cuenca-validations==2.1.0 | ||
| pydantic-extra-types==2.10.2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| interactions: | ||
| - request: | ||
| body: '{"password": "111111"}' | ||
| headers: | ||
| Authorization: | ||
| - DUMMY | ||
| Content-Length: | ||
| - '26' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - cuenca-python/2.0.1 | ||
| X-Cuenca-Api-Version: | ||
| - '2020-03-19' | ||
| method: POST | ||
| uri: https://sandbox.cuenca.com/user_logins | ||
| response: | ||
| body: | ||
| string: '{"success":true,"id":"ULm7x8e0hfQYyUWwM3ysqgTw","last_login_at":"2025-01-27T22:50:04.745000Z"}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '94' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Mon, 27 Jan 2025 23:08:55 GMT | ||
| X-Request-Time: | ||
| - 'value: 0.421' | ||
| x-amz-apigw-id: | ||
| - FEfBLEMtCYcEKuQ= | ||
| x-amzn-Remapped-Connection: | ||
| - keep-alive | ||
| x-amzn-Remapped-Content-Length: | ||
| - '94' | ||
| x-amzn-Remapped-Date: | ||
| - Mon, 27 Jan 2025 23:08:55 GMT | ||
| x-amzn-Remapped-Server: | ||
| - nginx/1.26.2 | ||
| x-amzn-RequestId: | ||
| - 855b6c10-2e41-4b1f-b0fe-6030bd4e0032 | ||
| status: | ||
| code: 201 | ||
| message: Created | ||
| - request: | ||
| body: '{}' | ||
| headers: | ||
| Authorization: | ||
| - DUMMY | ||
| Content-Length: | ||
| - '2' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - cuenca-python/2.0.1 | ||
| X-Cuenca-Api-Version: | ||
| - '2020-03-19' | ||
| X-Cuenca-LoginId: | ||
| - ULm7x8e0hfQYyUWwM3ysqgTw | ||
| method: POST | ||
| uri: https://sandbox.cuenca.com/login_tokens | ||
| response: | ||
| body: | ||
| string: '{"id":"LTqXrT9Z64S329W0D-uJKwmQ"}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '33' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Mon, 27 Jan 2025 23:08:56 GMT | ||
| X-Request-Time: | ||
| - 'value: 0.202' | ||
| x-amz-apigw-id: | ||
| - FEfBSG6ZCYcEPMg= | ||
| x-amzn-Remapped-Connection: | ||
| - keep-alive | ||
| x-amzn-Remapped-Content-Length: | ||
| - '33' | ||
| x-amzn-Remapped-Date: | ||
| - Mon, 27 Jan 2025 23:08:56 GMT | ||
| x-amzn-Remapped-Server: | ||
| - nginx/1.26.2 | ||
| x-amzn-RequestId: | ||
| - 7876a2df-cbdc-40f5-b2b8-c4dcfcdc2d23 | ||
| status: | ||
| code: 201 | ||
| message: Created | ||
| - request: | ||
| body: '{}' | ||
| headers: | ||
| Authorization: | ||
| - DUMMY | ||
| Content-Length: | ||
| - '2' | ||
| Content-Type: | ||
| - application/json | ||
| User-Agent: | ||
| - cuenca-python/2.0.1 | ||
| X-Cuenca-Api-Version: | ||
| - '2020-03-19' | ||
| X-Cuenca-LoginToken: | ||
| - LTqXrT9Z64S329W0D-uJKwmQ | ||
| method: POST | ||
| uri: https://sandbox.cuenca.com/token | ||
| response: | ||
| body: | ||
| string: '{"id":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mzg2MjQxMzYsImlhdCI6MTczODAxOTMzNiwic3ViIjoiQUsyTDh6Y0x2YlRJR1ZsQXdndm9LX1dnIiwidWlkIjoiYWYxM2JmZDgtZGQwMy0xMWVmLThkN2MtMGE1OGE5ZmVhYzAyIn0.tpCxBTcKGWvuRUsKmo7a7IcofgrhVmxIIEiaDBRbAhY","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3Mzg2MjQxMzYsImlhdCI6MTczODAxOTMzNiwic3ViIjoiQUsyTDh6Y0x2YlRJR1ZsQXdndm9LX1dnIiwidWlkIjoiYWYxM2JmZDgtZGQwMy0xMWVmLThkN2MtMGE1OGE5ZmVhYzAyIn0.tpCxBTcKGWvuRUsKmo7a7IcofgrhVmxIIEiaDBRbAhY","created_at":"2025-01-27T23:08:56.372428","api_key_uri":"/api_key/AK2L8zcLvbTIGVlAwgvoK_Wg"}' | ||
| headers: | ||
| Connection: | ||
| - keep-alive | ||
| Content-Length: | ||
| - '576' | ||
| Content-Type: | ||
| - application/json | ||
| Date: | ||
| - Mon, 27 Jan 2025 23:08:56 GMT | ||
| X-Request-Time: | ||
| - 'value: 0.104' | ||
| x-amz-apigw-id: | ||
| - FEfBWHrtiYcEAJA= | ||
| x-amzn-Remapped-Connection: | ||
| - keep-alive | ||
| x-amzn-Remapped-Content-Length: | ||
| - '576' | ||
| x-amzn-Remapped-Date: | ||
| - Mon, 27 Jan 2025 23:08:56 GMT | ||
| x-amzn-Remapped-Server: | ||
| - nginx/1.26.2 | ||
| x-amzn-RequestId: | ||
| - 79544974-46c4-4003-a548-48731d96f703 | ||
| status: | ||
| code: 201 | ||
| message: Created | ||
| version: 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import pytest | ||
|
|
||
| from cuenca import JwtToken | ||
|
|
||
|
|
||
| @pytest.mark.vcr | ||
| def test_jwt_tokens(): | ||
| jwt_token = JwtToken.create() | ||
| assert jwt_token | ||
| assert isinstance(jwt_token.token, str) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.