Conversation
* KSM 566 KSM Python SDK: Add parsing for ksm tokens with prefix (#679) * Bump up version to 16.6.7 * KSM-566 Added parsing for KSM tokens with prefix * Fixed test for new harcoded client version
* KSM-628 Added GraphSync links * Adjusted requestLinks in payload
Added 533 changelog
Adding missing revision attribute to Record mock. It is consumed via kwarg for maximum compatibility
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
* Merge Python SDK and Helper publishing pipelines with SBOM generation - Combined SDK and Helper publishing into single workflow - Added proper SBOM generation for both packages with all dependencies - Fixed version detection to use setup.py versions (17.0.0 for SDK, 1.0.6 for Helper) - Enhanced SBOM workflow to scan Python virtual environments for complete dependency detection - Commented out old Helper workflow with migration notice * Update .github/workflows/reusable.sbom.workflow.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| runs-on: ubuntu-latest | ||
| outputs: | ||
| sdk-version: ${{ steps.extract-sdk-version.outputs.version }} | ||
| helper-version: ${{ steps.extract-helper-version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Extract SDK version | ||
| id: extract-sdk-version | ||
| working-directory: ./sdk/python/core | ||
| run: | | ||
| VERSION=$(python3 setup.py --version 2>/dev/null || grep -Po 'version\s*=\s*["\x27]\K[^\x27"]*' setup.py) | ||
| echo "SDK Version: $VERSION" | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Extract Helper version | ||
| id: extract-helper-version | ||
| working-directory: ./sdk/python/helper | ||
| run: | | ||
| VERSION=$(python3 setup.py --version 2>/dev/null || grep -Po 'version\s*=\s*["\x27]\K[^\x27"]*' setup.py) | ||
| echo "Helper Version: $VERSION" | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
|
|
||
| # Generate and upload SBOM for SDK | ||
| generate-sdk-sbom: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To resolve the issue, you should explicitly declare the permissions: block at the root of the workflow. This will apply to all jobs unless they override it themselves. The minimal required permission for most jobs that only need to check out code is contents: read. Unless a job requires more (e.g., to create releases or modify issues/pull-requests), contents: read is sufficient and safe.
How to fix:
- At the very top level of
.github/workflows/publish.pypi.sdk.yml(below thename:field, and usually above or below theon:field), add:permissions: contents: read
- If later you discover some jobs need more, you can add a more specific
permissions:block under that job.
What to change:
- Only edit the workflow YAML as described, no additional methods, imports, or definitions are needed.
| @@ -1,4 +1,6 @@ | ||
| name: Publish to PyPI (Python SDK & Helper) | ||
| permissions: | ||
| contents: read | ||
| on: | ||
| workflow_dispatch: | ||
|
|
| needs: get-versions | ||
| uses: ./.github/workflows/reusable.sbom.workflow.yml | ||
| with: | ||
| working-directory: ./sdk/python/core | ||
| project-name: keeper-secrets-manager-python | ||
| project-type: python | ||
| project-version: ${{ needs.get-versions.outputs.sdk-version }} | ||
| sbom-format: spdx-json | ||
| additional-labels: ksm,sdk,python,security | ||
| secrets: | ||
| MANIFEST_TOKEN: ${{ secrets.MANIFEST_TOKEN }} | ||
|
|
||
| # Generate and upload SBOM for Helper | ||
| generate-helper-sbom: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To address the issue, we should add a permissions: block at the workflow root (so it applies to all jobs) with the minimum permissions required for these jobs. Given the actions performed, many jobs likely only require contents: read (for reading source code), while only those jobs that need to push, create releases, etc. would require elevated write permissions. Since the provided block does not show jobs requiring write actions, a minimal permissions: is sufficient. The fix is to insert, after the name: and on: blocks (before jobs:), a permissions: block such as:
permissions:
contents: readThis limits GITHUB_TOKEN to read-only access to repository contents (source code, etc.), following least privilege principles. If additional permissions are later needed by specific jobs, they can override this at the job level.
Steps:
- Insert a
permissions:block after thename:andon:blocks, beforejobs:. - Use the minimal set (
contents: read).
| @@ -2,6 +2,9 @@ | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # Extract versions for both SDK and Helper | ||
| get-versions: |
| needs: get-versions | ||
| uses: ./.github/workflows/reusable.sbom.workflow.yml | ||
| with: | ||
| working-directory: ./sdk/python/helper | ||
| project-name: keeper-secrets-manager-helper | ||
| project-type: python | ||
| project-version: ${{ needs.get-versions.outputs.helper-version }} | ||
| sbom-format: spdx-json | ||
| additional-labels: ksm,helper,python,security | ||
| secrets: | ||
| MANIFEST_TOKEN: ${{ secrets.MANIFEST_TOKEN }} | ||
|
|
||
| # Publish SDK to PyPI | ||
| publish-sdk: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
To fix this problem, the workflow file should have an explicit permissions key defined, either at the top (workflow-level, applies to all jobs unless they override) or on each job as required. Since most of these jobs are using basic tasks and do not appear to push or create content or releases, the minimum necessary is usually contents: read. This setting adheres to the principle of least privilege for most CI workflows.
How to fix:
- Add the following block at the top (for root-level, applies to all jobs):
permissions: contents: read
- Insert this block after the workflow
nameandon:section (i.e., beforejobs:).
Implementation steps:
- Edit
.github/workflows/publish.pypi.sdk.yml. - Insert the above lines between lines 3 and 5 (after the last
on:line, beforejobs:). - No other changes are required unless further restrictions are desired for individual jobs.
| @@ -2,6 +2,9 @@ | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| # Extract versions for both SDK and Helper | ||
| get-versions: |
Uh oh!
There was an error while loading. Please reload this page.