You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5f0a651
Browse filesBrowse the repository at this point in the historyBrowse files
Mohamed Zeidan
committed
fix(serve): decouple the SMD orchestrator entrypoint from the container's sagemaker
Deploying a CustomOrchestrator with ModelBuilder fails its container health
check at startup with `AttributeError: 'NoneType' object has no attribute
'encode'`, so the Inference Component never reaches InService.
The generated `code/inference.py` did `from sagemaker.serve.validations.
check_integrity import perform_integrity_check`, which resolves against the
*container's* installed sagemaker rather than the SDK that produced the
artifacts. `sagemaker-distribution.json` maps SMD inference to 3.2.0 only, and
that image bundles sagemaker 2.245.0, whose `perform_integrity_check` still
reads `SAGEMAKER_SERVE_SECRET_KEY` and calls `.encode()` on it. The host no
longer sets that variable, and must not: the secret key was removed on purpose
in #5654 / #5656 as the fix for CVE-2026-8596, where it was exposed in
plaintext through the Describe APIs. So the missing `return` in
`prepare_for_smd()` is not the defect, and restoring it would reintroduce the
vulnerability -- the version coupling is the defect.
Inline the digest comparison in the entrypoint instead. It is the same plain
SHA-256 check against `metadata.json` that the host writes, so the integrity
posture is unchanged, but the script no longer imports anything from sagemaker
and therefore cannot drift against whatever version the image carries.
A second, independent mismatch sat behind the first: `_save_model_inference_
spec` pickled `(inference_spec, schema_builder)`, and a v3 SchemaBuilder
pickles with references to `sagemaker.core.*` serializer modules that a 2.x
install cannot import, so `cloudpickle.load` failed even once the integrity
check passed. The orchestrator entrypoint discards the second element of that
tuple, so pickle `(inference_spec, None)` for custom orchestrators.
Also drop the six `self.secret_key = prepare_for_*(...)` assignments and their
`# fix out of scope` / pylint-disable comments, and correct the `-> str`
annotations to `-> None` on all four `prepare_for_*` functions. Those functions
record a digest and have had nothing to return since the CVE fix; the lying
annotation is what led two earlier PRs (#6221, #6222) to try to resurrect the
secret key. Every builder already initializes `self.secret_key = ""` before
calling them, so this is not a behavior change.
Verified by generating the artifacts with this branch and executing the
resulting `inference.py` under a sagemaker 2.245.0 interpreter -- the version
bundled in the image the SDK selects. Before: the reported traceback. After:
the orchestrator loads and serves. Tampered `serve.pkl` and missing
`metadata.json` are still rejected.
Closes#6200
0 commit comments