Skip to content

Commit 807b790

Browse files
authored
fix: Harden SDK dependencies, credential logging, and CI (Python 3.11+) (#476)
* fix(security): update ca-certificates in devcontainer image (CVE-2026-111943) * fix(security): bump Pillow to 12.3.0 (CVE-2026-42311, CVE-2026-25990) * fix(security): bump Pillow to 13.0.0 (CVE-2026-96639 and 38 more), require Python 3.11 Pillow 12.x is affected by 39 advisories fixed only in Pillow 13.0.0, which requires Python >= 3.11. Python 3.10 reached end of life in October 2026. - pyproject.toml: python ^3.11, pillow ^13.0.0, black target py311 - poetry.lock: targeted re-lock; pillow 13.0.0, drops py3.10-only backports (async-timeout, exceptiongroup, tomli); no other versions moved - CI: drop 3.10 from unit/integration matrices; publish on 3.11 - devcontainer base python:3.10 -> python:3.11; tox, README, CONTRIBUTING * SEC-3320 Patch SDK dependencies and prevent credential disclosure * SEC-3320 Pin devcontainer base and apply OS security updates * SEC-3320 Remove unused container tools and run as non-root * bump to 1.6.0
1 parent b631c0e commit 807b790

32 files changed

Lines changed: 2841 additions & 1944 deletions

‎.devcontainer/Dockerfile‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
FROM mcr.microsoft.com/devcontainers/python:3.10
1+
FROM mcr.microsoft.com/devcontainers/python:3.11@sha256:1eb48ffd772f0618d66844eff8cbfd9914785be25f6a936d0756a1ddfc866cc3
22

3-
ENV PYTHONUNBUFFERED 1
3+
ENV PYTHONUNBUFFERED=1
44

5-
RUN pipx install poetry==1.8.3
5+
# Apply available OS security fixes, including the CA bundle (CVE-2026-111943)
6+
RUN apt-get update \
7+
&& apt-get upgrade -y --no-install-recommends \
8+
&& apt-get install -y --no-install-recommends --only-upgrade ca-certificates \
9+
&& rm -rf /var/lib/apt/lists/*
610

7-
# Install pre-commit
8-
RUN pip install pre-commit
11+
# Use the project's locked tools instead of stale copies inherited from the base.
12+
RUN for tool in autopep8 bandit black flake8 mypy pipenv pycodestyle pydocstyle pylint pytest virtualenv yapf; do \
13+
pipx uninstall "$tool"; \
14+
done \
15+
&& pipx install poetry==2.5.1
16+
17+
# Refresh the installer inherited from the base image, then install dev tooling.
18+
RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel \
19+
&& python -m pip install --no-cache-dir --upgrade "GitPython>=3.1.62" pre-commit \
20+
&& python -m pip --python /usr/local/py-utils/shared/bin/python install --no-cache-dir --upgrade pip setuptools wheel \
21+
&& python -m pip --python /usr/local/py-utils/venvs/pipx/bin/python install --no-cache-dir --upgrade pip setuptools wheel \
22+
&& python -m pip --python /usr/local/py-utils/venvs/poetry/bin/python install --no-cache-dir --upgrade pip setuptools wheel
23+
24+
USER vscode

‎.devcontainer/devcontainer.json‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
"build": {
44
"dockerfile": "Dockerfile"
55
},
6-
"features": {
7-
"ghcr.io/devcontainers/features/git:1": {},
8-
"ghcr.io/devcontainers/features/node:1": {},
9-
"ghcr.io/devcontainers/features/java:1": {
10-
"version": "17",
11-
"installMaven": false,
12-
"installGradle": false
13-
}
14-
},
156
"customizations": {
167
"vscode": {
178
"extensions": [
@@ -35,6 +26,6 @@
3526
}
3627
}
3728
},
38-
"postCreateCommand": "poetry install",
29+
"postCreateCommand": "poetry install --with quality,tests",
3930
"remoteUser": "vscode"
4031
}

‎.github/workflows/_integration_tests.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
env:
19-
POETRY_VERSION: "2.1.1"
19+
POETRY_VERSION: "2.5.1"
20+
21+
permissions:
22+
contents: read
2023

2124
jobs:
2225
build:
2326
runs-on: ubuntu-latest
2427
strategy:
2528
matrix:
2629
python-version:
27-
- "3.10"
2830
- "3.11"
2931
- "3.12"
3032
name: "integration_test python v${{ matrix.python-version }}"
@@ -37,6 +39,7 @@ jobs:
3739
python-version: ${{ matrix.python-version }}
3840
poetry-version: ${{ env.POETRY_VERSION }}
3941
cache-key: core
42+
working-directory: .
4043

4144
- name: Install together with dependencies
4245
shell: bash

‎.github/workflows/_tests.yml‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
env:
19-
POETRY_VERSION: "1.7.1"
19+
POETRY_VERSION: "2.5.1"
20+
21+
permissions:
22+
contents: read
2023

2124
jobs:
2225
build:
2326
runs-on: ubuntu-latest
2427
strategy:
2528
matrix:
2629
python-version:
27-
- "3.10"
2830
- "3.11"
2931
- "3.12"
3032
name: "unittest python v${{ matrix.python-version }}"
@@ -37,6 +39,7 @@ jobs:
3739
python-version: ${{ matrix.python-version }}
3840
poetry-version: ${{ env.POETRY_VERSION }}
3941
cache-key: core
42+
working-directory: .
4043

4144
- name: Install dependencies
4245
shell: bash

‎.github/workflows/check_code_quality.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1212
cancel-in-progress: true
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
pre-commit:
1619
runs-on: ubuntu-latest

‎.github/workflows/upload-to-pypi.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ on:
55
types: [published]
66

77
env:
8-
POETRY_VERSION: "2.1.1"
8+
POETRY_VERSION: "2.5.1"
9+
10+
permissions:
11+
contents: read
912

1013
jobs:
1114
build:
1215
runs-on: ubuntu-latest
1316
strategy:
1417
matrix:
15-
python-version: ["3.10"]
18+
python-version: ["3.11"]
1619

1720
steps:
1821
- uses: actions/checkout@v4
@@ -22,6 +25,7 @@ jobs:
2225
python-version: ${{ matrix.python-version }}
2326
poetry-version: ${{ env.POETRY_VERSION }}
2427
cache-key: core
28+
working-directory: .
2529

2630
- name: Set up cache
2731
uses: actions/cache@v4

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ repos:
99
- id: check-merge-conflict
1010
- id: check-toml
1111
- repo: https://github.com/psf/black
12-
rev: 24.3.0
12+
rev: 26.10.1
1313
hooks:
1414
- id: black
1515
- repo: https://github.com/pre-commit/mirrors-mypy
1616
rev: 'v1.8.0'
1717
hooks:
1818
- id: mypy
1919
args: [--strict]
20-
additional_dependencies: [types-requests, types-tqdm, types-tabulate, types-click, types-filelock, types-Pillow, rich, pyarrow-stubs, pydantic, aiohttp]
20+
additional_dependencies: [types-requests, types-tqdm, types-tabulate, types-click, types-filelock, "pillow>=13.0.0,<14", rich, pyarrow-stubs, pydantic, aiohttp]
2121
exclude: ^tests/

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Pull requests cannot land without passing the formatting, linting, and testing c
3232

3333
This project utilizes [Poetry](https://python-poetry.org/) v1.6.1+ as a dependency manager.
3434

35-
❗Note: *Before installing Poetry*, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n together python=3.10`)
35+
❗Note: *Before installing Poetry*, if you use `Conda`, create and activate a new Conda env (e.g. `conda create -n together python=3.11`)
3636

3737
Install Poetry: **[documentation on how to install it](https://python-poetry.org/docs/#installation)**.
3838

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
3535
> Note: You are looking at the codebase for Together Python V1. The latest Together Python SDK can be found **[here.](https://github.com/togethercomputer/together-py)**
3636
37-
The [Together Python API Library](https://pypi.org/project/together/) is the official Python client for Together's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.10+ applications with easy to use synchronous and asynchronous clients.
37+
The [Together Python API Library](https://pypi.org/project/together/) is the official Python client for Together's API platform, providing a convenient way for interacting with the REST APIs and enables easy integrations with Python 3.11+ applications with easy to use synchronous and asynchronous clients.
3838
3939
4040

‎examples/tokenize_data.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
PreTrainedTokenizerBase,
1212
)
1313

14-
1514
# see default of ignore_index
1615
# for https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html#torch.nn.CrossEntropyLoss
1716
LOSS_IGNORE_INDEX = -100

0 commit comments

Comments
 (0)