Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 12 additions & 9 deletions .github/workflows/cross-platform-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

defaults:
run:
shell: bash
Expand All @@ -29,10 +32,10 @@ jobs:
- {os: ubuntu-24.04, python-version: '3.13'}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -81,10 +84,10 @@ jobs:
os: [ubuntu-24.04, macos-latest, macos-15-intel, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v10.3.3

- name: Install with uv
run: uv tool install .
Expand Down Expand Up @@ -115,7 +118,7 @@ jobs:
os: [ubuntu-24.04, macos-latest, macos-15-intel, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Install with pipx
run: |
Expand All @@ -138,21 +141,21 @@ jobs:
lowest-deps:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v10.3.3

- name: Run tests
run: uv run --resolution lowest-direct --python 3.10 pytest

lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up uv
uses: astral-sh/setup-uv@v6
uses: astral-sh/setup-uv@v10.3.3

- name: Run pylint
run: uv run pylint --errors-only modcli tests
2 changes: 1 addition & 1 deletion modcli/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def publish(project_file: str, packages_path: str, keep_environment: bool=False,
raise Exception(f'Error: {result.text}')
checksum = result.text.lstrip('"').rstrip('"')

result_checksum = md5(data).hexdigest()
result_checksum = md5(data, usedforsecurity=False).hexdigest()
if checksum == result_checksum:
click.echo('Checksum match ok!')
else:
Expand Down
12 changes: 10 additions & 2 deletions modcli/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ def json(self):
return json.loads(self.text)


def _check_scheme(url):
# urlopen also opens file:// and other schemes; URLs here come from the config and the server
if not url.lower().startswith(('http://', 'https://')):
raise Exception(f'Invalid URL: {url}')


def get(url):
_check_scheme(url)
try:
with urlopen(url) as response:
with urlopen(url) as response: # nosec B310
return Response(response.status, response.read())
except HTTPError as e:
return Response(e.code, e.read())


def post(url, data=None, json_data=None, headers=None):
_check_scheme(url)
headers = headers or {}

if json_data is not None:
Expand All @@ -34,7 +42,7 @@ def post(url, data=None, json_data=None, headers=None):
request = Request(url, data=body, headers=headers, method='POST')

try:
with urlopen(request) as response:
with urlopen(request) as response: # nosec B310
return Response(response.status, response.read())
except HTTPError as e:
return Response(e.code, e.read())
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Homepage = "https://mod.audio/"

[dependency-groups]
dev = [
"pylint>=3.0",
"pylint>=4.0.9",
"pytest>=8.0",
]

Expand Down
Loading
Loading