Skip to content

fix: Pillow in deploy requirements so CLS dimension injection works in prod - #76

Merged
rivassec merged 1 commit into
mainfrom
fix-cls-pillow-in-deploy
Sep 12, 2026
Merged

fix: Pillow in deploy requirements so CLS dimension injection works in prod#76
rivassec merged 1 commit into
mainfrom
fix-cls-pillow-in-deploy

Conversation

@rivassec

Copy link
Copy Markdown
Owner

Bug

PR #74 (inline-image width/height for CLS) is inert in production. img_hygiene needs Pillow to read dimensions, but Pillow was only a dev-time dep. deploy.yml installs requirements.txt with --no-deps, so on the runner from PIL import Image fails, the Image = None guard trips, and dimensions are silently skipped (only loading/decoding, which don't need Pillow, survived). Verified live: the leap-second inline img had loading/decoding but no width/height. Found while verifying batch-2 after a cache purge; CI was green because no guard asserts dimension presence.

Fix

pillow==12.2.0 added to requirements.in; requirements.txt regenerated with hashes. Pillow has no required runtime deps (all extras), so --no-deps stays correct. Compiled with --no-emit-index-url (see note).

Verified

  • 0 secret / index-url lines in the lockfile; pillow present with 91 hashes.
  • Local build injects width=2000 height=800 on the leap-second image; 38 tests pass.
  • Real proof is the post-merge deploy: live inline imgs should then carry width/height.

SECURITY NOTE (separate, needs your attention)

While regenerating the lockfile, pip-compile pulled an --extra-index-url from ~/.config/pip/pip.conf that embeds a live Primer Azure DevOps PAT, and wrote it into requirements.txt. GitHub push-protection blocked it and I recompiled with --no-emit-index-url, so nothing leaked (main was and is clean). But that PAT sits in your pip.conf and any pip-compile without --no-emit-index-url will re-embed it. Recommend: always use --no-emit-index-url for this repo, and consider whether that ADO PAT should be rotated / moved to a keyring.

…ks in prod

PR #74's width/height injection needs Pillow, but it was only a dev dep;
deploy installs requirements.txt with --no-deps so 'from PIL import Image'
failed on the runner -> dims silently skipped -> #74 inert in production.
Pillow has no required runtime deps, so --no-deps stays safe. Compiled
with --no-emit-index-url to keep private index URLs out of the lockfile.
@rivassec
rivassec merged commit 7e37b81 into main Sep 12, 2026
18 checks passed
@rivassec
rivassec deleted the fix-cls-pillow-in-deploy branch September 12, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant