mirror of
https://github.com/azaion/loader.git
synced 2026-04-22 09:36:32 +00:00
Quality cleanup refactoring
Made-with: Cursor
This commit is contained in:
@@ -11,7 +11,7 @@ Handles the encrypted Docker image archive workflow: downloading a key fragment
|
||||
| Function | Signature | Description |
|
||||
|------------------------|------------------------------------------------------------------------|----------------------------------------------------------|
|
||||
| `download_key_fragment`| `(resource_api_url: str, token: str) -> bytes` | GET request to `/binary-split/key-fragment` with Bearer auth |
|
||||
| `decrypt_archive` | `(encrypted_path: str, key_fragment: bytes, output_path: str) -> None` | AES-256-CBC decryption with SHA-256 derived key; strips PKCS7 padding |
|
||||
| `decrypt_archive` | `(encrypted_path: str, key_fragment: bytes, output_path: str) -> None` | AES-256-CBC stream decrypt with SHA-256 derived key; PKCS7 removed in-pipeline via unpadder |
|
||||
| `docker_load` | `(tar_path: str) -> None` | Runs `docker load -i <tar_path>` subprocess |
|
||||
| `check_images_loaded` | `(version: str) -> bool` | Checks all `API_SERVICES` images exist for given version tag |
|
||||
|
||||
@@ -26,9 +26,8 @@ Handles the encrypted Docker image archive workflow: downloading a key fragment
|
||||
### `decrypt_archive`
|
||||
1. Derives AES key: `SHA-256(key_fragment)` → 32-byte key
|
||||
2. Reads first 16 bytes as IV from encrypted file
|
||||
3. Decrypts remaining data in 64KB chunks using AES-256-CBC
|
||||
4. After decryption, reads last byte of output to determine PKCS7 padding length
|
||||
5. Truncates output file to remove padding
|
||||
3. Streams ciphertext in 64KB chunks through AES-256-CBC decryptor
|
||||
4. Feeds decrypted chunks through `padding.PKCS7(128).unpadder()`; writes unpadded bytes to the output file (`finalize` on decryptor and unpadder at end)
|
||||
|
||||
### `check_images_loaded`
|
||||
Iterates all 7 service image names, runs `docker image inspect <name>:<version>` for each. Returns `False` on first missing image.
|
||||
@@ -36,7 +35,7 @@ Iterates all 7 service image names, runs `docker image inspect <name>:<version>`
|
||||
## Dependencies
|
||||
|
||||
- **Internal**: none (leaf module)
|
||||
- **External**: `hashlib`, `os`, `subprocess` (stdlib), `requests` (2.32.4), `cryptography` (44.0.2)
|
||||
- **External**: `hashlib`, `subprocess` (stdlib), `requests` (2.32.4), `cryptography` (44.0.2)
|
||||
|
||||
## Consumers
|
||||
|
||||
|
||||
Reference in New Issue
Block a user