ampproject / ampproject/amp-toolbox

Support Offline CI Environments - validation schema `postinstall` download is a security issue

Open
#858 1 comment 0 reactions 0 assignees View on GitHub
toolbox-optimizer
Dominant language
HTML
Stars
459
Forks
242
PR merge metrics
No merged PRs in 30d

Description

The `@ampproject/toolbox-optimizer` package attempts to communicate with external servers in my CI environment when building my project.

External network traffic at build time is arguably a Bad Idea™ - my organization runs its CI builds with blocked network access to prevent any potential source/secret leaks from bad actors on NPM. Since [this package's `postinstall` script](https://github.com/ampproject/amp-toolbox/blob/main/packages/optimizer/package.json#L12) involves making network requests for validation rules, `amp-toolbox` is effectively broken in my environment.

Fetching new validation rules from an external source may seem like a convenient way to bypass publishing and deployment mechanisms, but this practice violates semver best practices by allowing for breaking changes to go out to consuming packages. The best course of action here is to tie validation rules to new patch/minor/major versions like the rest of your code and bundle the validation schema with this package as a dependency.

Contributor guide

Open the contributing guide

Research direction

Start with packages/optimizer/package.json at the postinstall script referenced in the issue, then trace how it fetches the validation rules. Determine how the rules can be bundled and versioned with the package; done means installation and CI builds make no external network requests while using the package’s declared validation rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
build-system, ci-cd, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.