-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Encryption key error handling fix (#567)
* Encryption key error handling fix, platform service error handling and logging improvement * Minor typehint fix * Fix for subscription expiry behaviour * Fixed merge related conflicts
- Loading branch information
1 parent
ae45e2a
commit b3e3f4b
Showing
15 changed files
with
206 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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,34 @@ | ||
from enum import Enum | ||
from typing import Optional | ||
|
||
from rest_framework.exceptions import APIException | ||
|
||
|
||
class InvalidEncryptionKey(APIException): | ||
status_code = 403 | ||
default_detail = ( | ||
"Platform encryption key for storing sensitive credentials has changed! " | ||
"All encrypted entities are inaccessible. Please inform the " | ||
"platform admin immediately." | ||
) | ||
|
||
class Entity(Enum): | ||
ADAPTER = "adapter" | ||
CONNECTOR = "connector" | ||
|
||
def __init__( | ||
self, | ||
entity: Optional[Entity] = None, | ||
detail: Optional[str] = None, | ||
code: Optional[str] = None, | ||
) -> None: | ||
if entity == self.Entity.ADAPTER: | ||
detail = self.default_detail.replace("sensitive", "adapter").replace( | ||
"encrypted entities", "adapters" | ||
) | ||
elif entity == self.Entity.CONNECTOR: | ||
detail = self.default_detail.replace("sensitive", "connector").replace( | ||
"encrypted entities", "connectors" | ||
) | ||
|
||
super().__init__(detail, code) |
This file contains 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 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 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 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
Oops, something went wrong.