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
16 changes: 15 additions & 1 deletion .github/actions/set-up-legacy-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,22 @@ runs:
with:
default: "${{ inputs.python-version }}"
command: pip install -U pip

- name: Restore PATH on cache hit
if: steps.pyenv-cache.outputs.cache-hit == 'true'
shell: bash
run: |
PYENV_ROOT="/opt/hostedtoolcache/pyenv_root/2.4.20/x64"
PYTHON_BIN="$PYENV_ROOT/versions/${{ inputs.python-version }}/bin"
echo "$PYTHON_BIN" >> $GITHUB_PATH

- name: Verify Python version
shell: bash
run: |
echo "Active Python: $(python --version)"
python --version 2>&1 | grep -q "^Python ${{ inputs.python-version }}" || (echo "ERROR: Expected Python ${{ inputs.python-version }}" && exit 1)
- name: Install dependencies
run: |
python -m pip install flake8 pytest setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
shell: bash
42 changes: 19 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,34 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Verify Python version
run: |
echo "Active Python: $(python --version)"
python --version | grep -q "^Python ${{ matrix.python-version }}" || (echo "ERROR: Expected Python ${{ matrix.python-version }}" && exit 1)
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pyright pyflakes pytest setuptools wheel
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
run: python -m flake8 . --exclude=.venv --ignore=E203,W503,E722,E731 --max-complexity=100 --max-line-length=160
- name: Lint with pyright (type checking)
run: |
pyright cf_remote
run: python -m pyright cf_remote
- name: Lint with pyflakes
run: |
pyflakes cf_remote
run: python -m pyflakes cf_remote
- name: Test with pytest
run: |
pytest
run: python -m pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cf_remote-*.whl
python -m pip install dist/cf_remote-*.whl
- name: Sanity check
run: cf-remote -V
- name: Run docker test
run: |
bash tests/docker/0*.sh
run: bash tests/docker/0*.sh
- name: Run unsafe tests
run: |
bash tests/unsafe/0*.sh
run: bash tests/unsafe/0*.sh

test-legacy:
runs-on: ubuntu-24.04
permissions:
Expand All @@ -77,21 +76,18 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
python -m flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
run: python -m pytest
- name: Install
run: |
python setup.py sdist bdist_wheel
pip install dist/cf_remote-*.whl
python -m pip install dist/cf_remote-*.whl
- name: Sanity check
run: cf-remote -V
- name: Run docker test
run: |
bash tests/docker/0*.sh
run: bash tests/docker/0*.sh
- name: Run unsafe tests
run: |
bash tests/unsafe/0*.sh
run: bash tests/unsafe/0*.sh
6 changes: 3 additions & 3 deletions cf_remote/demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import json
import hashlib
import secrets
from random import SystemRandom
import shutil
import string
import tempfile
Expand Down Expand Up @@ -34,8 +34,8 @@ def generate_password():
salt + password concatenated with no separator. The password is meant
to be shown to the user; only the salt and sha are sent to the host.
"""
password = "".join(secrets.choice(string.ascii_letters) for _ in range(14))
salt = "".join(secrets.choice(string.ascii_letters) for _ in range(10))
password = "".join(SystemRandom().choice(string.ascii_letters) for _ in range(14))
salt = "".join(SystemRandom().choice(string.ascii_letters) for _ in range(10))
sha = hashlib.sha256((salt + password).encode("utf-8")).hexdigest()
return password, salt, sha

Expand Down
Loading