Skip to content

fix: escape input before returning #4810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '30 8 * * *'
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ 'ubuntu-latest' }}
permissions:
security-events: write
packages: read

strategy:
matrix:
include:
- language: python
build-mode: none
- language: java-kotlin
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6
- name: Initialize CodeQL
uses: github/codeql-action/init@4b1d7da102ff94aca014c0245062b1a463356d72
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@4b1d7da102ff94aca014c0245062b1a463356d72
with:
category: "/language:${{matrix.language}}"
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v2.226.1 (2024-07-17)

## v2.226.0 (2024-07-12)

### Features

* Curated hub improvements
* InferenceSpec support for MMS and testing

### Bug Fixes and Other Changes

* ModelBuilder not passing HF_TOKEN to model.
* update image_uri_configs 07-10-2024 07:18:04 PST

## v2.225.0 (2024-07-10)

### Features
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.225.1.dev0
2.226.2.dev0
25 changes: 20 additions & 5 deletions src/sagemaker/config/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
from collections import deque

import logging
import re
import sys
from typing import Callable
from copy import deepcopy


def get_sagemaker_config_logger():
Expand Down Expand Up @@ -67,6 +69,19 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
"""
logger = get_sagemaker_config_logger()

source_value_log_copy = deepcopy(source_value)
config_value_log_copy = deepcopy(config_value)

if isinstance(source_value_log_copy, dict):
for key in source_value_log_copy.keys():
if re.search(r'(secret|password|key|token)', key, re.IGNORECASE):
source_value_log_copy[key] = '***'

if isinstance(config_value_log_copy, dict):
for key in config_value_log_copy.keys():
if re.search(r'(secret|password|key|token)', key, re.IGNORECASE):
config_value_log_copy[key] = '***'

if config_value is not None:

if source_value is None:
Expand All @@ -79,7 +94,7 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
logger.debug(
"Applied value\n config key = %s\n config value that will be used = %s",
config_key_path,
config_value,
config_value_log_copy,
)
else:
logger.info(
Expand All @@ -102,8 +117,8 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
" source value that will be used = %s"
),
config_key_path,
config_value,
source_value,
config_value_log_copy,
source_value_log_copy,

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text. This expression logs [sensitive data (secret)](2) as clear text. This expression logs [sensitive data (secret)](3) as clear text. This expression logs [sensitive data (secret)](4) as clear text.
)
elif source_value is not None and config_value != source_value:
# Sagemaker Config had a value defined that is NOT going to be used
Expand All @@ -117,8 +132,8 @@ def _log_sagemaker_config_single_substitution(source_value, config_value, config
" source value that will be used = %s",
),
config_key_path,
config_value,
source_value,
config_value_log_copy,
source_value_log_copy,

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text. This expression logs [sensitive data (secret)](2) as clear text. This expression logs [sensitive data (secret)](3) as clear text. This expression logs [sensitive data (secret)](4) as clear text.
)
else:
# nothing was specified in the config and nothing is being automatically applied
Expand Down
12 changes: 11 additions & 1 deletion src/sagemaker/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
from sagemaker.interactive_apps import SupportedInteractiveAppTypes
from sagemaker.interactive_apps.tensorboard import TensorBoardApp
from sagemaker.instance_group import InstanceGroup
from sagemaker.model_card.model_card import ModelCard, TrainingDetails
from sagemaker.utils import instance_supports_kms
from sagemaker.job import _Job
from sagemaker.jumpstart.utils import (
Expand Down Expand Up @@ -1797,8 +1798,17 @@ def register(
else:
if "model_kms_key" not in kwargs:
kwargs["model_kms_key"] = self.output_kms_key
model = self.create_model(image_uri=image_uri, **kwargs)
model = self.create_model(image_uri=image_uri, name=model_name, **kwargs)
model.name = model_name
if self.model_data is not None and model_card is None:
training_details = TrainingDetails.from_model_s3_artifacts(
model_artifacts=[self.model_data], sagemaker_session=self.sagemaker_session
)
model_card = ModelCard(
name="estimator_card",
training_details=training_details,
sagemaker_session=self.sagemaker_session,
)
return model.register(
content_types,
response_types,
Expand Down
1 change: 0 additions & 1 deletion src/sagemaker/fw_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
"2.1.0",
"2.1.2",
"2.2.0",
"2.3.0",
"2.3.1",
]

Expand Down
49 changes: 48 additions & 1 deletion src/sagemaker/image_uri_config/huggingface-llm.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"1.2": "1.2.0",
"1.3": "1.3.3",
"1.4": "1.4.5",
"2.0": "2.0.2"
"2.0": "2.2.0"
},
"versions": {
"0.6.0": {
Expand Down Expand Up @@ -672,6 +672,53 @@
"container_version": {
"gpu": "cu121-ubuntu22.04"
}
},
"2.2.0": {
"py_versions": [
"py310"
],
"registries": {
"af-south-1": "626614931356",
"il-central-1": "780543022126",
"ap-east-1": "871362719292",
"ap-northeast-1": "763104351884",
"ap-northeast-2": "763104351884",
"ap-northeast-3": "364406365360",
"ap-south-1": "763104351884",
"ap-south-2": "772153158452",
"ap-southeast-1": "763104351884",
"ap-southeast-2": "763104351884",
"ap-southeast-3": "907027046896",
"ap-southeast-4": "457447274322",
"ca-central-1": "763104351884",
"cn-north-1": "727897471807",
"cn-northwest-1": "727897471807",
"eu-central-1": "763104351884",
"eu-central-2": "380420809688",
"eu-north-1": "763104351884",
"eu-west-1": "763104351884",
"eu-west-2": "763104351884",
"eu-west-3": "763104351884",
"eu-south-1": "692866216735",
"eu-south-2": "503227376785",
"me-south-1": "217643126080",
"me-central-1": "914824155844",
"sa-east-1": "763104351884",
"us-east-1": "763104351884",
"us-east-2": "763104351884",
"us-gov-east-1": "446045086412",
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-west-1": "763104351884",
"us-west-2": "763104351884",
"ca-west-1": "204538143572"
},
"tag_prefix": "2.3.0-tgi2.2.0",
"repository": "huggingface-pytorch-tgi-inference",
"container_version": {
"gpu": "cu121-ubuntu22.04-v2.0"
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/image_uri_config/pytorch-smp.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"2.1": "2.1.2",
"2.2": "2.3.1",
"2.2.0": "2.3.1",
"2.3": "2.4.0"
"2.3.1": "2.4.0"
},
"versions": {
"2.0.1": {
Expand Down
9 changes: 9 additions & 0 deletions src/sagemaker/image_uri_config/pytorch.json
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -1051,6 +1053,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -2329,6 +2333,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -2372,6 +2378,7 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -2415,6 +2422,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down
7 changes: 7 additions & 0 deletions src/sagemaker/image_uri_config/tensorflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -2180,6 +2182,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -4352,6 +4356,8 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-east-1": "303241398832",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down Expand Up @@ -4395,6 +4401,7 @@
"us-gov-west-1": "442386744353",
"us-iso-east-1": "886529160074",
"us-isob-east-1": "094389454867",
"us-isof-south-1": "454834333376",
"us-west-1": "763104351884",
"us-west-2": "763104351884"
},
Expand Down
2 changes: 1 addition & 1 deletion src/sagemaker/jumpstart/hub/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def list_sagemaker_public_hub_models(
f"arn:{info.partition}:"
f"sagemaker:{info.region}:"
f"aws:hub-content/{info.hub_name}/"
f"{HubContentType.MODEL}/{model[0]}"
f"{HubContentType.MODEL.value}/{model[0]}"
)
hub_content_summary = {
"hub_content_name": model[0],
Expand Down
Loading
Loading