Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake
watch_file flake.lock
6 changes: 6 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@ jobs:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Pin GitHub Actions to commit hashes.

The actions/checkout@v4 reference on line 22 is unpinned. Per GitHub security best practices and the requirements flagged by static analysis, all action references must be pinned to a specific commit hash (not a tag or branch) to prevent supply-chain attacks and ensure reproducible workflows.

While the lockfile verification (lines 25–26) and audit logic (lines 36–37) are sound, the unpinned action undermines the security hardening intent of this PR.

🔒 Proposed fix: Pin action to commit hash
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@44c85305e41dfe471331e387f004d221add66d31 # v4.1.1

(Verify the latest v4.x commit hash at https://github.com/actions/checkout/releases)

Also applies to: 25-37

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/check.yml at line 22, Replace the unpinned
`actions/checkout@v4` reference with a pinned commit hash version in the format
`actions/checkout@<commit-hash>`. Visit
https://github.com/actions/checkout/releases to find the latest v4 commit hash
and update the action reference to pin it to that specific commit instead of
using the version tag. This applies to all instances of the checkout action in
the workflow file to ensure consistent security hardening across all action
references.

Source: Linters/SAST tools

- run: pnpm install --frozen-lockfile

- name: Verify lockfile is up to date
run: pnpm install --lockfile-only && git diff --exit-code pnpm-lock.yaml

- name: Type check
working-directory: ./subtrack
run: pnpm lint:types

- run: pnpm build

- run: pnpm test

- name: Audit dependencies
run: pnpm audit --audit-level=high
35 changes: 35 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: OpenSSF Scorecard

on:
push:
branches: [main]
schedule:
- cron: "0 0 * * 1"
workflow_dispatch:

permissions:
contents: read

jobs:
analysis:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
security-events: write

steps:
- uses: actions/checkout@v4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Pin all GitHub Actions to commit hashes.

Three action references are unpinned and violate security best practices:

  • Line 22: actions/checkout@v4
  • Line 26: ossf/scorecard-action@v2.4.0
  • Line 33: github/codeql-action/upload-sarif@v3

Unpinned tags and versions are mutable and vulnerable to supply-chain attacks (tag hijacking, compromised releases). All actions must be pinned to specific commit hashes.

🔒 Proposed fix: Pin all actions to commit hashes
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@44c85305e41dfe471331e387f004d221add66d31 # v4.1.1

-      - uses: ossf/scorecard-action@v2.4.0
+      - uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914a587 # v2.4.0

-        uses: github/codeql-action/upload-sarif@v3
+        uses: github/codeql-action/upload-sarif@cdcdbbfb34304309f8c18fe68d3a021711ae8f642 # v3.1.1

(Verify commit hashes at each action's GitHub releases page)

Also applies to: 26-26, 33-33

🧰 Tools
🪛 zizmor (1.25.2)

[error] 22-22: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/scorecard.yml at line 22, Replace the version tags in the
GitHub Actions references with specific commit hashes to follow security best
practices. For the actions/checkout action (currently using `@v4`),
ossf/scorecard-action (currently using `@v2.4.0`), and
github/codeql-action/upload-sarif (currently using `@v3`), update each uses
statement to pin to a specific commit hash instead of the version tag. Verify
the correct commit hashes by checking each action's releases page on GitHub and
update all three action references accordingly.

Source: Linters/SAST tools

with:
persist-credentials: false

- uses: ossf/scorecard-action@v2.4.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload Scorecard SARIF result
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
49 changes: 49 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Security Policy

## Reporting a Vulnerability

If you discover a security vulnerability in subtrack, please report it privately.

**Do not** report security vulnerabilities via public GitHub issues.

Instead, send a description of the issue (including steps to reproduce, affected versions, and any relevant code context) to one of the following:

- Open a **private security advisory** at: https://github.com/nazozokc/subtrack/security/advisories/new
- Email: **nazozokc@icloud.com**

You should receive a response within **48 hours**. If you don't hear back, follow up via the advisory thread.

## Scope

This policy covers the `subtrack` npm package and the `subtrack-monorepo` at https://github.com/nazozokc/subtrack.

The following are **out of scope**:
- The documentation site under `docs/`
- Third-party dependencies (report those to the respective maintainers)
- Theoretical vulnerabilities without a practical exploit path

## What to Expect

- I will acknowledge receipt of your report within 48 hours
- I will investigate and provide a timeline for a fix
- Once a fix is ready, I will release a patch and credit you in the release notes (unless you prefer to remain anonymous)

## Supported Versions

| Version | Supported |
|---------|-----------|
| >= 4.x | ✅ Active |
| < 4.x | ❌ No longer supported |

## Supply Chain Security

subtrack takes supply chain security seriously:

- **Provenance attestation**: All npm releases use `pnpm publish --provenance` (SLSA Level 1+)
- **Dependency review**: Every pull request is scanned for new vulnerabilities via GitHub's dependency review action
- **Renovate bot**: Dependencies are updated with a 7-day minimum release age to detect malicious releases before they reach this project
- **Lockfile**: A `pnpm-lock.yaml` is committed and verified with `--frozen-lockfile` in CI
- **Limited build scripts**: Only `esbuild` is permitted to run postinstall scripts (`pnpm.onlyBuiltDependencies`)
- **CodeQL**: Static analysis runs on every push and PR
- **pnpm audit**: Runs in CI to catch known vulnerabilities
- **OpenSSF Scorecard**: Automated supply chain health assessment
3 changes: 3 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ packages:
- "subtrack"
- "docs"

# Only esbuild is permitted to run install scripts.
# All other dependencies (including transitive) are blocked from running
# postinstall/preinstall scripts as a supply chain security measure.
allowBuilds:
esbuild: true
2 changes: 1 addition & 1 deletion subtrack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<h1>subtrack</h1>
</div>

[![Socket Badge](https://badge.socket.dev/npm/package/subtrack/4.0.3)](https://badge.socket.dev/npm/package/subtrack/4.0.3)
[![Socket Badge](https://badge.socket.dev/npm/package/subtrack)](https://socket.dev/npm/package/subtrack)

<p align="center">
<img src="images/subtrack-demo.png" alt="subtrack demo" width="700"/>
Expand Down
Loading
Loading