deepmodeling / deepmodeling/dpgui
[Code scan] Harden PyPI publish workflow trigger and OIDC permissions
- Dominant language
- Vue
- Stars
- 9
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
This issue was found during a Codex global code scan of the repository.
Baseline commit: e3c5b38a99eb7ab778b5d8c68a5ed4ddf6cf91b3
Problem
The PyPI release workflow runs on every push and pull request, but grants `id-token: write` at the job level before the tag-only publish step. The publish condition also accepts any pushed tag name.
Code references:
https://github.com/deepmodeling/dpgui/blob/e3c5b38a99eb7ab778b5d8c68a5ed4ddf6cf91b3/.github/workflows/release.yml#L1-L17
Relevant snippet:
```yaml
on: [push, pull_request]
...
permissions:
id-token: write
...
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
```
Impact
OIDC token minting permission is available to the whole job even for non-release events, and accidental tags such as `test-release` or `latest` would satisfy the publish gate. This increases the blast radius of the release workflow.
Suggested fix
Split build/test and publish into separate jobs. Give `id-token: write` only to a publish job with a job-level release condition, restrict triggers to version tags such as `v*` or `v[0-9]*`, and validate that the tag matches the package version before publishing.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.