Skip to content

chore(scripts): harden upload-assets for monorepo + symlink edge cases #51

Description

@wab

Two pre-existing hardening notes from the PR #48 review, neither blocking today:

1. getChangedAssets assumes posts/ is its own git root

scripts/upload-assets.js#getChangedAssets runs git ls-files with cwd: rootDir and compares against relative(rootDir, …). Works because this repo is its own git root, but would silently filter everything out if the repo ever became a subdir of a larger checkout (e.g. monorepo).

Fix: call git rev-parse --show-toplevel and use that as the base for path resolution instead of rootDir.

2. findAssetFiles follows symlinks

scripts/upload-assets.js#findAssetFiles uses stat (which follows symlinks) rather than lstat. Not a concern for current content but would silently traverse outside assets/ if a symlink ever appeared.

Fix: swap to lstat, skip symlinks (or refuse with a clear error if isSymbolicLink()).

Acceptance

  • Both behaviours covered by tests in scripts/__tests__/upload-assets.test.js
  • No behavioural change for the current repo layout (assertion: pnpm upload-assets:migrate still finds 141 files)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentScoped, dependencies clear, acceptance criteria explicit — grabbable by an AFK agent

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions