Skip to content
Closed

test #14

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ad136b5
Merge pull request #2 from mtahle/add/s3syncy
mtahle Mar 18, 2026
afc0abd
chore(ci): Bump actions/upload-artifact from 4 to 7
dependabot[bot] Mar 18, 2026
7ac63ca
chore(ci): Bump actions/setup-python from 4 to 6
dependabot[bot] Mar 18, 2026
377a327
fix: Update CodeQL actions to v4 and fix TruffleHog configuration
Mar 18, 2026
55b2eec
Merge pull request #8 from mtahle/add/s3syncy
mtahle Mar 18, 2026
4527f88
Merge pull request #7 from mtahle/dependabot/github_actions/actions/s…
mtahle Mar 18, 2026
1f43ad7
chore(ci): Bump actions/checkout from 4 to 6
dependabot[bot] Mar 18, 2026
a146659
Merge pull request #4 from mtahle/dependabot/github_actions/actions/u…
mtahle Mar 18, 2026
6173653
Potential fix for code scanning alert no. 3: Unused import
mtahle Mar 18, 2026
fced316
Potential fix for code scanning alert no. 2: Unused import
mtahle Mar 18, 2026
da742f8
Potential fix for code scanning alert no. 2: Unused import
mtahle Mar 18, 2026
6cb9ea2
Potential fix for code scanning alert no. 1: Unused import
mtahle Mar 18, 2026
96ce25a
Potential fix for code scanning alert no. 5: Empty except
mtahle Mar 18, 2026
f13298a
Potential fix for code scanning alert no. 4: Empty except
mtahle Mar 18, 2026
c15111f
Merge pull request #5 from mtahle/dependabot/github_actions/actions/c…
mtahle Mar 18, 2026
e0ddeda
Merge pull request #9 from mtahle/alert-autofix-3
mtahle Mar 18, 2026
a454783
Merge pull request #10 from mtahle/alert-autofix-2
mtahle Mar 18, 2026
889e7d3
Potential fix for pull request finding
mtahle Mar 18, 2026
67bd124
Merge pull request #12 from mtahle/alert-autofix-5
mtahle Mar 18, 2026
75f30a9
Merge pull request #11 from mtahle/alert-autofix-1
mtahle Mar 18, 2026
51f4b82
Merge pull request #13 from mtahle/alert-autofix-4
mtahle Mar 18, 2026
190743b
fix: Restrict SARIF uploads to main branch and tag-based publishing
Mar 18, 2026
7a783a3
feat: Add SonarQube analysis workflow and project properties
Mar 18, 2026
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
10 changes: 2 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ name: Publish to PyPI
on:
release:
types: [published]
push:
branches: [ main ]
paths:
- 'setup.py'
- 'pyproject.toml'
- 's3syncy/**'

jobs:
deploy:
Expand All @@ -18,10 +12,10 @@ jobs:
id-token: write # Required for OIDC

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

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.10"

Expand Down
51 changes: 27 additions & 24 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,33 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
queries: security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v4

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"

trivy-scan:
name: Trivy Vulnerability Scan
runs-on: ubuntu-latest

permissions:
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
Expand All @@ -56,52 +59,52 @@ jobs:
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL,HIGH'

- name: Upload Trivy results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
if: always()
uses: github/codeql-action/upload-sarif@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
sarif_file: 'trivy-results.sarif'
category: 'trivy'

dependency-check:
name: Dependency Check
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Check for vulnerable dependencies
run: |
pip install safety pip-audit
echo "=== Safety Check ==="
echo "=== Safety Check ==="
safety check --json || true
echo "=== Pip Audit Check ==="
echo "=== Pip Audit Check ==="
pip-audit --desc || true

security-headers:
name: Repository Security Check
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Check for secrets
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_kwargs: --debug --only-verified
base: ${{ github.event.before }}
head: ${{ github.sha }}
extra_args: --debug --only-verified
40 changes: 40 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sonar Analysis

on:
pull_request:
branches: [ main ]
types: [opened, synchronize, reopened]
push:
branches: [ main ]
workflow_dispatch:

jobs:
sonar:
name: Build and Analyze
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read

steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run Sonar scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
16 changes: 8 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]

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

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

Expand Down Expand Up @@ -45,10 +45,10 @@ jobs:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.10"

Expand All @@ -65,7 +65,7 @@ jobs:

- name: Upload Bandit report
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: bandit-security-report
path: bandit-report.json
Expand All @@ -75,10 +75,10 @@ jobs:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: "3.10"

Expand All @@ -96,7 +96,7 @@ jobs:
twine check dist/*

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
9 changes: 6 additions & 3 deletions s3syncy/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,11 @@ def run(self) -> None:

self._wait_for_next_scan(scan_interval)
except KeyboardInterrupt:
pass
log.info("KeyboardInterrupt received — initiating graceful shutdown")
self._shutdown_event.set()
finally:
# Ensure shutdown event is always set so background threads can observe shutdown
self._shutdown_event.set()
self._graceful_shutdown()

def stop(self) -> None:
Expand Down Expand Up @@ -351,8 +354,8 @@ def _remove_pid_file(self) -> None:
return
try:
self.pid_file.unlink(missing_ok=True)
except OSError:
pass
except OSError as exc:
log.warning("Failed to remove PID file %s: %s", self.pid_file, exc)

def _write_state(self, status: str, extra: dict[str, Any] | None = None) -> None:
payload: dict[str, Any] = {
Expand Down
3 changes: 1 addition & 2 deletions s3syncy/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import os
import threading
from concurrent.futures import ThreadPoolExecutor, as_completed
from datetime import datetime, timezone
from pathlib import Path
from typing import Dict, List, Optional, Set
from typing import Dict, Optional, Set

import boto3
from botocore.config import Config as BotoConfig
Expand Down
2 changes: 1 addition & 1 deletion s3syncy/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from contextlib import contextmanager
from datetime import datetime, timezone
from pathlib import Path
from typing import Generator, List, Optional, Tuple
from typing import Generator, List, Optional

log = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonar.projectKey=mtahle_s3syncy_b03f9071-c443-4d24-8a6a-661ff0c584a1
Loading