Skip to content

Dependabot hardening: Fix CI checks, adopt sfw-action#217

Open
lelia wants to merge 3 commits into
mainfrom
lelia/fix-dependabot-checks
Open

Dependabot hardening: Fix CI checks, adopt sfw-action#217
lelia wants to merge 3 commits into
mainfrom
lelia/fix-dependabot-checks

Conversation

@lelia
Copy link
Copy Markdown
Contributor

@lelia lelia commented May 29, 2026

Summary

Follow-up to #207. Once the Dependabot review hardening went live on real Dependabot PRs (#212, #213, #215, #216), a few CI issues surfaced. This PR fixes them.

1. Skip PR Preview + Version Check on Dependabot PRs

Both failed on every Dependabot PR for reasons that don't apply to dependency bumps:

  • PR Preview publishes a dev build to Test PyPI + Docker Hub. On a dependency bump there's no version change, so the Test PyPI publish 400s (File already exists), and it needs publish secrets a Dependabot PR shouldn't carry.
  • Version Check requires an incremented app version, but Dependabot PRs touch uv.lock / pyproject.toml without bumping socketsecurity's version, so the check always fails.

Fix: job-level if: github.event.pull_request.user.login != 'dependabot[bot]' on each (same pattern as the existing e2e-test.yml skip). They report "skipped" (not failing/blocking) and stay fully in force for human PRs. No branch-protection changes.

Rationale: this is a published library with loose pyproject.toml constraints — Dependabot's uv.lock bumps don't change the artifact users pip install. So they don't warrant a release; they ride into the next maintainer-authored versioned release.

2. Use the official Socket Firewall setup action

Replaced the hand-rolled npm install -g sfw in all three sfw smoke jobs with the official socketdev/action (SHA-pinned to v1.3.2, mode: firewall-free) — the documented GitHub Actions integration.

This is the right fix for the symptom where python-sfw-smoke looked like a no-op (no firewall output): the previous ad-hoc global install is prone to the Wrapper-Mode routing gap where sfw fails to proxy files.pythonhosted.org fetches (tracked upstream as ENG-4871). The official action wires routing up correctly. firewall-free is anonymous (no API token), which is what makes it safe on untrusted/Dependabot PRs.

Also pinned sfw uv sync --locked so the Python job verifies the exact uv.lock set and fails on drift rather than silently re-resolving.

Bonus: the Python jobs no longer need actions/setup-node (the action provides sfw directly); the npm-fixture job keeps it since npm install needs node.

Our setup is Wrapper Mode + free edition + no CodeArtifact, so the Registry-Mode + CodeArtifact uv sync/uv lock issue (CE-171) does not apply.

Not changed

The per-ecosystem gating in dependabot-review.yml is correct as-is: a Python-deps PR runs python-sfw-smoke and skips the npm/pypi-fixture/docker jobs (they only run when those manifests change). GitHub Actions bumps get workflow-notice rather than an sfw job, since sfw gates package-manager installs, not Action pins.

Test plan

  • Both workflow files parse as valid YAML
  • socketdev/action ref resolves to a real commit (v1.3.2 = ba6de6c)
  • Next Dependabot PR: preview + check_version show "skipped"; python-sfw-smoke runs via the official action; verify Socket Firewall output is now visible
  • Human PR: preview + check_version still run as before

Both workflows failed on every Dependabot PR for reasons that don't apply to
dependency bumps:

- PR Preview publishes a dev build to Test PyPI + Docker Hub. On a dependency
  bump there's no version change, so the publish 400s ("File already exists")
  -- and it needs publish secrets a Dependabot PR shouldn't carry anyway.
- Version Check requires an incremented app version, but Dependabot PRs touch
  uv.lock / pyproject.toml without bumping socketsecurity's version, so the
  check always fails.

Add a job-level `if` to skip each on `dependabot[bot]`-authored PRs (same
pattern already used for e2e-test.yml). Job-level skips report as "skipped"
rather than blocking, and these stay required for human-authored PRs.

Follow-up to #207 (the Dependabot review hardening), addressing fallout
observed once that config went live on real Dependabot PRs.

Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
@lelia lelia requested a review from a team as a code owner May 29, 2026 22:51
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 29, 2026

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.3.0.dev13

Docker image: socketdev/cli:pr-217

@lelia lelia changed the title Skip PR Preview and Version Check on Dependabot PRs Dependabot review workflow fixes May 29, 2026
lelia added 2 commits May 29, 2026 19:06
`sfw uv sync` is the intended way to route uv through Socket Firewall (per
Socket's own uv-wrapper guidance), so the python-sfw-smoke job was already
exercising the firewall -- uv's integration is just quieter than npm/pip
(no "N packages fetched" footer), which made it look like a no-op.

Add `--locked` so the check verifies the exact uv.lock set and fails on
lockfile drift instead of silently re-resolving to newer versions than the
PR locked. This makes the firewall inspect precisely what would be installed
and aligns with the deterministic-verification guidance for uv-based repos.

Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Replace the hand-rolled `npm install -g sfw` in all three sfw smoke jobs with
the official setup action (socketdev/action@v1.3.2, mode: firewall-free).

Why:
- It's the documented GitHub Actions integration for Socket Firewall Free and
  wires up sfw routing correctly, rather than relying on an ad-hoc global npm
  install. This is the right mitigation for the class of Wrapper-Mode routing
  gaps where sfw can fail to proxy fetches from files.pythonhosted.org
  (tracked upstream as ENG-4871) -- exactly the "no interception" symptom that
  made the python job look like a no-op.
- The Python jobs no longer need actions/setup-node at all (the action
  provides sfw directly), so those steps are dropped; the npm fixture job keeps
  setup-node since `npm install` needs it.

Setup mode is firewall-free (anonymous, no API token) -- unchanged, and the
reason this is safe to run on Dependabot/untrusted PRs.

Our setup is Wrapper Mode + free edition + no CodeArtifact, so the Registry
Mode + CodeArtifact `uv sync`/`uv lock` issue (CE-171) does not apply.

Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
@socket-security-staging
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub/​socketdev/​action@​ba6de6cc0565af1f42295590380973573297e31f96100100100100

View full report

@lelia lelia changed the title Dependabot review workflow fixes Harden Dependabot CI: skip Preview/Version Check, adopt official Socket Firewall action May 29, 2026
@lelia lelia changed the title Harden Dependabot CI: skip Preview/Version Check, adopt official Socket Firewall action Dependabot hardening: Fix CI checks, adopt sfw-action May 29, 2026
@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgithub/​socketdev/​action@​ba6de6cc0565af1f42295590380973573297e31f98100100100100

View full report

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.

1 participant