Menu

A symlink is not code: refusing a tree entry before reading its bytes
📰

A symlink is not code: refusing a tree entry before reading its bytes

DEV Community: backend·polycratia·14 days ago
#p7E5KThG
#devtobackend#devto#dev#commit#path
Long article (1907 words) — no AI summary yet.
Reading 0:00
15s threshold

A tool that verifies quoted code against a repository has to read bytes at a commit and compare them with the block printed in the prose. Not every path at a commit holds bytes that are code. A symlink entry holds a target path. A submodule entry names a commit that belongs to another repository, one the clone may not even have. Read either and compare it with a quoted block, and you get a confident verdict about the wrong bytes.

I hit this while building srcproof , a lockfile and gate for prose that cites code (the code in this post is from github.com/polycratia/srcproof ). The design is deliberately unforgiving: every repository link in an article must name a commit as 40 lowercase hex characters, and every fenced block anchored by a permalink with a line range gets a record in srcproof.lock , written as quote ARTICLE SHA256 REPO COMMIT PATH START-END .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.