Commit 644fc16
Pravali Uppugunduri
fix: Add HMAC integrity verification for Triton inference handler
Addresses P400136088 Bug 1 and V2146375387 (Triton path).
Three changes:
1. check_integrity.py: Switch from HMAC-SHA256 to plain SHA-256.
- Remove generate_secret_key() — no longer needed
- compute_hash() now uses hashlib.sha256() instead of hmac.new()
- perform_integrity_check() no longer reads SAGEMAKER_SERVE_SECRET_KEY
from environment
2. triton/model.py: Add integrity check in initialize() BEFORE
cloudpickle deserialization. Previously the handler called
cloudpickle.load() with no verification (acknowledged by a TODO
comment). Now reads the file into a buffer, runs
perform_integrity_check(), then deserializes with cloudpickle.loads().
3. triton/server.py: Remove SAGEMAKER_SERVE_SECRET_KEY from container
environment variables in both local and SageMaker deployment modes.
The key is no longer needed since integrity checking uses plain
SHA-256.
4. model_builder_utils.py: Update _hmac_signing() to use plain SHA-256
and stop generating/storing a secret key. Remove generate_secret_key
import.
The integrity check still detects accidental corruption of model
artifacts in S3. The HMAC was providing a false sense of security since
the key was exposed via DescribeModel/DescribeEndpointConfig APIs.1 parent d5eed80 commit 644fc16
File tree
5 files changed
+21
-31
lines changed- sagemaker-serve
- src/sagemaker/serve
- model_server/triton
- validations
- tests/unit
5 files changed
+21
-31
lines changedLines changed: 4 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
135 | 134 | | |
136 | 135 | | |
137 | 136 | | |
| |||
2884 | 2883 | | |
2885 | 2884 | | |
2886 | 2885 | | |
2887 | | - | |
2888 | | - | |
2889 | | - | |
| 2886 | + | |
| 2887 | + | |
2890 | 2888 | | |
2891 | 2889 | | |
2892 | 2890 | | |
2893 | 2891 | | |
2894 | | - | |
| 2892 | + | |
2895 | 2893 | | |
2896 | 2894 | | |
2897 | 2895 | | |
2898 | 2896 | | |
2899 | | - | |
2900 | | - | |
2901 | 2897 | | |
2902 | 2898 | | |
2903 | 2899 | | |
| |||
3100 | 3096 | | |
3101 | 3097 | | |
3102 | 3098 | | |
3103 | | - | |
| 3099 | + | |
3104 | 3100 | | |
3105 | 3101 | | |
3106 | 3102 | | |
| |||
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
31 | 30 | | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | | - | |
137 | 135 | | |
138 | 136 | | |
139 | 137 | | |
Lines changed: 6 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
8 | 6 | | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
21 | 14 | | |
22 | 15 | | |
23 | 16 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 17 | + | |
| 18 | + | |
27 | 19 | | |
28 | 20 | | |
29 | 21 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | | - | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | | - | |
| 279 | + | |
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| |||
0 commit comments