SKY-D337 · Security in code
Package registry or index override
Package installers fetch from a default registry (PyPI, npmjs.org, RubyGems) unless a command points them elsewhere. SKY-D337 reports an install or config command that adds or replaces the registry, so a person can check who runs that registry.
- Languages
- Dockerfile, Shell, GitHub Actions, GitLab CI, Python, TypeScript/JavaScript
- Quality gate
- counted toward the gate limits (full and diff scans)
- Finding type
- review
Why it matters
With pip install --extra-index-url, pip takes the highest version of a name from either index. If your internal package acme-billing is not also reserved on PyPI, anyone can publish acme-billing 99.0 there and your next build installs and runs it (dependency confusion).
What Skylos flags
FROM python:3.12-slimWORKDIR /appCOPY requirements.txt .RUN pip install --no-cache-dir \ --extra-index-url https://pypi.acme-internal.example/simple \ -r requirements.txtCOPY . .CMD ["python", "-m", "acme_billing"]What Skylos leaves alone
FROM python:3.12-slimWORKDIR /appCOPY requirements.txt .COPY wheels/ /wheels/RUN pip install --no-cache-dir --no-index --find-links /wheels \ -r requirements.txtCOPY . .CMD ["python", "-m", "acme_billing"]Why Skylos leaves it alone
--no-index turns every package index off, and --find-links /wheels installs only wheels already copied into the image, so no outside index is involved. Skylos looks only for --index-url and --extra-index-url on pip.
More languages
Shell
Flagged
#!/usr/bin/env bashset -euo pipefailnpm install --registry https://npm.acme-internal.example/ @acme/uiNot flagged
#!/usr/bin/env bashset -euo pipefailnpm install @acme/ui@acme:registry=https://npm.acme-internal.example/Why Skylos leaves it alone
The project's .npmrc sends only the @acme scope to the internal registry; everything else still comes from npmjs.org, so a public package cannot take an internal name's place. Skylos reads commands, not .npmrc files, and this command names no registry.
How Skylos decides
- Reads shell commands in
.sh,.bash,.zsh,.kshand.batsfiles, GitHub Actionsrun:steps, GitLab CI script items, DockerfileRUNinstructions (continuation lines joined), fixed command strings in Pythonos.system()-style calls orshell=Truecalls, and fixed strings passed tochild_process.exec()in TypeScript and JavaScript. - Splits each command at
;,&&,||and|, and looks at the command word of each part (aftersudo,nohup,time,commandandVAR=valueprefixes). pip,pip3,python -m pipandpython3 -m pip: reports an argument that starts with--index-urlor--extra-index-url.npm,pnpmandyarn: reports an argument that is the wordregistry(any case), as innpm config set registry …, or that starts with--registry.gem: reports an argument that starts with--source.- There is no allowlist: an internal registry is reported the same as an unknown one, and every finding is HIGH. Registry settings in files (
pip.conf,.npmrc,PIP_INDEX_URL) are not read.
How to fix it
Install from one index. Mirror your internal packages and their public dependencies behind a single --index-url you own, or scope npm packages with @scope:registry= in .npmrc, and reserve your internal names on the public registry. A reviewed single private index is still reported, so mark it with a reason.
FROM python:3.12-slimWORKDIR /appCOPY requirements.txt .Added: # skylos: ignore[SKY-D337] single proxy index, owned by platform teamRUN pip install --no-cache-dir \Removed: --extra-index-url https://pypi.acme-internal.example/simple \Removed: -r requirements.txtAdded: --index-url https://pypi.acme-internal.example/simple \Added: --require-hashes -r requirements.txtCOPY . .CMD ["python", "-m", "acme_billing"]When it can be wrong
- A single
--index-urlpointing at a proxy you own is reported the same as--extra-index-url, although only the extra index mixes two sources. - Read-only commands that contain the word
registry, such asnpm config get registry, are reported. - Missed:
pip install -i URL,--find-links URL,uv pip install --extra-index-url, registries set inpip.conf,.npmrcor environment variables; and in a GitHub Actionsrun: |block, or a multi-line GitLab item, an install on a later line, because the block is split only at;,&&,||and|, not at line breaks.
Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.
How to silence it
In a Dockerfile the marker goes on the first line of the
RUNinstruction or on the line directly above it, one rule per marker. In a shell script it must be a comment on the reported line.Dockerfile # skylos: ignore[SKY-D337] single proxy index, owned by platform teamRUN pip install --index-url https://pypi.acme-internal.example/simple -r req.txt[tool.skylos] ignore = ["SKY-D337"]turns the rule off for the whole project.