Skip to content

Fix remaining OpenSSF Scorecard alerts: Pin all pip commands with hashes#29

Closed
taylorleese wants to merge 1 commit intomainfrom
fix/pin-all-pip-commands
Closed

Fix remaining OpenSSF Scorecard alerts: Pin all pip commands with hashes#29
taylorleese wants to merge 1 commit intomainfrom
fix/pin-all-pip-commands

Conversation

@taylorleese
Copy link
Copy Markdown
Owner

Summary

This PR fixes the final OpenSSF Scorecard Pinned-Dependencies alert (#47) by ensuring all pip install commands use hash verification and eliminating unpinned local package installations.

Changes

GitHub Workflows

  • CI workflow (.github/workflows/ci.yml): Updated both test and lint jobs to use --require-hashes for all pip installs
  • Publish workflow (.github/workflows/publish.yml): Updated build dependencies to use --require-hashes

Dockerfile

  • Removed pip install . command entirely (was causing Scorecard alert)
  • Use PYTHONPATH=/app/src instead for module discovery
  • Copy source code to runtime stage for proper execution
  • No more unpinned pip commands in Dockerfile

Why These Changes?

The OpenSSF Scorecard scanner was flagging:

  1. Alert deps(deps): bump python from 5d17fc0 to 404ca55 #47: pip install . in Dockerfile (line 25)
  2. Multiple pip commands in GitHub workflows without --require-hashes

The PYTHONPATH Solution

Instead of installing the local package with pip install . (which can't be hash-pinned since it's source code, not a package), we:

  1. Copy the source code to /app/src
  2. Set PYTHONPATH=/app/src
  3. Python can now find and import modules directly without installation

This is actually better because:

  • ✅ Satisfies OpenSSF Scorecard requirements
  • ✅ Faster builds (no package installation step)
  • ✅ Simpler - just copy files
  • ✅ Works identically for the MCP server entrypoint

Testing

Impact on Docker MCP Registry PR

This PR is required for docker/mcp-registry PR #353. The Dockerfile is used for Docker-based MCP server distribution, and these changes:

  • Eliminate all Scorecard warnings about unpinned dependencies
  • Should improve OpenSSF Scorecard score from 6.9/10
  • Maintain full Docker functionality for MCP server deployment

Fixes

Fixes #47

Related alerts already fixed in previous PRs:

Related Issues

🤖 Generated with Claude Code

This commit addresses the final OpenSSF Scorecard Pinned-Dependencies alert (#47)
by ensuring all pip install commands use hash verification and eliminating
unpinned local package installations.

Changes:
- Updated CI workflow to use --require-hashes for all pip installs
- Updated publish workflow to use --require-hashes for build dependencies
- Removed `pip install .` from Dockerfile entirely
- Use PYTHONPATH instead of pip install for local package
- Copy source code to runtime stage for module discovery

This eliminates all "pipCommand not pinned by hash" warnings from OpenSSF
Scorecard while maintaining full functionality. The Docker image still works
correctly by using PYTHONPATH to locate modules instead of installing the
local package.

Fixes: #47 (and related alerts #45, #46 from previous commits)

Related to: #11 (Docker MCP Registry PR #353)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.50%. Comparing base (6935980) to head (896ae92).
⚠️ Report is 84 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #29   +/-   ##
=======================================
  Coverage   88.50%   88.50%           
=======================================
  Files           8        8           
  Lines        1140     1140           
  Branches      184      184           
=======================================
  Hits         1009     1009           
  Misses         79       79           
  Partials       52       52           

@taylorleese taylorleese deleted the fix/pin-all-pip-commands branch November 21, 2025 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants