fix(share): exclude private paths from portable project files (#8804)

* Align editable-source capture with the v12 portable path policy

* docs: explain which project metadata can be served

* fix(share): preserve authored hidden paths in the private-file policy
This commit is contained in:
terencecho
2026-11-25 05:59:05 +00:00
committed by GitHub
parent d2d527952b
commit 44d49a5219
12 changed files with 559 additions and 63 deletions
+2 -1
View File
@@ -31,7 +31,8 @@ through `hyperframes share --manage`.
Source uses the same portable project policy as Desktop: authored HTML, scripts,
styles, assets, and supported Studio edit metadata. Known credential filenames
(such as `.env`, `.npmrc`, and `*.pem`), dependency directories, chat
history, local sharing state, and recorded render outputs stay out.
history, local sharing state, and recorded render outputs stay out. Files ending in `.key` stay local,
including Keynote decks.
These are filename rules, not a secret scanner. `.gitignore` does not control
source capture. Other regular files can be included even if Git ignores them. For example,
+29 -38
View File
@@ -32,26 +32,10 @@ function withoutTrailingDotsOrSpaces(segment: string): string {
return segment.slice(0, end);
}
// Git metadata and env files hold commands other tools run and secrets: nothing serves or inlines them.
export function isVcsOrSecretPath(relPath: string): boolean {
return projectPathSegments(relPath).some(
(segment) => segment === ".git" || segment.startsWith(".env"),
);
}
// `.hyperframes/` holds the desktop app's and the CLI's own records (a hand-off, chat history, read marks): no file
// server serves any of it, the folder itself included, but Studio's own files and the assets compositions load. Studio
// reads and writes those only in the project's own `.hyperframes/`, so one in a subfolder holds records only.
const STUDIO_FILES = new Set([
".hyperframes/studio-motion.json",
".hyperframes/studio-manual-edits.json",
]);
const STUDIO_FOLDERS = [".hyperframes/prepared-assets", ".hyperframes/requests"];
const UNCONVERTED_PREVIEW_DOWNLOADS = ".hyperframes/prepared-assets/downloads";
// Credentials and coding-tool state that projects often sit next to: registry tokens, MCP and agent settings, cloud and
// SSH keys. No composition loads one, so no file server serves one and no upload ships one.
const CREDENTIAL_FILES = new Set([
// Shared with the editable-source contract. Each expression matches whole normalized paths.
const anyDepth = String.raw`(?:[^/]*/)*`;
const vcsOrEnv = String.raw`(?:\.git|\.env[^/]*)(?:/.*)?`;
const credentialNames = [
".npmrc",
".yarnrc",
".yarnrc.yml",
@@ -67,8 +51,8 @@ const CREDENTIAL_FILES = new Set([
"serviceaccountkey.json",
"service-account.json",
"service_account.json",
]);
const CREDENTIAL_FOLDERS = new Set([
];
const toolFolders = [
".ssh",
".aws",
".gnupg",
@@ -82,26 +66,33 @@ const CREDENTIAL_FOLDERS = new Set([
".gemini",
".vscode",
".idea",
];
const alternatives = (names: string[]) =>
names.map((name) => name.replaceAll(".", "\\.")).join("|");
const keyOrStore = String.raw`id_(?:rsa|dsa|ecdsa|ed25519)[^/]*|[^/]*\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx|tfstate(?:\.backup)?|tfvars(?:\.json)?)`;
const folders = String.raw`(?:${alternatives(toolFolders)}|\.config/(?:gcloud|gh))(?:/.*)?`;
const credentials = [alternatives(credentialNames), keyOrStore, folders].join("|");
export const portablePrivatePattern = `${anyDepth}(?:${vcsOrEnv}|${credentials})`;
const vcsOrSecret = new RegExp(`^${anyDepth}(?:${vcsOrEnv})$`, "su");
const credentialOrToolState = new RegExp(`^${anyDepth}(?:${credentials})$`, "su");
// Git metadata and env files hold commands other tools run and secrets: nothing serves or inlines them.
export function isVcsOrSecretPath(relPath: string): boolean {
return vcsOrSecret.test(projectPathSegments(relPath).join("/"));
}
// Only known project files in the root .hyperframes directory can be served as assets.
const STUDIO_FILES = new Set([
".hyperframes/studio-motion.json",
".hyperframes/studio-manual-edits.json",
]);
const CREDENTIAL_CONFIG_FOLDERS = new Set(["gcloud", "gh"]);
const KEY_FILE =
/^(?:id_(?:rsa|dsa|ecdsa|ed25519).*|.*\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx))$/;
const SECRET_STORE_FILE = /\.(?:tfstate(?:\.backup)?|tfvars(?:\.json)?)$/;
const STUDIO_FOLDERS = [".hyperframes/prepared-assets", ".hyperframes/requests"];
const UNCONVERTED_PREVIEW_DOWNLOADS = ".hyperframes/prepared-assets/downloads";
/** Credential files and tool or agent state, for a project-relative path in any spelling Windows opens. */
export function isCredentialOrToolStatePath(relPath: string): boolean {
const segments = projectPathSegments(relPath);
const name = segments.at(-1) ?? "";
return (
CREDENTIAL_FILES.has(name) ||
KEY_FILE.test(name) ||
SECRET_STORE_FILE.test(name) ||
segments.some(
(segment, at) =>
CREDENTIAL_FOLDERS.has(segment) ||
(segment === ".config" && CREDENTIAL_CONFIG_FOLDERS.has(segments[at + 1] ?? "")),
)
);
return credentialOrToolState.test(projectPathSegments(relPath).join("/"));
}
/** Files no composition loads, in any spelling Windows opens: git, env, credentials, tool state, app records. */
+1 -1
View File
@@ -78,7 +78,7 @@ can use video-only; changed source, conflicts and unexpected upload failures nee
an explicit choice to omit source. The CLI exposes `--video-only` for that choice.
`filesForExport` only validates already-prepared source; it does not upload.
The adapter uses the portable-source-v11 capture/manifest rules and
The adapter uses the portable-source-v12 capture/manifest rules and
multipart transport. The pinned policy, Unicode 15.1 registry (with its license),
and manifest test vectors are checked into this repository. Source is captured through
verified file handles; upload bytes are streamed and checked against their hash.
+3
View File
@@ -8,6 +8,9 @@ import path from "node:path";
import { createHash } from "node:crypto";
import { isOutsideFilm } from "./appOwnedPaths.mjs";
export { readSourceIgnore };
export { isPrivateSourcePath, privateSourceSpelling } from "./sources/privateSource.mjs";
export const HF_ID_ATTRIBUTE = /\sdata-hf-id\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/g;
const sha256 = (/** @type {import("node:crypto").BinaryLike} */ data) =>
@@ -1,5 +1,5 @@
{
"policy_version": "portable-source-v11",
"policy_version": "portable-source-v12",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
@@ -57,7 +57,7 @@
"max_segment_bytes": 240,
"separator": "/",
"forbidden_characters": "<>:\"|?*\\",
"reserved_segment_regex": "(?:con|prn|aux|nul|com[1-9\u00b9\u00b2\u00b3]|lpt[1-9\u00b9\u00b2\u00b3])(?:\\..*)?",
"reserved_segment_regex": "(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\..*)?",
"reserved_segment_match": "full match against each segment's comparison key, so CON, Con.txt and nul.tar.gz are all reserved",
"canonical_spelling_roots": [
".media",
@@ -71,11 +71,13 @@
".amazonq",
".augment",
".aws",
".azure",
".cache",
".claude",
".cline",
".clinerules",
".codex",
".config",
".continue",
".continuerc.json",
".crush",
@@ -83,6 +85,7 @@
".cursor",
".devcontainer",
".devcontainer.json",
".docker",
".ds_store",
".env",
".envrc",
@@ -92,9 +95,11 @@
".git",
".git-credentials",
".gitattributes",
".gitconfig",
".github",
".gitmodules",
".gitpod.yml",
".gnupg",
".grok",
".hg",
".hyperframes",
@@ -103,6 +108,7 @@
".junie",
".kilocode",
".kiro",
".kube",
".lock",
".mcp.json",
".media",
@@ -293,10 +299,10 @@
},
{
"id": "credential-files",
"regex": "(?:[^/]+/)*(?:\\.netrc|\\.pypirc|\\.git-credentials|[^/]*\\.(?:pem|p12|pfx)|id_rsa[^/]*|id_ed25519[^/]*|(?:\\.ssh|\\.aws)(?:/.*)?)",
"regex": "(?:[^/]+/)*(?:\\.netrc|_netrc|\\.pypirc|\\.git-credentials|\\.gitconfig|pip\\.ini|[^/]*\\.(?:pem|p12|pfx)|id_(?:rsa|dsa|ecdsa|ed25519)[^/]*|(?:\\.ssh|\\.aws|\\.gnupg|\\.docker|\\.kube|\\.azure|\\.config/(?:gcloud|gh))(?:/.*)?)",
"client_action": "exclude",
"server_action": "reject",
"basis": "Credential files by name at any depth. *.key is deliberately absent: Keynote decks are plausible project sources"
"basis": "Credential files and stores by name at any depth."
},
{
"id": "os-metadata",
@@ -312,6 +318,13 @@
"server_action": "reject",
"basis": "A .hyperframes folder below the project root, such as one inside a project copied into compositions/, holds that copy's client records; only the root folder's named portable files below travel"
},
{
"id": "private-source",
"regex": "(?:[^/]*/)*(?:(?:\\.git|\\.env[^/]*)(?:/.*)?|\\.npmrc|\\.yarnrc|\\.yarnrc\\.yml|\\.pypirc|pip\\.conf|pip\\.ini|\\.netrc|_netrc|\\.git-credentials|\\.gitconfig|\\.mcp\\.json|credentials\\.json|serviceaccountkey\\.json|service-account\\.json|service_account\\.json|id_(?:rsa|dsa|ecdsa|ed25519)[^/]*|[^/]*\\.(?:pem|key|p12|pfx|p8|ppk|jks|keystore|kdbx|tfstate(?:\\.backup)?|tfvars(?:\\.json)?)|(?:\\.ssh|\\.aws|\\.gnupg|\\.docker|\\.kube|\\.azure|\\.claude|\\.codex|\\.cursor|\\.agents|\\.gemini|\\.vscode|\\.idea|\\.config/(?:gcloud|gh))(?:/.*)?)",
"client_action": "exclude",
"server_action": "reject",
"basis": "The private-path rule for credentials, tool state, Git and environment files. Also match the parser spelling after NFKC, upper then lower case, removal of default-ignorable code points and Windows segment cleanup."
},
{
"id": "portable-transcripts",
"regex": "\\.hyperframes/transcripts/(?:[^/]+/)*[^/]+\\.json",
@@ -440,7 +453,9 @@
"agent-client-state": "(?:[^/]+/)*(?:\\.claude|\\.agents|\\.cursor|\\.vscode|\\.idea)(?:/.*)?",
"work-tree-config": "(?!)",
"git-directory-head": "(?!)",
"nested-hyperframes-state": "(?!)"
"nested-hyperframes-state": "(?!)",
"credential-files": "(?:[^/]+/)*(?:\\.netrc|\\.pypirc|\\.git-credentials|[^/]*\\.(?:pem|p12|pfx)|id_rsa[^/]*|id_ed25519[^/]*|(?:\\.ssh|\\.aws)(?:/.*)?)",
"private-source": "(?!)"
},
"legacy_short_name_alias_names": [
".agent",
@@ -483,6 +498,6 @@
".yarnrc",
".yarnrc.yml"
],
"rule": "Only stored snapshot reads use each listed rule's regex in place of its current one, and the v10 short_name_alias_names in place of the current ones, to retain immutable manifest digests: agent-client-state its v3 regex, and work-tree-config, added in v7, git-directory-head, added in v9, and nested-hyperframes-state, added in v10, none. New captures and uploads use the current rules and short names. Clients never install, and the server never signs a download URL for, a path a current rule excludes or a segment that is a current short name."
"rule": "Only stored snapshot reads use each listed rule's regex in place of its current one, and the v10 short_name_alias_names in place of the current ones, to retain immutable manifest digests: agent-client-state its v3 regex, and work-tree-config, added in v7, git-directory-head, added in v9, and nested-hyperframes-state, added in v10, none. The credential-files rule keeps its v11 regex. New captures and uploads use the current rules and short names. Clients never install, and the server never signs a download URL for, a path a current rule excludes or a segment that is a current short name. The private-source rule applies only to current validation and delivery."
}
}
+10 -8
View File
@@ -1,6 +1,7 @@
// @ts-check
// Validate source manifests against the bundled sync contract.
import { isCredentialOrToolStatePath, isVcsOrSecretPath } from "@hyperframes/parsers/private-path";
import { isPrivateSourcePath, privateSourceSpelling } from "./privateSource.mjs";
export { isPrivateSourcePath };
import { readContract } from "./contract.mjs";
import {
UNICODE_VERSION,
@@ -11,7 +12,7 @@ import {
withoutIgnorable,
} from "./unicode.mjs";
const PATH_POLICY_VERSION = "portable-source-v11";
const PATH_POLICY_VERSION = "portable-source-v12";
/** @typedef {import("./types.js").PathRule} PathRule @typedef {import("./types.js").PolicyDocument} PolicyDocument */
@@ -109,10 +110,15 @@ const policy = () => (compiled ??= compile(readContract("path-policy.json")));
/** Every segment replaced by its comparison key. @param {string} path */
const foldedPath = (path) => path.split("/").map(comparisonKey).join("/");
/** @param {{ pattern: RegExp, rule: PathRule }} entry @param {string} folded @param {string} path */
const matches = ({ pattern, rule }, folded, path) =>
pattern.test(folded) ||
(rule.id === "private-source" && pattern.test(privateSourceSpelling(path)));
/** The first rule matching a path's folded spelling. @param {string} path @returns {PathRule} */
export function classifyPath(path) {
const folded = foldedPath(path);
const found = policy().rules.find(({ pattern }) => pattern.test(folded));
const found = policy().rules.find((entry) => matches(entry, folded, path));
if (!found) throw new Error("the path policy's catch-all rule did not match");
return found.rule;
}
@@ -169,7 +175,7 @@ export function validatePath(path, mode = "current") {
if (root !== undefined && segments[0] !== root)
throw new PathViolation("reserved_path_alias", path);
const folded = keys.join("/");
const found = rules.find(({ pattern }) => pattern.test(folded));
const found = rules.find((entry) => matches(entry, folded, path));
if (!found) throw new Error("the path policy's catch-all rule did not match");
if (found.rule.server_action === "reject")
throw new PathViolation("excluded_path", path, found.rule.id);
@@ -246,10 +252,6 @@ export function excludedFolder(dir) {
});
}
/** Private names omitted locally even when the wire contract accepts them. @param {string} path */
export const isPrivateSourcePath = (path) =>
isVcsOrSecretPath(path) || isCredentialOrToolStatePath(path);
/** A stored manifest may contain paths that are no longer eligible for upload. @param {string} path */
export function canUploadStoredPath(path) {
if (isPrivateSourcePath(path)) return false;
@@ -0,0 +1,13 @@
// @ts-check
import {
isCredentialOrToolStatePath,
isVcsOrSecretPath,
projectPathSegments,
} from "@hyperframes/parsers/private-path";
/** @param {string} path */
export const isPrivateSourcePath = (path) =>
isVcsOrSecretPath(path) || isCredentialOrToolStatePath(path);
/** @param {string} path */
export const privateSourceSpelling = (path) => projectPathSegments(path).join("/");
@@ -1,5 +1,5 @@
{
"policy_version": "portable-source-v11",
"policy_version": "portable-source-v12",
"about": "Golden vectors for the composition sync manifest. valid: build the canonical bytes from `manifest`; UTF-8 encoding `canonical` gives those bytes and `manifest_sha256` is their SHA-256. invalid: validating `manifest` fails with `error.code` (and `error.rule` for path-policy rules). limits: with `limits`, the first exceeded limit in the order file_count, file_size, project_size, manifest_size is `limit` (null: admitted). stored: base64 `body` is stored manifest bytes; reading them requires they are already canonical.",
"valid": [
{
@@ -306,7 +306,7 @@
"size": 9
},
{
"path": "deck.key",
"path": "deck.pdf",
"sha256": "8e11a86cf1052f458f6766baba49f519b80b3eee7c35433debd93483515626d4",
"size": 8
},
@@ -327,8 +327,8 @@
}
]
},
"canonical": "{\"entrypoint\":\"index.html\",\"files\":[{\"path\":\".gitignore\",\"sha256\":\"bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947\",\"size\":10},{\"path\":\".hyperframes/brand-kit.json\",\"sha256\":\"dda44abb548e99aad3ec261c6b87c5f545eb09f8fb1b261d3c75a7cfc21bfa94\",\"size\":27},{\"path\":\".hyperframes/caption-skin.html\",\"sha256\":\"a2e2d9315c6a9e3437f752e69a8514d8c662f53a9ade33db2686fa9affaa97b2\",\"size\":30},{\"path\":\".hyperframes/studio-manual-edits.json\",\"sha256\":\"450ba94d0f2fbb1ac30cc5e1dcae043e2f7f970357984a6bdfaf2f2087904fe0\",\"size\":37},{\"path\":\".hyperframes/studio-motion.json\",\"sha256\":\"205f890f2a576608d6f009ef4738fc2b81df387329f2e20bdf67356c5365b55d\",\"size\":31},{\"path\":\".hyperframes/transcription.json\",\"sha256\":\"bc0b9ef4215d81d0ae7adabc471993f63ac70a24a693f4f91b4c18a103dd9ba1\",\"size\":31},{\"path\":\".hyperframes/transcripts/a.json\",\"sha256\":\"7ffb8ceda0a4b872cc4a9ba63bdd040a70631e3343157454a95206f2fc9f27cf\",\"size\":31},{\"path\":\".hyperframes/transcripts/nested/b.json\",\"sha256\":\"a5222ca2063d161da3e06294d2ab5c6c32d7692a1177bb0f79ddde4001deb47b\",\"size\":38},{\"path\":\".hyperframesignore\",\"sha256\":\"4f7382fe2d1d64d27e88900b9997a85f9d9fa42062f04aab7426b03cabba7497\",\"size\":18},{\"path\":\".media/CREDITS.md\",\"sha256\":\"4056dedc9ad51868f89af43f34035af851bb566f6d30f804e57551da7ec0dd9c\",\"size\":17},{\"path\":\".media/images/image_001.png\",\"sha256\":\"35037cf8cd8a2d3e2b20a04563ecba015e6404678af5631c0e9e3a50fec200de\",\"size\":27},{\"path\":\".media/index.md\",\"sha256\":\"8a925d0e3cc08cd0ed4601d0f94e8a781881d1b3034d07fe11cc02d296a2ad43\",\"size\":15},{\"path\":\".media/preferences.json\",\"sha256\":\"888316c0c00d9d6929423a311f302500134d74315226a6a78a7a73bf66b4ef58\",\"size\":23},{\"path\":\".media/video/unused-take.mp4\",\"sha256\":\"a3e29b7ba3f66207df6182ec09ed749df364378cf2cfb8cf589163a6cdac93e2\",\"size\":28},{\"path\":\"CLAUDE.md\",\"sha256\":\"6ebdb617a8104a7756d0cf36578ab01103dc9f07e4dc6feb751296b9c402faf7\",\"size\":9},{\"path\":\"deck.key\",\"sha256\":\"8e11a86cf1052f458f6766baba49f519b80b3eee7c35433debd93483515626d4\",\"size\":8},{\"path\":\"docs/node_modules.md\",\"sha256\":\"ef0612da92e8204f7277982d4d3ce82b4589d200192fcfa74371a5b80365d5ba\",\"size\":20},{\"path\":\"index.html\",\"sha256\":\"0eb547304658805aad788d320f10bf1f292797b5e6d745a3bf617584da017051\",\"size\":10},{\"path\":\"notes/TRANSCRIPTS/file.bin\",\"sha256\":\"0392523321b470965a29a3ec513f460128fe11513b1dc2e2396fe510d5e67b15\",\"size\":26},{\"path\":\"templates/env.example.md\",\"sha256\":\"bf8e2a33ac126e948ed744ea606beb8f150409bbfcea9fbdf3184a710d0d3bff\",\"size\":24}],\"format_version\":1}",
"manifest_sha256": "376dac8985415bfe84d9fbc3fb8086cc6a2cfa2a8b2d8c180a8a8a2c3fef8360",
"canonical": "{\"entrypoint\":\"index.html\",\"files\":[{\"path\":\".gitignore\",\"sha256\":\"bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947\",\"size\":10},{\"path\":\".hyperframes/brand-kit.json\",\"sha256\":\"dda44abb548e99aad3ec261c6b87c5f545eb09f8fb1b261d3c75a7cfc21bfa94\",\"size\":27},{\"path\":\".hyperframes/caption-skin.html\",\"sha256\":\"a2e2d9315c6a9e3437f752e69a8514d8c662f53a9ade33db2686fa9affaa97b2\",\"size\":30},{\"path\":\".hyperframes/studio-manual-edits.json\",\"sha256\":\"450ba94d0f2fbb1ac30cc5e1dcae043e2f7f970357984a6bdfaf2f2087904fe0\",\"size\":37},{\"path\":\".hyperframes/studio-motion.json\",\"sha256\":\"205f890f2a576608d6f009ef4738fc2b81df387329f2e20bdf67356c5365b55d\",\"size\":31},{\"path\":\".hyperframes/transcription.json\",\"sha256\":\"bc0b9ef4215d81d0ae7adabc471993f63ac70a24a693f4f91b4c18a103dd9ba1\",\"size\":31},{\"path\":\".hyperframes/transcripts/a.json\",\"sha256\":\"7ffb8ceda0a4b872cc4a9ba63bdd040a70631e3343157454a95206f2fc9f27cf\",\"size\":31},{\"path\":\".hyperframes/transcripts/nested/b.json\",\"sha256\":\"a5222ca2063d161da3e06294d2ab5c6c32d7692a1177bb0f79ddde4001deb47b\",\"size\":38},{\"path\":\".hyperframesignore\",\"sha256\":\"4f7382fe2d1d64d27e88900b9997a85f9d9fa42062f04aab7426b03cabba7497\",\"size\":18},{\"path\":\".media/CREDITS.md\",\"sha256\":\"4056dedc9ad51868f89af43f34035af851bb566f6d30f804e57551da7ec0dd9c\",\"size\":17},{\"path\":\".media/images/image_001.png\",\"sha256\":\"35037cf8cd8a2d3e2b20a04563ecba015e6404678af5631c0e9e3a50fec200de\",\"size\":27},{\"path\":\".media/index.md\",\"sha256\":\"8a925d0e3cc08cd0ed4601d0f94e8a781881d1b3034d07fe11cc02d296a2ad43\",\"size\":15},{\"path\":\".media/preferences.json\",\"sha256\":\"888316c0c00d9d6929423a311f302500134d74315226a6a78a7a73bf66b4ef58\",\"size\":23},{\"path\":\".media/video/unused-take.mp4\",\"sha256\":\"a3e29b7ba3f66207df6182ec09ed749df364378cf2cfb8cf589163a6cdac93e2\",\"size\":28},{\"path\":\"CLAUDE.md\",\"sha256\":\"6ebdb617a8104a7756d0cf36578ab01103dc9f07e4dc6feb751296b9c402faf7\",\"size\":9},{\"path\":\"deck.pdf\",\"sha256\":\"8e11a86cf1052f458f6766baba49f519b80b3eee7c35433debd93483515626d4\",\"size\":8},{\"path\":\"docs/node_modules.md\",\"sha256\":\"ef0612da92e8204f7277982d4d3ce82b4589d200192fcfa74371a5b80365d5ba\",\"size\":20},{\"path\":\"index.html\",\"sha256\":\"0eb547304658805aad788d320f10bf1f292797b5e6d745a3bf617584da017051\",\"size\":10},{\"path\":\"notes/TRANSCRIPTS/file.bin\",\"sha256\":\"0392523321b470965a29a3ec513f460128fe11513b1dc2e2396fe510d5e67b15\",\"size\":26},{\"path\":\"templates/env.example.md\",\"sha256\":\"bf8e2a33ac126e948ed744ea606beb8f150409bbfcea9fbdf3184a710d0d3bff\",\"size\":24}],\"format_version\":1}",
"manifest_sha256": "d520abd030a7461b5565047aaf492b697be1e35badf6a23b6772a98ce6237792",
"file_count": 20,
"project_bytes": 460
},
@@ -5657,6 +5657,419 @@
"code": "excluded_path",
"rule": "work-tree-config"
}
},
{
"name": "credential-docker",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "nested/.DoCker/config.json",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-gh",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "boards/.config/gh/hosts.yml",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-gcloud",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": ".config/gcloud/credentials.db",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-gnupg",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": ".gnupg/data",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-kube",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": ".kube/config",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-azure",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": ".azure/cache.json",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-pip",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "pip.ini",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-gitconfig",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": ".gitconfig",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-netrc",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "_netrc",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-ecdsa",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "id_ecdsa.pub",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-dsa",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "id_dsa",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "credential-files"
}
},
{
"name": "credential-short-name",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "DOCKER~1/config",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "segment_short_name"
}
},
{
"name": "private-source-1",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "nested/service-account.json",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
},
{
"name": "private-source-2",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "nested/.env-production/token",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
},
{
"name": "private-source-3",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "config/terraform.tfstate.backup",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
},
{
"name": "private-source-4",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "nested/SERVICE_ACCOUNT.JSON",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
},
{
"name": "private-source-5",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "assets/deck.key",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
},
{
"name": "private-source-6",
"manifest": {
"format_version": 1,
"entrypoint": "index.html",
"files": [
{
"path": "index.html",
"sha256": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 1
},
{
"path": "nested/service-account.json",
"sha256": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"size": 2
}
]
},
"error": {
"code": "excluded_path",
"rule": "private-source"
}
}
],
"limits": [
@@ -355,3 +355,50 @@ test("scratch files and wildcard exclusions do not change the snapshot", async (
await writeFile(join(root, "data.json"), "{}");
assert.notEqual(await projectFingerprint(root), before);
});
test("editable source omits credential stores while preserving authored assets", async (t) => {
const root = await project({
"index.html": "page",
".config/gh/hosts.yml": "fixture",
".config/gcloud/state.db": "fixture",
"assets/.DOCKER/config.json": "{}",
".gnupg/keys/data": "fixture",
".kube/config": "fixture",
".azure/settings": "fixture",
".fonts/Inter.woff2": "font",
".Gitignore": "output/",
".GitHub/workflows/ci.yml": "workflow",
"assets/deck.key": "slides",
".media/video/clip.mp4": "clip",
});
t.after(() => rm(root, { recursive: true, force: true }));
assert.deepEqual(
captured(await captureProject(root)).manifest.document.files.map(({ path }) => path),
[
".GitHub/workflows/ci.yml",
".Gitignore",
".fonts/Inter.woff2",
".media/video/clip.mp4",
"index.html",
],
);
await symlink(".config/gh/hosts.yml", join(root, "notes.txt"));
assert.deepEqual(await captureProject(root), {
at: "problems",
problems: [{ path: "notes.txt", problem: "symlink" }],
});
});
test("a host can use the package snapshot entry point for private names and strict ignore rules", async (t) => {
const { isPrivateSourcePath, privateSourceSpelling, readSourceIgnore } =
await import("@hyperframes/share/projectSnapshot.mjs");
const root = await project({ ".hyperframesignore": "scratch/\n" });
t.after(() => rm(root, { recursive: true, force: true }));
const spelled = "Assets/Service-Account.json";
assert.equal(privateSourceSpelling(spelled), "assets/service-account.json");
assert.equal(isPrivateSourcePath(spelled), true);
assert.equal(isPrivateSourcePath("assets/voice.wav"), false);
const ignored = await readSourceIgnore(root);
assert.equal(ignored("scratch/draft.txt"), true);
assert.equal(ignored("assets/voice.wav"), false);
});
+14 -3
View File
@@ -1,3 +1,4 @@
import { portablePrivatePattern } from "@hyperframes/parsers/private-path";
import { test } from "node:test";
import assert from "node:assert/strict";
import { createHash } from "node:crypto";
@@ -31,11 +32,11 @@ function refusal(run) {
return null;
}
test("the vectors are portable-source-v11's, and there are vectors of every kind", () => {
assert.equal(vectors.policy_version, "portable-source-v11");
test("the vectors are portable-source-v12's, and there are vectors of every kind", () => {
assert.equal(vectors.policy_version, "portable-source-v12");
assert.deepEqual(
[vectors.valid.length, vectors.invalid.length, vectors.limits.length, vectors.stored.length],
[13, 219, 5, 8],
[13, 237, 5, 8],
);
});
@@ -174,3 +175,13 @@ test("only links under assets/podcast/, in any spelling, are skipped", () => {
assert.equal(skippedSymlink("assets/cam-a.mov"), false);
assert.equal(skippedSymlink("other/assets/podcast/cam-a.mov"), false);
});
test("the portable contract tracks the complete parser private-path expression", () => {
const policy = JSON.parse(
readFileSync(new URL("../src/sources/contract/path-policy.json", import.meta.url), "utf8"),
);
assert.equal(
policy.rules.find(({ id }) => id === "private-source").regex,
portablePrivatePattern,
);
});
+1 -1
View File
@@ -18,7 +18,7 @@
"files": 13
},
"media-use": {
"hash": "89f0d2fddb8bb9b1",
"hash": "88f6a145ed56da5f",
"files": 137
},
"remotion-to-hyperframes": {
File diff suppressed because one or more lines are too long