PayCargo · AI Platform · Security

Third-party code, and how it gets here

What runs on this platform that we did not write, where it comes from, and the rule that keeps it from arriving unannounced.
In one sentence: the platform does use third-party code — five libraries in the browser and Amazon's SDK in every Lambda — but it does not install any of it: each library is a single reviewed file committed here with its fingerprint recorded, so the code running in production is provably the code somebody looked at, and nothing can change underneath us between one page load and the next.

“Zero npm” does not mean zero dependencies

The platform rule is zero npm in cartridge Lambdas. That is easy to hear as “there is no third-party code here”, which is not true — and pretending otherwise makes the rule harder to apply, because the first person who needs a library concludes the rule cannot mean what it says.

What the rule actually removes is the install:

What is avoidedWhy it matters
A transitive treeFive deliberate files instead of a dependency graph. Installing the Cognito library alone would pull in dozens of packages nobody chose or read.
An install stepNothing resolves a version at build time, so nothing can resolve differently tomorrow.
Postinstall scriptsThe most common supply-chain attack route. Absent, because nothing installs.
Lockfile driftThere is no lockfile, because there is nothing to lock.

What it gives in exchange is a fingerprint per file. The trade is that we update them by hand. On an authentication library, that is the right way round.

What actually runs

In the browser — committed here, served from our own domain

LibraryVersionSizeUsed for
amazon-cognito-identity-js6.3.12113 KBConsole sign-in
qrcode-generator1.4.457 KBThe QR code when you enrol an authenticator app
Font Awesome Free6.5.1500 KBIcons, everywhere
pdf.js (+ worker)4.6.821.7 MBShowing a PDF next to its extracted data

Each sits in a vendor/ folder with a record of its version, licence, source and SHA-256 fingerprint. Those records are tested against the files on every build — a provenance note that has drifted from its file is worse than none, because it is believed.

Still fetched from elsewhere at page load

WhatWhy it is not brought in-house
Google Fonts (Inter)Fonts, not executable code. Self-hosting is possible and is a fair future change.
Cognito advanced-security scriptAn AWS service endpoint, not a package. There is nothing to copy.

In every Lambda

Amazon's own SDK — 17 clients. This is by far the largest dependency on the platform and the one nobody pins: it arrives with the Node 20 runtime, and changes when AWS updates it. That is an accepted trade rather than an oversight — bringing it in-house would mean shipping megabytes into every function and owning its security updates. It is named here so it is a decision on the record, not an omission.

Why this is a security document

Until recently the Console fetched its sign-in library from a public CDN every time somebody loaded the page. Four things follow from that, and none are hypothetical.

Code you did not review, running where the session lives

The authentication library executes on the origin that holds the Cognito session. Whoever controls those bytes controls sign-in. A republished or tampered artifact has the user's credentials — and this is the most common supply-chain shape there is, not an exotic one.

A CDN is also an availability dependency

If that CDN had an outage, nobody could sign in — because the thing that performs sign-in came from the CDN.

Pinning a version is not pinning the bytes

@6.3.12 in a URL asks a third party for something it says is 6.3.12. A fingerprint in our own repository is the bytes themselves.

A domain-locked asset fails silently

Our Font Awesome Pro kit is locked to paycargo.com. Loaded from any other domain it does not error — it renders with no icons at all, which is the worst way for a dependency to fail. The platform forbids it by name for that reason.

How a library gets added

Six steps. The first is the one that is easy to get wrong.

  1. Take the upstream file, not a CDN's version of it. Some CDNs re-minify packages themselves and say so in a banner. Copying that records a CDN's transformation as though it were the official release, which is the exact claim this whole practice makes. This caught us: the QR library's .min.js on jsDelivr is jsDelivr's own output, so the unminified original was taken instead — 36 KB larger and actually verifiable.
  2. Put it in a vendor/ folder beside the code that loads it.
  3. Record it: library, version, licence, source URL, date retrieved, byte count, SHA-256, and which file loads it.
  4. Add it to the deployment file list. The Console publishes named files, so one that is missing from the list works locally and 404s in production.
  5. Never edit a vendored file. Editing changes the fingerprint and breaks the claim. To change it, re-copy and update the record.
  6. Check it is not already here. The Console links the SDK's Font Awesome rather than keeping a second identical copy. Two copies means two fingerprints and two places to forget.

What stops this drifting back

An automated check fails the build if anything a browser loads reaches for a third-party CDN — cartridge screens, the Console, and the shared SDK alike. It covers jsDelivr, unpkg, cdnjs, esm.sh, Skypack and the domain-locked Font Awesome kit.

Where it stands

The Console fetches no executable third-party code at load time. One cartridge (this one) still does, and is recorded as a known exception rather than quietly tolerated.

Checking it yourself

Every vendored file can be verified against its record:

shasum -a 256 console/frontend/vendor/amazon-cognito-identity.min.js # 165e0d38136cffd3… ← must match vendor/README.md shasum -a 256 console/frontend/vendor/qrcode.js # 18ae399f81182bc9… node scripts/arch-lint.mjs ← fails if anything reaches for a CDN

The engineering detail — exact paths, full fingerprints and the per-file records — is in docs/dependencies.md in the repository.