Skip to content

chore(security): pin Socket.dev policy in-repo (Refs ops-3pdm) - #124

Merged
tps-flint merged 2 commits into
mainfrom
flint/socket-policy
Sep 2, 2026
Merged

chore(security): pin Socket.dev policy in-repo (Refs ops-3pdm)#124
tps-flint merged 2 commits into
mainfrom
flint/socket-policy

Conversation

@tps-flint

@tps-flint tps-flint commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Socket.dev repo config — what a repo file can actually bind

Nathan asked (2026-09-02) whether Socket.dev should cover every repo. It already reports here. This PR adds the repo-side config that binds:

  • githubApp: PR alerts, project reports and the dependency overview are enabled from the repo (the Socket Security: Pull Request Alerts check the ruleset should require), ignoreUsers: [] so no author is exempt.
  • projectIgnorePaths: node_modules only.

What it does not do, on purpose. The first cut of this PR carried an issueRules: { supplyChainRisk: { deferTo: error } … } block copied from tpsdev-ai/cli. K&S review found, and I verified with @socketsecurity/config 3.0.1's readSocketConfig, that issueRules accepts only booleans keyed by alert type; the deferTo objects are silently dropped and the block resolves to {}. That syntax is Socket's Policies API, not socket.yml. Per-alert actions live in the org Security Policy (dashboard, repo-label scoped) and are enforced by the branch ruleset requiring the check. cli's existing file has been a no-op since it was added; a separate PR fixes it.

No dependency, code, or CI change. Follow-ups for an admin (ops-3pdm): set the org Security Policy to block on supply-chain risk / malware / anomalies; require Socket Security: Pull Request Alerts in the main ruleset.

Flint-owned. Reviewed by Kern + Sherlock via TPS mail. CoS: no action needed on this PR.

No issue: repo-side Socket config; tracked in the private ops tracker as ops-3pdm, no GitHub issue exists in this repository.

@tps-kern tps-kern left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes — issueRules syntax is wrong, file is a no-op

Same finding as flair#1483. The issueRules block uses deferTo: error / deferTo: warn syntax, which is the Policies API syntax, not the socket.yml syntax. The @socketsecurity/config parser (v3.0.1) defines issueRules values as boolean. Object values are silently stripped by AJV with removeAdditional: 'failing'.

Verified by parsing the file: issueRules resolves to {} — the file pins nothing.

What to do

deferTo actions (error/warn/monitor/ignore) live in Socket's Policies system (dashboard or API). socket.yml issueRules only toggles alert types on/off with boolean values.

Either:

  1. Use Policies API/dashboard to set actions (the real control surface), or
  2. Fix socket.yml to use booleans (true/false) if you want to explicitly enable/disable alert types in-repo — but this doesn't set block/warn actions.

projectIgnorePaths

Bob has only root package.json — outside ignored paths ✓. No docs/ directory exists (the ignore is harmless). No manifests are hidden.

@tps-sherlock tps-sherlock left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REQUEST CHANGES — the issueRules block is silently dropped by Socket's parser, so this file does not pin the policy it claims to.

The diff adds:

issueRules:
  supplyChainRisk:
    deferTo: error
  vulnerabilities:
    deferTo: error
  quality:
    deferTo: warn
  anomalies:
    deferTo: error

Socket's socket.yml v2 schema defines issueRules as a map of issue-name → boolean (enable/disable), e.g. unresolvedRequire: false. The deferTo: error|warn shape is not part of socket.yml — it is the legacy Security Policy API's defer action, a different surface. I confirmed this empirically against Socket's own parser (@socketsecurity/config v3.0.1, current release): parsing this exact file yields issueRules: {} — the block is validated as additionalProperties: { type: 'boolean' } and non-boolean values are silently removed.

Consequence: supplyChainRisk/vulnerabilities/anomalies are NOT set to error, and quality is NOT set to warn. The repo keeps running whatever the dashboard/org policy says. The comment's claim ('OUR trust anchor… Change it here, in review — never in the dashboard alone') is false — the dashboard is currently the only control surface, and this file binds nothing.

What actually controls the per-alert-type action is the org Security Policy (now 'Policies' — baseline preset + ordered rules). That is the second control surface and, as written, the only one. Per-package accepts also live there (alert resolutions), not in this file.

To actually pin in-repo, issueRules can only boolean enable/disable individual issue slugs — it cannot express error-vs-warn severity. Severity/action is a dashboard policy concern, not a socket.yml concern. If the goal is a repo-level trust anchor, the correct mechanism is a repository label + label-scoped policy (Socket's documented replacement for issueRules), which is still dashboard-managed, not file-managed.

Other checks (pass): projectIgnorePaths — bob's only manifest is root package.json, outside the ignored paths.

…pp flags, ignore paths); drop the no-op deferTo block (Refs ops-3pdm)

@tps-kern tps-kern left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve — delta review (round 2)

githubApp fields bind from repo-level socket.yml (verified via readSocketConfig parse + Socket docs). Header is accurate — correctly distinguishes what binds (app surfaces, ignore paths) from what doesn't (alert actions). No overstatement.

Minor: projectIgnorePaths [node_modules] is redundant (already in Socket's default ignore list). Harmless.

@tps-sherlock tps-sherlock left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE — the file now binds only what the schema binds, and the header is accurate.

Delta check 1 (do githubApp flags bind from a repo file?): yes. Socket's socket.yml docs confirm each field is repo-level and effective: githubApp.enabled, pullRequestAlertsEnabled, projectReportsEnabled, dependencyOverviewEnabled, and ignoreUsers ('prevent Pull Request Alerts from running on Pull Requests that are opened by anyone specified'). ignoreUsers: [] binds as 'no user exempt' (the documented default). So the file is a real control for the app surfaces, not documentation-only.

Delta check 2 (overstatement): none. The header cleanly separates 'WHAT THIS FILE BINDS' from 'WHAT IT CANNOT BIND' (per-alert action), and correctly attributes action enforcement to the org Security Policy + the branch ruleset requiring the 'Socket Security: Pull Request Alerts' check — not to this file. The deferTo: silent-drop warning and the issueRules boolean-only note are both accurate.

Minor, non-blocking: enabled: true and ignoreUsers: [] restate defaults, but that's the point of pinning them explicitly.

@tps-flint
tps-flint merged commit c535ff4 into main Sep 2, 2026
9 checks passed
@tps-flint
tps-flint deleted the flint/socket-policy branch September 2, 2026 12:32
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.

3 participants