aws-sagemaker-presigned-notebook-url
CreatePresignedNotebookInstanceUrl opens a browser-based Jupyter shell on a running notebook, giving the caller immediate code execution as the notebook's execution role - no iam:PassRole required.
match
A conjunctive graph pattern. Variables (?x) bind node ids; every clause must hold.
where
node_type(?notebook) ==
Notebook
?principal has EFFECTIVE sagemaker:CreatePresignedNotebookInstanceUrl on ?notebook
?notebook is InService (running)
emit
| source type | Identity |
|---|---|
| target type | MachineIdentity |
| source | ?principal |
| target | ?role |
| permissions | sagemaker:CreatePresignedNotebookInstanceUrl |
| conditions | iam_permission service_state |
| state logic | ACTIVE when the notebook is InService and the principal has effective sagemaker:CreatePresignedNotebookInstanceUrl on the notebook ARN. CONDITIONAL(service_state) when the notebook is Stopped/Stopping/Pending. BLOCKED when SCP or permission boundary denies the presigned URL action. |
Narrative
{principal.name} can call sagemaker:CreatePresignedNotebookInstanceUrl on {notebook.name} and open a Jupyter shell running as {role.name} - no iam:PassRole needed. This is a direct, no-prerequisite escalation to the notebook's execution role.
Raw rule rules/derived/aws/sagemaker.yaml
id: aws-sagemaker-presigned-notebook-url
emits: CanExecuteAs
description: "CreatePresignedNotebookInstanceUrl opens a browser-based Jupyter shell on a running notebook,\
\ giving the caller immediate code execution as the notebook's execution role \u2014 no iam:PassRole\
\ required."
match:
- - principal: null
- HasPermission
- notebook: null
- - notebook: null
- ExecutesAs
- role: null
where:
- node_type(?notebook) == Notebook
- ?principal has EFFECTIVE sagemaker:CreatePresignedNotebookInstanceUrl on ?notebook
- ?notebook is InService (running)
emit:
source_type: Identity
target_type: MachineIdentity
source: ?principal
target: ?role
permissions:
- sagemaker:CreatePresignedNotebookInstanceUrl
conditions:
- iam_permission
- service_state
state_logic: ACTIVE when the notebook is InService and the principal has effective sagemaker:CreatePresignedNotebookInstanceUrl
on the notebook ARN. CONDITIONAL(service_state) when the notebook is Stopped/Stopping/Pending. BLOCKED
when SCP or permission boundary denies the presigned URL action.
confidence: min(contributing_confidences) * 0.98
derived_from:
- '<HasPermission edge: principal -> notebook>'
- '<ExecutesAs edge: notebook -> role>'
false_positive_note: "This is the most direct SageMaker escalation path \u2014 it requires NO iam:PassRole.\
\ The presigned URL is valid for up to 12 hours; the Jupyter shell runs with the full execution role\
\ credentials via IMDS. Emit ACTIVE only when the notebook is InService; a Stopped notebook returns\
\ an error on CreatePresignedNotebookInstanceUrl. Cite can-execute-as.yaml for the conceptual derivation\
\ but note that the generic linchpin cannot derive this because the presigned URL creates no CanModifyCode\
\ or CanModifyConfiguration intermediate \u2014 it is a direct execution path. This rule is NOT redundant\
\ with can-execute-as execute-as-via-code-modify."
narrative: "{principal.name} can call sagemaker:CreatePresignedNotebookInstanceUrl on {notebook.name}\
\ and open a Jupyter shell running as {role.name} \u2014 no iam:PassRole needed. This is a direct,\
\ no-prerequisite escalation to the notebook's execution role."