Skip to content
Generated from the .d.ts files published in guardlink@2.0.0. Report problems against guardlink, not this page.

diff

Everything exported by guardlink/diff, from the .d.ts files published in guardlink@2.0.0. See the entry points for the other subpaths, and use guardlink as a library for worked examples.

GuardLink Diff — exports.

#diff to #cmd-injection [high] cwe:CWE-78 – “git.ts uses execSync with ref argument”

#diff – “Git commands use execSync; ref is validated with rev-parse before use”

GitRef -> #diff via parseAtRef – “Git reference input”

Property Type Description
changedFiles? Iterable<string, any, any> Files that changed between the two revisions, repo-relative (e.g. from git diff --name-only <ref>). Used only to compute staleEntitlements.

GuardLink Diff — exports.

#diff to #cmd-injection [high] cwe:CWE-78 – “git.ts uses execSync with ref argument”

#diff – “Git commands use execSync; ref is validated with rev-parse before use”

GitRef -> #diff via parseAtRef – “Git reference input”

Property Type Description
citedFile string The changed file that the entitlement’s citation points at
entitlement ThreatModelEntitlement -

getChangedFiles(root, ref): string[]

List files that changed between ref and the working tree, repo-relative.

Feeds diffModels({ changedFiles }) so an

Parameter Type
root string
ref string

string[]

whose cited authorization code moved is reported as stale (actor-entitlement design §3.7). Returns [] on any git failure — staleness is advisory, and a diff that cannot resolve the ref should still report the rest of the delta.

#diff to #cmd-injection [high] cwe:CWE-78 – “ref is interpolated into an execSync git command”

#diff against #cmd-injection using #input-sanitize – “rev-parse –verify must resolve ref to a single revision before it reaches the diff command; a shell metacharacter makes rev-parse fail, so the function returns [] instead of running the second command”

GitRef -> #diff via execSync – “Ref input to git diff –name-only”

#diff -> ChangedFileList via return – “Repo-relative paths used for entitlement staleness”


getCurrentRef(root): string

Get the current HEAD commit hash (short).

Parameter Type
root string

string

Re-exports Change


Re-exports ChangeKind


Re-exports diffModels


Re-exports DiffSummary


Re-exports formatDiff


Re-exports formatDiffMarkdown


Re-exports parseAtRef


Re-exports ThreatModelDiff