dfetch Runtime Usage¶
Risk Context¶
This report follows the risk-based approach of BSI TR-03183-1 Chapter 5.
Threat model for dfetch. Covers the post-install lifecycle: reading the manifest, fetching dependencies from VCS and archive sources, applying patches, writing vendored files, and generating reports (SBOM, SARIF, check output). The installed dfetch package - produced by the supply chain in tm_supply_chain.py - is the entry point.
Assumptions¶
Name |
Description |
|---|---|
Trusted workstation |
Developer workstations are trusted at dfetch invocation time. A compromised workstation is outside the scope of this threat model. |
TLS delegated to client |
TLS certificate validation is delegated to the OS trust store and the git / svn / urllib clients. dfetch does not independently validate certificates. |
No persisted secrets |
No runtime secrets are persisted to disk by dfetch itself. VCS credentials are managed by the OS keychain, SSH agent, or CI secret store. |
Optional integrity hash |
The |
Mutable VCS references |
Branch- and tag-pinned Git dependencies are mutable references. Upstream force-pushes silently change what is fetched without triggering a manifest diff. |
Manifest under code review |
The manifest ( |
dfetch scope boundary |
dfetch is responsible only for its own security posture. The security of fetched third-party source code is the responsibility of the manifest author who selects and pins each dependency. |
No HTTPS enforcement |
HTTPS enforcement is the responsibility of the manifest author. dfetch accepts |
Actors¶
Name |
Description |
|---|---|
Developer |
Writes and reviews |
Boundaries¶
Name |
Description |
|---|---|
Local Developer Environment |
Developer workstation or local CI runner. Assumed trusted at invocation time. Hosts the manifest ( |
Internet |
All traffic crossing the local/remote boundary. TLS enforcement is the responsibility of the OS and VCS clients; dfetch does not enforce HTTPS on manifest URLs. |
Remote VCS Infrastructure |
Upstream Git and SVN servers (GitHub, GitLab, Gitea, self-hosted). Not controlled by the dfetch project; content is untrusted until verified. |
Archive Content Space |
Downloaded archive bytes before extraction and validation. Decompression-bomb and path-traversal checks enforce this boundary during extraction. |
Data Flow Diagram¶
Sequence Diagram¶
Asset Identification¶
Name |
Description |
Type |
C / I / A |
|---|---|---|---|
A-09: Remote VCS Server |
Upstream Git or SVN host: GitHub, GitLab, Gitea, self-hosted Git/SVN. Not controlled by the dfetch project; content is untrusted until verified. The SLSA source level of any upstream is unknown and unverified - dfetch does not check whether the upstream enforces branch protection, mandatory review, or ancestry enforcement, and no VSA is fetched alongside repository content (A-23). Threat postures: a compromised upstream maintainer account (phishing, credential stuffing, or MFA bypass) delivers attacker-controlled commits over an authenticated channel where transport security gives no protection — mitigated only by commit-SHA pinning and review before accepting any update. A network-adjacent attacker (BGP hijack, compromised DNS resolver) can intercept unencrypted traffic (svn://, http://) and inject redirects, but cannot break correctly implemented TLS or SSH. |
ExternalEntity |
High / High / High |
A-10: Archive HTTP Server |
HTTP/HTTPS server serving |
ExternalEntity |
— / — / — |
A-11: Consumer Build System |
Build system that compiles fetched source code (A-13). Not controlled by dfetch - it receives untrusted third-party source. |
ExternalEntity |
— / — / — |
A-12: dfetch Manifest |
|
Datastore |
Critical / Critical / — |
A-13: Fetched Source Code |
Third-party source code written to the |
Datastore |
Critical / Critical / High |
A-15: SBOM Output (CycloneDX) |
CycloneDX JSON/XML produced by |
Datastore |
High / High / — |
A-16: VCS Credentials |
SSH private keys, HTTPS Personal Access Tokens, SVN passwords. Used to authenticate to private upstream repositories. dfetch never persists these - managed by OS keychain, SSH agent, or CI secret store. |
Data |
High / High / High |
A-17: Embedded Credential in Remote URL |
A VCS or archive URL that encodes a credential in the userinfo component (e.g. |
Data |
— / — / — |
A-18: Dependency Metadata |
|
Datastore |
High / High / — |
A-19: Patch Files |
Unified-diff |
Datastore |
High / High / — |
A-20: Local VCS Cache (temp) |
Temporary directory used during git-clone / svn-checkout / archive extraction. Deleted after content is copied to dst. Path-traversal attacks targeting this space are mitigated by |
Datastore |
High / High / High |
A-21: Audit / Check Reports |
SARIF, Jenkins warnings-ng, Code Climate JSON produced by |
Datastore |
High / High / — |
A-22: dfetch Process |
Python CLI entry point dispatching to: update, check, diff, add, remove, update-patch, format-patch, freeze, import, init, report, validate, environment. Invokes Git and SVN as subprocesses ( |
Process |
High / High / High |
A-23: Upstream Source Attestation (VSA) |
SLSA Source Provenance Attestation or Verification Summary Attestation (VSA) that an upstream VCS host can publish for a specific revision, attesting that the source-level controls required by a given SLSA source level - branch protection, mandatory review, and ancestry enforcement - were applied. CRITICAL: dfetch has no mechanism to request or verify source-level attestations and the manifest schema has no field to declare an expected SLSA source level. In the absence of a VSA the consumer cannot cryptographically distinguish a well-governed upstream from one with no controls at all. |
Datastore |
High / High / — |
A-24: Archive Extraction (tarfile / zipfile) |
Decompresses and extracts TAR (.tar.gz/.tgz/.tar.bz2/.tar.xz) and ZIP archives to a temporary directory. Pre-extraction checks validate decompression-bomb limits, path traversal, symlinks, hardlinks, device files, and FIFOs. On Python ≥ 3.11.4: |
Process |
High / High / High |
A-25: Patch Application (patch-ng) |
Invokes |
Process |
High / High / High |
A-26: SVN Export (svn export) |
Runs |
Process |
High / High / High |
A-27: Git Clone (git init / fetch / checkout) |
Sequence of |
Process |
High / High / High |
Dataflows¶
Name |
From |
To |
Protocol |
|---|---|---|---|
DF-01: Invoke dfetch command |
Developer |
A-22: dfetch Process |
|
DF-02: Read manifest |
A-12: dfetch Manifest |
A-22: dfetch Process |
|
DF-03a: Fetch VCS content - HTTPS/SSH |
A-22: dfetch Process |
A-09: Remote VCS Server |
HTTPS / SSH |
DF-03b: Fetch VCS content - svn:// / http:// |
A-22: dfetch Process |
A-09: Remote VCS Server |
HTTP / SVN |
DF-04a: VCS content inbound - HTTPS/SSH |
A-09: Remote VCS Server |
A-22: dfetch Process |
HTTPS / SSH |
DF-04b: VCS content inbound - svn:// / http:// |
A-09: Remote VCS Server |
A-22: dfetch Process |
HTTP / SVN |
DF-05a: Archive download request - HTTPS |
A-22: dfetch Process |
A-10: Archive HTTP Server |
HTTPS |
DF-05b: Archive download request - HTTP |
A-22: dfetch Process |
A-10: Archive HTTP Server |
HTTP |
DF-06a: Archive bytes - HTTPS |
A-10: Archive HTTP Server |
A-22: dfetch Process |
HTTPS |
DF-06b: Archive bytes - HTTP (plaintext risk) |
A-10: Archive HTTP Server |
A-22: dfetch Process |
HTTP |
DF-07: Write vendored files |
A-22: dfetch Process |
A-13: Fetched Source Code |
|
DF-08: Write dependency metadata |
A-22: dfetch Process |
A-18: Dependency Metadata |
|
DF-09: Write SBOM |
A-22: dfetch Process |
A-15: SBOM Output (CycloneDX) |
|
DF-16: Read dependency metadata |
A-18: Dependency Metadata |
A-22: dfetch Process |
|
DF-10: Read patch for application |
A-19: Patch Files |
A-25: Patch Application (patch-ng) |
|
DF-10b: Write patched files to vendor directory |
A-25: Patch Application (patch-ng) |
A-13: Fetched Source Code |
|
DF-15: Vendored source to build |
A-13: Fetched Source Code |
A-11: Consumer Build System |
|
DF-11: Dispatch archive bytes to extraction |
A-22: dfetch Process |
A-24: Archive Extraction (tarfile / zipfile) |
|
DF-12: Write extracted archive to temp dir |
A-24: Archive Extraction (tarfile / zipfile) |
A-20: Local VCS Cache (temp) |
|
DF-13: Dispatch SVN export subprocess |
A-22: dfetch Process |
A-26: SVN Export (svn export) |
|
DF-14: Write SVN export to temp dir |
A-26: SVN Export (svn export) |
A-20: Local VCS Cache (temp) |
|
DF-23: Dispatch git clone subprocess |
A-22: dfetch Process |
A-27: Git Clone (git init / fetch / checkout) |
|
DF-24: Write git checkout to temp dir |
A-27: Git Clone (git init / fetch / checkout) |
A-20: Local VCS Cache (temp) |
|
DF-17: Write audit / check reports |
A-22: dfetch Process |
A-21: Audit / Check Reports |
|
DF-22: Read validated content from local VCS cache |
A-20: Local VCS Cache (temp) |
A-22: dfetch Process |
|
DF-18: Read integrity hash for archive verification |
A-12: dfetch Manifest |
A-22: dfetch Process |
|
DF-18b: Write computed hash to manifest (dfetch freeze) |
A-22: dfetch Process |
A-12: dfetch Manifest |
|
DF-20: Author / maintain dfetch.yaml |
Developer |
A-12: dfetch Manifest |
|
DF-19: VCS server publishes source attestation (not consumed by dfetch) |
A-09: Remote VCS Server |
A-23: Upstream Source Attestation (VSA) |
|
DF-21: Create / maintain patch files |
Developer |
A-19: Patch Files |
Threats¶
ID |
Description |
Target |
Analysis |
Controls / Notes |
|---|---|---|---|---|
DFT-01 |
Unencrypted transport interception (MITM) |
DF-06b: Archive bytes - HTTP (plaintext risk) |
Sev: 🟠H
Risk: 🔴C
STRIDE: T S
Status: Mitigate
|
C-005 mitigates only when |
DFT-02 |
Supply-chain content substitution via server-side compromise |
DF-04a: VCS content inbound - HTTPS/SSH |
Sev: 🟠H
Risk: 🟠H
STRIDE: T S
Status: Mitigate
|
Archives: C-005 mitigates when hash is present. Git/SVN refs have no equivalent integrity mechanism; pinning to a commit SHA is the strongest available mitigation. |
DFT-03 |
Path traversal in archive or patch extraction |
A-25: Patch Application (patch-ng) |
Sev: 🔴VH
Risk: 🟠H
STRIDE: T E
Status: Mitigate
|
Archive and VCS extraction mitigated by C-001, C-003, C-004. Patch files carry no integrity hash and are not independently verified. |
DFT-04 |
Sensitive datastore write without content integrity verification |
A-13: Fetched Source Code |
Sev: 🟠H
Risk: 🟠H
STRIDE: T
Status: Mitigate
|
C-008 |
DFT-05 |
Mutable VCS reference enables silent content substitution |
DF-04a: VCS content inbound - HTTPS/SSH |
Sev: 🟡M
Risk: 🟠H
STRIDE: T S
Status: Mitigate
|
C-005 mitigates archive deps when hash present. Git/SVN: no integrity mechanism; pinning to an immutable commit SHA is recommended but not enforced by dfetch. |
DFT-07 |
CI/CD secret exfiltration via supply-chain attack on build environment |
A-25: Patch Application (patch-ng) |
Sev: 🟠H
Risk: 🟠H
STRIDE: I
Status: Accept
|
dfetch uses |
DFT-08 |
Tampered secondary artifact suppresses or bypasses security checks |
A-18: Dependency Metadata |
Sev: 🟡M
Risk: 🟠H
STRIDE: T
Status: Mitigate
|
Manifest schema (C-008) validates all string fields; patch files carry no integrity hash and are not verified before application. |
DFT-09 |
Archive decompression bomb causes resource exhaustion |
A-24: Archive Extraction (tarfile / zipfile) |
Sev: 🟡M
Risk: 🟡M
STRIDE: D
Status: Mitigate
|
C-002 |
DFT-10 |
Build or development dependency substitution via compromised registry |
A-22: dfetch Process |
Sev: 🟠H
Risk: 🟠H
STRIDE: T
Status: Accept
|
dfetch’s runtime dependency supply-chain is the supply-chain model’s scope; use a verified dfetch installation. Accepted based on the dfetch scope boundary assumption: dfetch is responsible only for its own security posture; the integrity of dfetch’s own runtime dependencies is out of scope for this usage model and is addressed by the supply-chain threat model. |
DFT-12 |
SSRF via unvalidated HTTP redirect chain |
DF-05a: Archive download request - HTTPS |
Sev: 🟠H
Risk: 🟠H
STRIDE: I
Status: Accept
|
Archive downloads follow up to 10 HTTP redirects without validating the destination against RFC-1918, loopback, or link-local ranges; SSRF to internal metadata endpoints is possible. Accepted based on the No HTTPS enforcement assumption: HTTPS enforcement and safe URL selection are the manifest author’s responsibility; the manifest is under code review, and URLs that could expose internal services should be rejected at the review boundary. |
DFT-13 |
Credential embedded in source URL persisted to unencrypted metadata |
A-18: Dependency Metadata |
Sev: 🟠H
Risk: 🟡M
STRIDE: I
Status: Accept
|
dfetch persists the configured URL to |
DFT-14 |
Dangerous file permission bits preserved during archive extraction |
A-24: Archive Extraction (tarfile / zipfile) |
Sev: 🟠H
Risk: 🟡M
STRIDE: T
Status: Accept
|
dfetch does not strip executable or setuid/setgid bits from extracted archive members; on Python < 3.11.4, TAR extraction preserves such bits. dfetch supports Python ≥ 3.10 ( |
DFT-15 |
VCS externals / submodules trigger undeclared third-party fetches |
A-27: Git Clone (git init / fetch / checkout) |
Sev: 🟠H
Risk: 🟠H
STRIDE: T
Status: Accept
|
Git submodules are followed: |
DFT-16 |
Configured destination path allows writes to security-sensitive project directories |
A-22: dfetch Process |
Sev: 🔴VH
Risk: 🟠H
STRIDE: T E
Status: Accept
|
C-001 prevents writes outside the project root; no denylist blocks writes to sensitive within-root paths such as |
DFT-17 |
Typosquatting or unverified source identity on an unauthenticated channel |
DF-06a: Archive bytes - HTTPS |
Sev: 🟠H
Risk: 🟡M
STRIDE: S
Status: Accept
|
Manifest author responsibility; the manifest is under code review. Accepted based on the Manifest under code review assumption: |
DFT-18 |
Dependency confusion - public registry package shadows private internal package |
A-12: dfetch Manifest |
Sev: 🟠H
Risk: 🟠H
STRIDE: T S
Status: Accept
|
Not applicable to dfetch’s fetch-by-explicit-URL model; relevant only if using package-registry shorthand. Accepted based on the dfetch scope boundary assumption: dfetch fetches by explicit URL declared in the manifest rather than by package name resolved against a registry; dependency confusion via registry namespace shadowing cannot occur within dfetch’s fetch model. |
DFT-19 |
Malicious upstream update or intentional maintainer sabotage (protestware) |
A-13: Fetched Source Code |
Sev: 🔴VH
Risk: 🟠H
STRIDE: T
Status: Accept
|
Upstream maintainer trust; pinning to an immutable commit SHA is the strongest available mitigation but is not enforced by dfetch. Accepted based on the dfetch scope boundary assumption: the security of fetched third-party source code is the responsibility of the manifest author who selects and pins each dependency; intentional maintainer sabotage of an upstream is outside dfetch’s control. |
DFT-20 |
Abandoned package namespace reclaimed by malicious actor |
A-12: dfetch Manifest |
Sev: 🟠H
Risk: 🟡M
STRIDE: S T
Status: Accept
|
Not applicable to direct-URL fetches; relevant only if using Git-hosting shorthand with inferred registry lookup. Accepted based on the dfetch scope boundary assumption: dfetch fetches by explicit URL declared in the manifest rather than resolving package names against a registry; abandoned-namespace reclaim attacks require a registry lookup step that does not exist in dfetch’s fetch model. |
DFT-21 |
Unsigned or forged VCS tag accepted as a trusted version pin |
DF-04a: VCS content inbound - HTTPS/SSH |
Sev: 🟠H
Risk: 🟡M
STRIDE: S T
Status: Accept
|
dfetch does not verify VCS tag signatures; pinning to an immutable commit SHA is recommended. Accepted based on the Mutable VCS references assumption: branch- and tag-pinned Git dependencies are mutable references; upstream force-pushes can silently change the commit a tag resolves to without triggering a manifest diff, and tag-signature verification is not enforced by dfetch. |
DFT-22 |
Vendored content contains submodule or nested external reference triggering undeclared fetch |
A-13: Fetched Source Code |
Sev: 🟡M
Risk: 🟡M
STRIDE: T
Status: Accept
|
dfetch does not parse or execute embedded build manifests (CMakeLists.txt, package.json, etc.); undeclared fetches via build-system externals cannot occur. However, Git dependencies with submodules and SVN dependencies with |
DFT-23 |
Replay or freeze attack delivers stale content to suppress security updates |
DF-06a: Archive bytes - HTTPS |
Sev: 🟡M
Risk: 🟡M
STRIDE: T
Status: Accept
|
No freshness check; |
DFT-24 |
Local dependency cache or metadata store poisoned to suppress integrity alerts |
A-18: Dependency Metadata |
Sev: 🟠H
Risk: 🟡M
STRIDE: T
Status: Accept
|
|
DFT-25 |
Forged or unverifiable provenance attestation conceals malicious build output |
A-15: SBOM Output (CycloneDX) |
Sev: 🟠H
Risk: 🟠H
STRIDE: S T R
Status: Accept
|
dfetch does not verify upstream SLSA provenance of fetched sources; provenance verification is the consumer’s responsibility. Accepted based on the dfetch scope boundary assumption: the security of fetched third-party source code is the responsibility of the manifest author who selects and pins each dependency; upstream provenance attestation is outside dfetch’s own security posture. |
DFT-26 |
Protocol or transport downgrade forces connection over insecure channel |
A-27: Git Clone (git init / fetch / checkout) |
Sev: 🟠H
Risk: 🟠H
STRIDE: T I
Status: Mitigate
|
C-009 emits a visible warning immediately before the VCS command when a plaintext scheme ( |
DFT-28 |
CI/CD build cache poisoned to silently substitute a malicious compiled artifact |
A-20: Local VCS Cache (temp) |
Sev: 🟠H
Risk: 🟠H
STRIDE: T
Status: Accept
|
Build-cache poisoning (SLSA E6) is a CI/CD supply-chain concern that applies to the dfetch build pipeline, not to runtime usage. dfetch does not maintain a persistent compiled artifact cache; fetched source files are written directly to the vendor directory. See the supply-chain threat model for the mitigating control (C-033). Accepted based on the dfetch scope boundary assumption: dfetch is responsible only for its own security posture; the CI/CD build pipeline for dfetch itself is outside the scope of the runtime-usage model. |
DFT-30 |
Weak or deprecated hash algorithm allows collision-based integrity bypass |
A-22: dfetch Process |
Sev: 🟠H
Risk: 🟠H
STRIDE: T S
Status: Mitigate
|
C-005, C-034 |
DFT-31 |
Upstream source publishes no SLSA Source provenance attestation — consumer cannot verify upstream security controls |
DF-04a: VCS content inbound - HTTPS/SSH |
Sev: 🟡M
Risk: 🟢L
STRIDE: R
Status: Accept
|
Upstream repositories are outside dfetch’s control; no mechanism exists to require or verify upstream SLSA source level. Accepted based on the dfetch scope boundary assumption: the security of fetched third-party source code is the responsibility of the manifest author who selects and pins each dependency; verifying upstream governance controls is outside dfetch’s own security posture. |
DFT-32 |
Upstream source enforces no mandatory two-party review — single contributor can introduce changes without independent verification |
A-13: Fetched Source Code |
Sev: 🟡M
Risk: 🟢L
STRIDE: T
Status: Accept
|
Upstream repositories are outside dfetch’s control; no mechanism exists to require mandatory two-party review on upstream changes. Accepted based on the dfetch scope boundary assumption: the security of fetched third-party source code is the responsibility of the manifest author who selects and pins each dependency; requiring upstream review policies is outside dfetch’s own security posture. |
DFT-33 |
Upstream default-branch history rewritten — ancestry broken, pinned SHA orphaned or made unreachable |
DF-04a: VCS content inbound - HTTPS/SSH |
Sev: 🟡M
Risk: 🟢L
STRIDE: T
Status: Accept
|
Upstream repositories are outside dfetch’s control; dfetch cannot prevent or detect upstream force-pushes. Accepted based on the Mutable VCS references assumption: branch- and tag-pinned Git dependencies are mutable references; upstream force-pushes silently change what is fetched without triggering a manifest diff, and dfetch has no mechanism to verify that a pinned SHA remains reachable after a history rewrite. |
Controls¶
ID |
Name |
Threats |
Description |
|---|---|---|---|
C-001 |
Path-traversal prevention |
DFT-03 |
|
C-002 |
Decompression-bomb protection |
DFT-09 |
Archives are rejected if the uncompressed size exceeds 500 MB or the member count exceeds 10 000. |
C-003 |
Archive symlink validation |
DFT-03 |
Absolute and escaping ( |
C-004 |
Archive member type checks |
DFT-03 |
TAR and ZIP members of type device file or FIFO are rejected outright. |
C-005 |
Integrity hash verification |
DFT-01, DFT-02, DFT-05, DFT-30 |
SHA-256, SHA-384, and SHA-512 verified via |
C-006 |
Non-interactive VCS |
DFT-06 |
|
C-007 |
Subprocess safety |
DFT-06 |
All external commands invoked with |
C-008 |
Manifest input validation |
DFT-04, DFT-08 |
StrictYAML schema with |
C-009 |
Plaintext transport detection |
DFT-26 |
|
C-034 |
Hash algorithm allowlist (SHA-256/384/512 only) |
DFT-30 |
|