-
Notifications
You must be signed in to change notification settings - Fork 33
Feature/cross platform installation scripts #351
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
Open
bishoy-at-pieces
wants to merge
26
commits into
main
Choose a base branch
from
feature/cross-platform-installation-scripts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bd82371
feat: Add cross-platform installation scripts
bishoy-at-pieces 5b625cf
feat: Add manage command group with update, status, and uninstall
bishoy-at-pieces 67a58ba
feat: Integrate manage command into CLI
bishoy-at-pieces fd6923b
docs: Update README with installation scripts and manage command
bishoy-at-pieces b9aa430
add update POS command
bishoy-at-pieces 2fe3b41
add pieces status to the manage update command
bishoy-at-pieces edc982f
fix formating
bishoy-at-pieces db83732
add change the structure of the commands (pieces update) to update Pi…
bishoy-at-pieces b263422
Merge branch 'main' into feature/cross-platform-installation-scripts
bishoy-at-pieces 6f49ab1
Merge branch 'main' into feature/cross-platform-installation-scripts
bishoy-at-pieces 8e7d159
fix weak python version parsing
bishoy-at-pieces f5f9503
add new choco and winget in the manage command
bishoy-at-pieces cfc3841
add cleanup function
bishoy-at-pieces 4034f17
Fix security issues in PATH manipulation:
bishoy-at-pieces 3f457ac
ensure reliability in the installation scripts
bishoy-at-pieces 5bfa8af
Merge branch 'main' into feature/cross-platform-installation-scripts
bishoy-at-pieces 927a234
fix colors in the status
bishoy-at-pieces de7d866
ensure reliablity in the sh script
bishoy-at-pieces 0143854
refactor: Modularize manage commands into separate files
bishoy-at-pieces 1e3956b
fix: Skip onboarding for completion command
bishoy-at-pieces d7afe69
Docs & Security Helpers For Inspo
tsavo-at-pieces d5bed75
comment the installer script method until it is save
bishoy-at-pieces 394d274
Merge branch 'main' into feature/cross-platform-installation-scripts
bishoy-at-pieces 9f0c329
add checksums and installation security
bishoy-at-pieces 0bf485f
feat: add dependency logging
bishoy-at-pieces 2ca25d3
fix: resolve Path.exists patching issues in executable location tests
bishoy-at-pieces File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| name: Secure Release Process | ||
|
|
||
| on: | ||
| release: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| generate-checksums: | ||
| name: Generate Checksums | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Generate Installation Script Checksums | ||
| run: | | ||
| echo "Generating SHA256 checksums for installation scripts..." | ||
| sha256sum install_pieces_cli.sh > install_pieces_cli.sh.sha256 | ||
| sha256sum install_pieces_cli.ps1 > install_pieces_cli.ps1.sha256 | ||
|
|
||
| # Create a combined checksum file | ||
| cat > checksums.txt << EOF | ||
| # Pieces CLI Installation Scripts Checksums | ||
| # Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC") | ||
| # Release: ${{ github.ref_name }} | ||
|
|
||
| $(cat install_pieces_cli.sh.sha256) | ||
| $(cat install_pieces_cli.ps1.sha256) | ||
| EOF | ||
|
|
||
| - name: Upload Checksums to Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: | | ||
| install_pieces_cli.sh.sha256 | ||
| install_pieces_cli.ps1.sha256 | ||
| checksums.txt | ||
|
|
||
| sign-artifacts: | ||
| name: Sign Release Artifacts | ||
| runs-on: ubuntu-latest | ||
| needs: generate-checksums | ||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Cosign | ||
| uses: sigstore/cosign-installer@v3 | ||
|
|
||
| - name: Sign Installation Scripts | ||
| run: | | ||
| echo "Signing installation scripts with Cosign..." | ||
|
|
||
| # Sign the shell script | ||
| cosign sign-blob --yes \ | ||
| --output-signature install_pieces_cli.sh.sig \ | ||
| --output-certificate install_pieces_cli.sh.crt \ | ||
| install_pieces_cli.sh | ||
|
|
||
| # Sign the PowerShell script | ||
| cosign sign-blob --yes \ | ||
| --output-signature install_pieces_cli.ps1.sig \ | ||
| --output-certificate install_pieces_cli.ps1.crt \ | ||
| install_pieces_cli.ps1 | ||
|
|
||
| - name: Create Verification Instructions | ||
| run: | | ||
| cat > VERIFY.md << 'EOF' | ||
| # Verification Instructions for Pieces CLI | ||
|
|
||
| ## Checksum Verification | ||
|
|
||
| ### Linux/macOS: | ||
| ```bash | ||
| sha256sum -c install_pieces_cli.sh.sha256 | ||
| ``` | ||
|
|
||
| ### Windows (PowerShell): | ||
| ```powershell | ||
| (Get-FileHash install_pieces_cli.ps1).Hash -eq (Get-Content install_pieces_cli.ps1.sha256).Split()[0] | ||
| ``` | ||
|
|
||
| ## Signature Verification (Advanced) | ||
|
|
||
| Install Cosign: https://docs.sigstore.dev/cosign/installation/ | ||
|
|
||
| ### Verify Shell Script: | ||
| ```bash | ||
| cosign verify-blob \ | ||
| --certificate install_pieces_cli.sh.crt \ | ||
| --signature install_pieces_cli.sh.sig \ | ||
| --certificate-identity-regexp "https://github.com/pieces-app/*" \ | ||
| --certificate-oidc-issuer https://token.actions.githubusercontent.com \ | ||
| install_pieces_cli.sh | ||
| ``` | ||
|
|
||
| ### Verify PowerShell Script: | ||
| ```bash | ||
| cosign verify-blob \ | ||
| --certificate install_pieces_cli.ps1.crt \ | ||
| --signature install_pieces_cli.ps1.sig \ | ||
| --certificate-identity-regexp "https://github.com/pieces-app/*" \ | ||
| --certificate-oidc-issuer https://token.actions.githubusercontent.com \ | ||
| install_pieces_cli.ps1 | ||
| ``` | ||
| EOF | ||
|
|
||
| - name: Upload Signatures to Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: | | ||
| *.sig | ||
| *.crt | ||
| VERIFY.md | ||
|
|
||
| create-requirements-with-hashes: | ||
| name: Create Requirements with Hashes | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install pip-tools | ||
| run: pip install pip-tools | ||
|
|
||
| - name: Generate Requirements with Hashes | ||
| run: | | ||
| # Create requirements.in if it doesn't exist | ||
| if [ ! -f requirements.in ]; then | ||
| echo "pieces-cli" > requirements.in | ||
| fi | ||
|
|
||
| # Compile with hashes | ||
| pip-compile --generate-hashes \ | ||
| --output-file requirements-hashes.txt \ | ||
| requirements.in | ||
|
|
||
| # Add header to the file | ||
| cat > temp.txt << 'EOF' | ||
| # Pieces CLI Requirements with Hash Verification | ||
| # Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC") | ||
| # | ||
| # Install with: | ||
| # pip install --require-hashes --no-deps -r requirements-hashes.txt | ||
| # | ||
| EOF | ||
| cat requirements-hashes.txt >> temp.txt | ||
| mv temp.txt requirements-hashes.txt | ||
|
|
||
| - name: Upload Requirements to Release | ||
| uses: softprops/action-gh-release@v1 | ||
| with: | ||
| files: requirements-hashes.txt | ||
|
|
||
| security-scan: | ||
| name: Security Scan | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run Trivy Security Scan | ||
| uses: aquasecurity/trivy-action@master | ||
| with: | ||
| scan-type: 'fs' | ||
| scan-ref: '.' | ||
| format: 'sarif' | ||
| output: 'trivy-results.sarif' | ||
|
|
||
| - name: Upload Trivy Results | ||
| uses: github/codeql-action/upload-sarif@v2 | ||
| if: always() | ||
| with: | ||
| sarif_file: 'trivy-results.sarif' | ||
|
|
||
| - name: Run Bandit Security Scan | ||
| run: | | ||
| pip install bandit | ||
| bandit -r src/ -f json -o bandit-report.json || true | ||
|
|
||
| # Create summary | ||
| if [ -f bandit-report.json ]; then | ||
| echo "## Bandit Security Scan Results" >> $GITHUB_STEP_SUMMARY | ||
| echo "Issues found: $(jq '.metrics."_totals"."SEVERITY.HIGH"' bandit-report.json)" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 6 months ago
To fix the problem, we need to add a
permissionsblock to thesecurity-scanjob in.github/workflows/release-security.yml. This block should explicitly restrict the permissions of the GITHUB_TOKEN to the minimum necessary for the job—most likelycontents: read, which allows the job to clone the repository but not modify it. The block should be added directly underruns-on: ubuntu-latestin thesecurity-scanjob definition, without modifying the rest of the workflow. No additional dependencies or imports are required for this change.