From 35ef908f05f0f66cdcae5731c4227bcbe34e338c Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:28:46 -0600 Subject: [PATCH 1/7] Upgrade supported runtimes and harden dependency and image checks --- .bundler-audit.yml | 14 + .dockerignore | 20 + .github/workflows/test.yml | 88 +- .node-version | 1 + .ruby-version | 2 +- .tool-versions | 3 +- Dockerfile | 132 +- Gemfile | 16 +- Gemfile.lock | 405 +++--- README.md | 34 +- app/controllers/application_controller.rb | 15 - app/models/account.rb | 2 +- app/models/post.rb | 2 +- app/models/subscription.rb | 2 +- bin/render-build.sh | 4 +- config/initializers/grover.rb | 12 +- config/initializers/pay.rb | 31 + config/tailwind.config.js | 1 - package-lock.json | 1155 +++-------------- package.json | 9 +- render.yaml | 2 +- test/config/grover_runtime_test.rb | 12 + test/controllers/pay_payment_redirect_test.rb | 60 + test/javascript/browser_runtime.test.cjs | 24 + 24 files changed, 689 insertions(+), 1357 deletions(-) create mode 100644 .bundler-audit.yml create mode 100644 .dockerignore create mode 100644 .node-version create mode 100644 test/config/grover_runtime_test.rb create mode 100644 test/controllers/pay_payment_redirect_test.rb create mode 100644 test/javascript/browser_runtime.test.cjs diff --git a/.bundler-audit.yml b/.bundler-audit.yml new file mode 100644 index 0000000..13713bc --- /dev/null +++ b/.bundler-audit.yml @@ -0,0 +1,14 @@ +# Pay remains on v5 until its billing/data migration has separate validation. +# Every exception has an application regression test; do not expand this list +# to silence a new advisory. +ignore: + # Upstream's back-parameter XSS fix is backported in config/initializers/pay.rb. + # test/controllers/pay_payment_redirect_test.rb exercises the mounted payment + # route with script URLs, external URLs, invalid URLs, and a valid local path. + # https://github.com/pay-rails/pay/security/advisories/GHSA-cqf3-vpx7-rxhw + - CVE-2023-30614 + # Pay 5 has no PaddleBillingController or /webhooks/paddle_billing route. + # Paddle Billing was introduced in Pay 7. Only Stripe is enabled, and the + # same integration test verifies Paddle/Braintree endpoints are not routed. + # https://github.com/pay-rails/pay/blob/main/UPGRADE.md#pay-60-to-pay-70 + - GHSA-mjgf-xj26-9qf9 diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a361fd0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +.git +.github +.agents +.codex +.bundle +.env* +config/master.key +config/credentials/*.key +node_modules +.cache +log/* +!log/.keep +tmp/* +!tmp/.keep +storage/* +!storage/.keep +public/assets +app/assets/builds/* +!app/assets/builds/.keep +.DS_Store diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebd0185..2b9c985 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,12 +1,24 @@ name: Tests on: [push, pull_request] + +permissions: + contents: read + +concurrency: + group: tests-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: test: - # Ubuntu 24.04 provides libvips >= 8.13 for patched Active Storage. runs-on: ubuntu-24.04 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + app-mode: [SOLO, MULTIUSER] services: postgres: - image: postgres:10 + image: postgres:16 env: POSTGRES_PASSWORD: postgres ports: ['5432:5432'] @@ -15,57 +27,59 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 - redis: - image: redis - ports: - - 6379:6379 - options: --entrypoint redis-server env: RAILS_ENV: test - RAILS_MASTER_KEY: ${{ secrets.RAILS_TEST_KEY }} + APP_MODE: ${{ matrix.app-mode }} + DATABASE_URL: postgres://postgres:postgres@localhost:5432/postcard_test + SECRET_KEY_BASE: test-only-secret-key-base + DISABLE_ANONYMOUS_TELEMETRY: 'true' + AWS_EC2_METADATA_DISABLED: 'true' + GROVER_NO_SANDBOX: 'true' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 + - name: Install native dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --no-install-recommends -y libpq-dev libvips libvips-tools - name: Install Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 3.2.2 bundler-cache: true - name: Install Node - uses: actions/setup-node@v1 + uses: actions/setup-node@v7 with: - node-version: 18.12.1 - - name: Install libvips - env: - DEBIAN_FRONTEND: noninteractive + node-version-file: .node-version + cache: npm + - name: Install JavaScript dependencies + run: npm ci + - name: Install browser libraries + run: sudo npx puppeteer browsers install chrome --install-deps + - name: Prepare database and assets run: | - # we only need the library - sudo apt-get update - sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 libvips libvips-tools - - name: Setup the Rails application - env: - RAILS_ENV: test - run: | - sudo apt-get -yqq install libpq-dev - bundle install --no-deployment --jobs 4 --retry 3 - cp config/database.github.yml config/database.yml - bundle exec rails db:create - bundle exec rails db:migrate - yarn --frozen-lockfile - bundle exec rake assets:precompile + bundle exec rails db:create db:migrate + bundle exec rails assets:precompile - name: Check Zeitwerk autoloading run: bundle exec rails zeitwerk:check - - name: Run unit tests (SOLO) + - name: Run all Rails tests run: bundle exec rails test:all - - name: Run unit tests (MULTIUSER) - env: - APP_MODE: MULTIUSER - run: bundle exec rails test:all - - name: Run brakeman + - name: Verify browser image generation + run: npm test + - name: Run Brakeman run: bundle exec brakeman + - name: Audit Ruby dependencies + run: bundle exec bundler-audit check --update docker-smoke-test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + timeout-minutes: 30 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v7 - name: Build Docker image run: docker build -t postcard:test . + - name: Verify Rails boots without deployment credentials + run: >- + docker run --rm --entrypoint bundle + -e RAILS_ENV=build -e SECRET_KEY_BASE=DUMMY postcard:test + exec rails runner 'puts Rails.version' + - name: Verify the image includes a working browser + run: docker run --rm --entrypoint npm postcard:test test diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..b7179ae --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24.20.0 diff --git a/.ruby-version b/.ruby-version index be94e6f..84d6c67 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.4.10 diff --git a/.tool-versions b/.tool-versions index f2a971a..4108124 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1,2 @@ -ruby 3.2.2 +ruby 3.4.10 +nodejs 24.20.0 diff --git a/Dockerfile b/Dockerfile index 1da8a43..aeb3ac0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,118 +1,62 @@ -# syntax = docker/dockerfile:1 +# syntax=docker/dockerfile:1 -# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.2.2 +# Keep these versions aligned with .ruby-version and .node-version. +ARG RUBY_VERSION=3.4.10 +ARG NODE_VERSION=24.20.0 +FROM --platform=linux/amd64 node:${NODE_VERSION}-bookworm-slim AS node +FROM --platform=linux/amd64 ruby:${RUBY_VERSION}-slim-bookworm AS base -# Bookworm provides libvips >= 8.13, required by the Active Storage security patch. -FROM --platform=linux/amd64 ruby:$RUBY_VERSION-slim-bookworm AS base - -# Rails app lives here WORKDIR /rails - -# Set production environment ENV RAILS_ENV="production" \ - BUNDLE_WITHOUT="development:test" \ - BUNDLE_DEPLOYMENT="1" \ - RAILS_SERVE_STATIC_FILES="true" \ - DEBIAN_FRONTEND="noninteractive" \ - GROVER_NO_SANDBOX="true" - - -# Update gems and bundler -# Pin RubyGems to 3.5.x because tailwindcss-rails 2.0.25 uses Gem::Platform.match, -# which was removed in RubyGems 3.6+ -RUN gem update --system 3.5.22 --no-document && \ - gem install -N bundler - + BUNDLE_WITHOUT="development:test:preview" \ + BUNDLE_DEPLOYMENT="1" \ + RAILS_SERVE_STATIC_FILES="true" \ + RAILS_LOG_TO_STDOUT="1" \ + GROVER_NO_SANDBOX="true" \ + PUPPETEER_CACHE_DIR="/rails/.cache/puppeteer" + +# Node's official binary avoids compiling Node during every image build. +COPY --from=node /usr/local/bin/node /usr/local/bin/node +COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules +RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \ + ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx + +# libvips >= 8.13 is required by the Active Storage security patch. +# Chromium is downloaded by the locked Puppeteer package; only its libraries +# are installed here, so no separate Chrome repository or browser is needed. +RUN apt-get update -qq && \ + apt-get install --no-install-recommends -y \ + ca-certificates curl imagemagick libvips postgresql-client \ + fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg \ + fonts-kacst fonts-freefont-ttf libasound2 libatk-bridge2.0-0 libatk1.0-0 \ + libcups2 libdbus-1-3 libdrm2 libgbm1 libgtk-3-0 libnspr4 libnss3 \ + libx11-xcb1 libxcomposite1 libxdamage1 libxfixes3 libxkbcommon0 \ + libxrandr2 libxshmfence1 libxss1 xdg-utils && \ + rm -rf /var/lib/apt/lists/* -# Throw-away build stage to reduce size of final image FROM base AS build - -# Install packages needed to build gems and node modules RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential curl libpq-dev libvips node-gyp pkg-config python-is-python3 dbus dbus-x11 && \ - service dbus start - -# Install JavaScript dependencies -ARG NODE_VERSION=18.12.1 -ENV PATH=/usr/local/node/bin:$PATH -RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ - /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ - rm -rf /tmp/node-build-master + apt-get install --no-install-recommends -y build-essential libpq-dev pkg-config && \ + rm -rf /var/lib/apt/lists/* -# Install application gems COPY --link Gemfile Gemfile.lock ./ RUN bundle install && \ - rm -rf ~/.bundle/ $BUNDLE_PATH/ruby/*/cache $BUNDLE_PATH/ruby/*/bundler/gems/*/.git + rm -rf /usr/local/bundle/cache /usr/local/bundle/ruby/*/cache -# Install node modules -COPY --link package.json ./ -RUN npm install +COPY --link package.json package-lock.json ./ +RUN npm ci --omit=dev && npm cache clean --force -# Copy application code COPY --link . . - -# Precompiling assets using build environment (production-like but without AWS dependencies) -RUN SECRET_KEY_BASE=DUMMY RAILS_ENV=build ./bin/rails assets:clobber RUN SECRET_KEY_BASE=DUMMY RAILS_ENV=build ./bin/rails assets:precompile -# Final stage for app image FROM base - -# Install packages needed for deployment -RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl imagemagick libvips postgresql-client && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives - -# Puppeteer deps -RUN apt-get update \ - && apt-get install -y wget gnupg \ - && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ - && apt-get update \ - && apt-get install -y fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libatk-bridge2.0-0 libcups2 libdrm2 libxkbcommon-x11-0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libnss3 libgtk-3-0 xvfb x11-apps x11-xkb-utils libx11-6 libx11-xcb1 \ - libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libatk1.0-0 libc6 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libnspr4 libpangocairo-1.0-0 libstdc++6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \ - --no-install-recommends - -# Copy built artifacts: gems, application COPY --from=build /usr/local/bundle /usr/local/bundle COPY --from=build /rails /rails -# Copy Node.js and node_modules from build stage -COPY --from=build /usr/local/node /usr/local/node -COPY --from=build /rails/node_modules /rails/node_modules -ENV PATH=/usr/local/node/bin:$PATH - - -# Run and own only the runtime files as a non-root user for security RUN useradd rails --create-home --shell /bin/bash && \ - chown -R rails:rails /rails && \ - chown -R rails:rails db log storage tmp /rails/node_modules + chown -R rails:rails /rails USER rails:rails -# Deployment options -ENV RAILS_LOG_TO_STDOUT="1" \ - RAILS_SERVE_STATIC_FILES="true" - -# Set up dbus -RUN mkdir -p /home/rails/.dbus && chown -R rails:rails /home/rails/.dbus -ENV DBUS_SESSION_BUS_ADDRESS=/home/rails/.dbus/system_bus_socket - -# Set up Puppeteer environment -ENV PUPPETEER_CACHE_DIR=/home/rails/.cache/puppeteer \ - PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false - -# Create Puppeteer cache directory with correct permissions -RUN mkdir -p $PUPPETEER_CACHE_DIR && \ - chown -R rails:rails $PUPPETEER_CACHE_DIR - -# Install Puppeteer and Chrome -RUN cd /rails && \ - npm install puppeteer && \ - npx puppeteer browsers install chrome - -# Entrypoint sets up the container. ENTRYPOINT ["/rails/bin/docker-entrypoint"] - -# Start the server by default, this can be overwritten at runtime EXPOSE 3000 +CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"] diff --git a/Gemfile b/Gemfile index 440ac75..656156b 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.2.2' +ruby '3.4.10' gem 'ahoy_email', '~> 2.1', '>= 2.1.3' gem 'ahoy_matey' @@ -13,13 +13,13 @@ gem 'bcrypt', '~> 3.1.7' gem 'blazer' gem 'clearbit', '~> 0.3.3' gem 'dalli', '~> 3.2' -gem 'devise', '~> 4.9' +gem 'devise', '~> 5.0', '>= 5.0.4' gem 'dotenv-rails', '~> 2.8' gem 'friendly_id', '~> 5.4', '>= 5.4.2' gem 'geocoder' gem 'grover', '~> 1.1' gem 'honeypot-captcha', '~> 1.0' -gem 'httparty', '~> 0.21.0' +gem 'httparty', '~> 0.24' gem 'image_processing', '~> 1.2' gem 'importmap-rails', '~> 2' gem 'inline_svg', '~> 1.8' @@ -38,8 +38,8 @@ gem 'possessive', '~> 1.0' gem 'aws-sdk-rails', '~> 5' gem 'aws-actionmailer-ses', '~> 1' gem 'premailer-rails', '~> 1.11' -gem 'puma', '~> 6.4' -gem 'rails', '~> 7.2.3', '>= 7.2.3.2' +gem 'puma', '~> 7.2', '>= 7.2.1' +gem 'rails', '~> 8.1.3', '>= 8.1.3.1' gem 'rails_heroicon', '~> 2.1.0' gem 'recaptcha' gem 'redis', '~> 4.0' @@ -48,7 +48,7 @@ gem 'sitemap_generator', '~> 6.3' gem 'sprockets-rails' gem 'stimulus-rails', '~> 1.2.1' gem 'stripe', '~> 7.0' -gem 'tailwindcss-rails', '2.0.25' +gem 'tailwindcss-rails', '~> 2.7.9' gem 'truemail', '~> 2.7' gem 'turbo-rails', '1.4.0' gem 'twitter', '~> 7.0' @@ -66,7 +66,8 @@ gem "pghero" group :development, :test, :preview do # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem - gem 'brakeman', '~> 5.0' + gem 'bundler-audit', '~> 0.9' + gem 'brakeman', '~> 8.0', '>= 8.0.6' gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'debug', platforms: %i[mri mingw x64_mingw] gem 'faker', '~> 2.19' @@ -92,6 +93,7 @@ group :development do end group :test do + gem 'minitest-mock' # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing] gem 'capybara' gem 'selenium-webdriver' diff --git a/Gemfile.lock b/Gemfile.lock index a98b2f4..86ea341 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,81 +1,82 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.2.3.2) - actionpack (= 7.2.3.2) - activesupport (= 7.2.3.2) + action_text-trix (2.1.19) + railties + actioncable (8.1.3.1) + actionpack (= 8.1.3.1) + activesupport (= 8.1.3.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.2.3.2) - actionpack (= 7.2.3.2) - activejob (= 7.2.3.2) - activerecord (= 7.2.3.2) - activestorage (= 7.2.3.2) - activesupport (= 7.2.3.2) + actionmailbox (8.1.3.1) + actionpack (= 8.1.3.1) + activejob (= 8.1.3.1) + activerecord (= 8.1.3.1) + activestorage (= 8.1.3.1) + activesupport (= 8.1.3.1) mail (>= 2.8.0) - actionmailer (7.2.3.2) - actionpack (= 7.2.3.2) - actionview (= 7.2.3.2) - activejob (= 7.2.3.2) - activesupport (= 7.2.3.2) + actionmailer (8.1.3.1) + actionpack (= 8.1.3.1) + actionview (= 8.1.3.1) + activejob (= 8.1.3.1) + activesupport (= 8.1.3.1) mail (>= 2.8.0) rails-dom-testing (~> 2.2) - actionpack (7.2.3.2) - actionview (= 7.2.3.2) - activesupport (= 7.2.3.2) - cgi + actionpack (8.1.3.1) + actionview (= 8.1.3.1) + activesupport (= 8.1.3.1) nokogiri (>= 1.8.5) - racc - rack (>= 2.2.4, < 3.3) + rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) - actiontext (7.2.3.2) - actionpack (= 7.2.3.2) - activerecord (= 7.2.3.2) - activestorage (= 7.2.3.2) - activesupport (= 7.2.3.2) + actiontext (8.1.3.1) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.3.1) + activerecord (= 8.1.3.1) + activestorage (= 8.1.3.1) + activesupport (= 8.1.3.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.2.3.2) - activesupport (= 7.2.3.2) + actionview (8.1.3.1) + activesupport (= 8.1.3.1) builder (~> 3.1) - cgi erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.2.3.2) - activesupport (= 7.2.3.2) + activejob (8.1.3.1) + activesupport (= 8.1.3.1) globalid (>= 0.3.6) - activemodel (7.2.3.2) - activesupport (= 7.2.3.2) - activerecord (7.2.3.2) - activemodel (= 7.2.3.2) - activesupport (= 7.2.3.2) + activemodel (8.1.3.1) + activesupport (= 8.1.3.1) + activerecord (8.1.3.1) + activemodel (= 8.1.3.1) + activesupport (= 8.1.3.1) timeout (>= 0.4.0) - activestorage (7.2.3.2) - actionpack (= 7.2.3.2) - activejob (= 7.2.3.2) - activerecord (= 7.2.3.2) - activesupport (= 7.2.3.2) + activestorage (8.1.3.1) + actionpack (= 8.1.3.1) + activejob (= 8.1.3.1) + activerecord (= 8.1.3.1) + activesupport (= 8.1.3.1) marcel (~> 1.0) - activesupport (7.2.3.2) + activesupport (8.1.3.1) base64 - benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + json logger (>= 1.4.2) - minitest (>= 5.1, < 6) + minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) - addressable (2.8.6) - public_suffix (>= 2.0.2, < 6.0) + uri (>= 0.13.1) + addressable (2.9.0) + public_suffix (>= 2.0.2, < 8.0) ahoy_email (2.3.0) actionmailer (>= 6.1) addressable (>= 2.3.2) @@ -85,54 +86,64 @@ GEM activesupport (>= 6.1) device_detector (>= 1) safely_block (>= 0.4) + anonymous_loader (0.1.3) + version_gem (~> 1.1, >= 1.1.14) ast (2.4.2) audited (5.8.0) activerecord (>= 5.2, < 8.2) activesupport (>= 5.2, < 8.2) + auth-sanitizer (0.2.3) + version_gem (~> 1.1, >= 1.1.14) aws-actionmailer-ses (1.0.0) actionmailer (>= 7.1.0) aws-sdk-ses (~> 1, >= 1.50.0) aws-sdk-sesv2 (~> 1, >= 1.34.0) aws-eventstream (1.3.0) - aws-partitions (1.942.0) - aws-sdk-core (3.197.0) + aws-partitions (1.1283.0) + aws-sdk-core (3.254.1) aws-eventstream (~> 1, >= 1.3.0) - aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + base64 + bigdecimal jmespath (~> 1, >= 1.6.1) + logger aws-sdk-kms (1.83.0) aws-sdk-core (~> 3, >= 3.197.0) aws-sigv4 (~> 1.1) aws-sdk-rails (5.1.0) aws-sdk-core (~> 3) railties (>= 7.1.0) - aws-sdk-s3 (1.152.1) - aws-sdk-core (~> 3, >= 3.197.0) + aws-sdk-s3 (1.229.0) + aws-sdk-core (~> 3, >= 3.254.1) aws-sdk-kms (~> 1) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.5) aws-sdk-ses (1.63.0) aws-sdk-core (~> 3, >= 3.197.0) aws-sigv4 (~> 1.1) aws-sdk-sesv2 (1.51.0) aws-sdk-core (~> 3, >= 3.197.0) aws-sigv4 (~> 1.1) - aws-sigv4 (1.8.0) + aws-sigv4 (1.12.1) aws-eventstream (~> 1, >= 1.0.2) backport (1.2.0) - base64 (0.2.0) - bcrypt (3.1.20) - benchmark (0.3.0) - bigdecimal (3.1.8) + base64 (0.3.0) + bcrypt (3.1.22) + benchmark (0.5.0) + bigdecimal (4.1.2) bindex (0.8.1) - blazer (3.0.3) - activerecord (>= 6.1) - chartkick (>= 5) + blazer (3.5.1) + activerecord (>= 7.2) csv - railties (>= 6.1) - safely_block (>= 0.4) - brakeman (5.4.1) + railties (>= 7.2) + safely_block (>= 1) + brakeman (8.0.6) + racc buftok (0.2.0) builder (3.3.0) + bundler-audit (0.9.3) + bundler (>= 1.2.0) + thor (~> 1.0) byebug (11.1.3) capybara (3.40.0) addressable @@ -143,8 +154,6 @@ GEM rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) - cgi (0.5.2) - chartkick (5.0.7) childprocess (5.1.0) logger (~> 1.5) clearbit (0.3.3) @@ -154,25 +163,23 @@ GEM activesupport (>= 7.2.0, < 8.2.0) railties (>= 7.2.0, < 8.2.0) zeitwerk (>= 2.5.0) - combine_pdf (1.0.26) - matrix - ruby-rc4 (>= 0.1.5) - concurrent-ruby (1.3.3) - connection_pool (2.4.1) - crass (1.0.6) - css_parser (1.17.1) + concurrent-ruby (1.3.8) + connection_pool (3.0.2) + crass (1.0.7) + css_parser (3.0.0) addressable + ssrf_filter (~> 1.5) csv (3.3.0) dalli (3.2.8) - date (3.3.4) + date (3.5.1) debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) device_detector (1.1.2) - devise (4.9.4) + devise (5.0.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0) + railties (>= 7.0) responders warden (~> 1.2.3) diff-lcs (1.5.1) @@ -181,16 +188,19 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - drb (2.2.1) + drb (2.2.3) e2mmap (0.1.0) equalizer (0.0.11) - erubi (1.12.0) + erb (6.0.7) + erubi (1.13.1) et-orbi (1.2.11) tzinfo faker (2.23.0) i18n (>= 1.8.11, < 2) - faraday (2.9.1) - faraday-net_http (>= 2.0, < 3.2) + faraday (2.14.3) + faraday-net_http (>= 2.0, < 3.5) + json + logger faraday-net_http (3.1.0) net-http ffi (1.17.0) @@ -203,17 +213,16 @@ GEM rake friendly_id (5.5.1) activerecord (>= 4.0.0) - fugit (1.11.0) + fugit (1.11.2) et-orbi (~> 1, >= 1.2.11) raabro (~> 1.4) geocoder (1.8.3) base64 (>= 0.1.0) csv (>= 3.0.0) - globalid (1.2.1) + globalid (1.4.0) activesupport (>= 6.1) - grover (1.1.7) - combine_pdf (~> 1.0) - nokogiri (~> 1.0) + grover (1.2.10) + nokogiri (~> 1) hashie (5.0.0) health_check (3.1.0) railties (>= 5.0) @@ -230,10 +239,11 @@ GEM http-parser (1.2.3) ffi-compiler (>= 1.0, < 2.0) http_parser.rb (0.6.0) - httparty (0.21.0) + httparty (0.24.2) + csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.14.5) + i18n (1.15.2) concurrent-ruby (~> 1.0) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) @@ -245,8 +255,10 @@ GEM inline_svg (1.9.0) activesupport (>= 3.0) nokogiri (>= 1.6) - io-console (0.7.2) - irb (1.13.1) + io-console (0.9.2) + irb (1.18.0) + pp (>= 0.6.0) + prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) jaro_winkler (1.6.0) @@ -255,7 +267,7 @@ GEM activesupport (>= 5.0.0) jmespath (1.6.2) json (2.7.2) - jwt (2.8.1) + jwt (3.2.0) base64 kramdown (2.4.0) rexml @@ -275,10 +287,11 @@ GEM rexml local_time (2.1.0) logger (1.7.0) - loofah (2.22.0) + loofah (2.25.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) - mail (2.8.1) + mail (2.9.1) + logger mini_mime (>= 0.1.1) net-imap net-pop @@ -294,11 +307,14 @@ GEM actionpack (>= 6.0.0) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.7) - minitest (5.23.1) - mission_control-jobs (0.2.1) + minitest (6.0.6) + drb (~> 2.0) + prism (~> 1.5) + minitest-mock (5.27.0) + mission_control-jobs (0.2.2) importmap-rails - rails (~> 7.1) + irb (~> 1.13) + rails (>= 7.1) stimulus-rails turbo-rails multi_xml (0.6.0) @@ -309,34 +325,34 @@ GEM nestful (1.1.4) net-http (0.4.1) uri - net-imap (0.4.12) + net-imap (0.6.6) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.2) + net-protocol (0.3.0) timeout - net-smtp (0.5.0) + net-smtp (0.5.1) net-protocol - nio4r (2.7.3) - nokogiri (1.16.5) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - nokogiri (1.16.5-aarch64-linux) + nio4r (2.7.5) + nokogiri (1.19.4-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.16.5-arm64-darwin) + nokogiri (1.19.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-darwin) + nokogiri (1.19.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.5-x86_64-linux) + nokogiri (1.19.4-x86_64-linux-gnu) racc (~> 1.4) - oauth2 (2.0.9) - faraday (>= 0.17.3, < 3.0) - jwt (>= 1.0, < 3.0) + oauth2 (2.0.25) + anonymous_loader (~> 0.1, >= 0.1.3) + auth-sanitizer (~> 0.2, >= 0.2.3) + faraday (>= 0.17.3, < 4.0) + jwt (>= 1.0, < 4.0) + logger (~> 1.2) multi_xml (~> 0.5) rack (>= 1.2, < 4) - snaky_hash (~> 2.0) - version_gem (~> 1.1) + snaky_hash (~> 2.0, >= 2.0.7) + version_gem (~> 1.1, >= 1.1.14) omniauth (2.1.2) hashie (>= 3.4.6) rack (>= 2.2.3) @@ -360,63 +376,65 @@ GEM pay (5.0.4) rails (>= 6.0.0) pg (1.5.6) - pghero (2.8.3) - activerecord (>= 5) + pghero (4.0.1) + activerecord (>= 7.2) possessive (1.0.1) - premailer (1.23.0) + pp (0.6.4) + prettyprint + premailer (1.30.0) addressable - css_parser (>= 1.12.0) + css_parser (>= 1.19.0) htmlentities (>= 4.0.0) premailer-rails (1.12.0) actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - psych (5.1.2) - stringio + prettyprint (0.2.0) + prism (1.9.0) public_suffix (5.0.5) - puma (6.4.2) + puma (7.2.1) nio4r (~> 2.0) raabro (1.4.0) - racc (1.8.0) - rack (2.2.9) - rack-protection (3.2.0) + racc (1.8.1) + rack (3.2.7) + rack-protection (4.2.1) base64 (>= 0.1.0) - rack (~> 2.2, >= 2.2.4) - rack-session (1.0.2) - rack (< 3) - rack-test (2.1.0) + logger (>= 1.6.0) + rack (>= 3.0.0, < 4) + rack-session (2.1.2) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) rack (>= 1.3) - rackup (1.0.0) - rack (< 3) - webrick - rails (7.2.3.2) - actioncable (= 7.2.3.2) - actionmailbox (= 7.2.3.2) - actionmailer (= 7.2.3.2) - actionpack (= 7.2.3.2) - actiontext (= 7.2.3.2) - actionview (= 7.2.3.2) - activejob (= 7.2.3.2) - activemodel (= 7.2.3.2) - activerecord (= 7.2.3.2) - activestorage (= 7.2.3.2) - activesupport (= 7.2.3.2) + rackup (2.3.1) + rack (>= 3) + rails (8.1.3.1) + actioncable (= 8.1.3.1) + actionmailbox (= 8.1.3.1) + actionmailer (= 8.1.3.1) + actionpack (= 8.1.3.1) + actiontext (= 8.1.3.1) + actionview (= 8.1.3.1) + activejob (= 8.1.3.1) + activemodel (= 8.1.3.1) + activerecord (= 8.1.3.1) + activestorage (= 8.1.3.1) + activesupport (= 8.1.3.1) bundler (>= 1.15.0) - railties (= 7.2.3.2) - rails-dom-testing (2.2.0) + railties (= 8.1.3.1) + rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) + rails-html-sanitizer (1.7.1) + loofah (~> 2.25, >= 2.25.2) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) rails_heroicon (2.1.2) actionview railties - railties (7.2.3.2) - actionpack (= 7.2.3.2) - activesupport (= 7.2.3.2) - cgi + railties (8.1.3.1) + actionpack (= 8.1.3.1) + activesupport (= 8.1.3.1) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) @@ -424,21 +442,27 @@ GEM tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.2.1) - rdoc (6.7.0) - psych (>= 4.0.0) + rake (13.4.2) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort + rdoc (8.0.0) + erb + prism (>= 1.6.0) + rbs (>= 4.0.0) + tsort recaptcha (5.17.0) redis (4.8.1) regexp_parser (2.9.2) - reline (0.5.8) + reline (0.7.0) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) reverse_markdown (2.1.1) nokogiri - rexml (3.2.9) - strscan + rexml (3.4.4) rubocop (1.64.1) json (~> 2.3) language_server-protocol (>= 3.17.0) @@ -459,24 +483,24 @@ GEM rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) ruby-progressbar (1.13.0) - ruby-rc4 (0.1.5) ruby-vips (2.2.1) ffi (~> 1.12) - rubyzip (2.3.2) - safely_block (0.4.0) + rubyzip (3.6.0) + safely_block (1.0.0) securerandom (0.4.1) - selenium-webdriver (4.21.1) + selenium-webdriver (4.48.0) base64 (~> 0.2) + logger (~> 1.4) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2, < 3.0) + rubyzip (>= 1.2.2, < 4.0) websocket (~> 1.0) simple_oauth (0.3.1) simpleidn (0.2.3) sitemap_generator (6.3.0) builder (~> 3.0) - snaky_hash (2.0.1) - hashie - version_gem (~> 1.1, >= 1.1.1) + snaky_hash (2.0.7) + hashie (>= 0.1.0, < 6) + version_gem (~> 1.1, >= 1.1.14) solargraph (0.44.3) backport (~> 1.2) benchmark @@ -509,25 +533,24 @@ GEM actionpack (>= 6.1) activesupport (>= 6.1) sprockets (>= 3.0.0) + ssrf_filter (1.5.0) stimulus-rails (1.2.2) railties (>= 6.0.0) - stringio (3.1.0) stripe (7.1.0) - strscan (3.1.0) - tailwindcss-rails (2.0.25) - railties (>= 6.0.0) - tailwindcss-rails (2.0.25-aarch64-linux) - railties (>= 6.0.0) - tailwindcss-rails (2.0.25-arm64-darwin) - railties (>= 6.0.0) - tailwindcss-rails (2.0.25-x86_64-darwin) - railties (>= 6.0.0) - tailwindcss-rails (2.0.25-x86_64-linux) - railties (>= 6.0.0) - thor (1.3.1) + tailwindcss-rails (2.7.9) + railties (>= 7.0.0) + tailwindcss-rails (2.7.9-aarch64-linux) + railties (>= 7.0.0) + tailwindcss-rails (2.7.9-arm64-darwin) + railties (>= 7.0.0) + tailwindcss-rails (2.7.9-x86_64-darwin) + railties (>= 7.0.0) + tailwindcss-rails (2.7.9-x86_64-linux) + railties (>= 7.0.0) + thor (1.5.0) thread_safe (0.3.6) tilt (2.3.0) - timeout (0.4.1) + timeout (0.6.1) truemail (2.7.5) simpleidn (~> 0.2.1) tsort (0.2.0) @@ -549,9 +572,9 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) - uri (0.13.0) + uri (1.1.1) useragent (0.16.11) - version_gem (1.1.4) + version_gem (1.1.15) warden (1.2.9) rack (>= 2.0.9) wcag_color_contrast (0.1.0) @@ -564,7 +587,6 @@ GEM nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) - webrick (1.8.1) websocket (1.2.10) websocket-driver (0.8.2) base64 @@ -578,13 +600,12 @@ GEM railties (>= 3.0.7) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.36) - zeitwerk (2.6.15) + yard (0.9.45) + zeitwerk (2.8.3) PLATFORMS aarch64-linux arm64-darwin - ruby x86_64-darwin-21 x86_64-linux @@ -597,14 +618,15 @@ DEPENDENCIES aws-sdk-s3 bcrypt (~> 3.1.7) blazer - brakeman (~> 5.0) + brakeman (~> 8.0, >= 8.0.6) + bundler-audit (~> 0.9) byebug capybara clearbit (~> 0.3.3) cloudflare-rails dalli (~> 3.2) debug - devise (~> 4.9) + devise (~> 5.0, >= 5.0.4) dotenv-rails (~> 2.8) faker (~> 2.19) friendly_id (~> 5.4, >= 5.4.2) @@ -612,7 +634,7 @@ DEPENDENCIES grover (~> 1.1) health_check (~> 3.1) honeypot-captcha (~> 1.0) - httparty (~> 0.21.0) + httparty (~> 0.24) image_processing (~> 1.2) importmap-rails (~> 2) inline_svg (~> 1.8) @@ -623,6 +645,7 @@ DEPENDENCIES mailkick (~> 1.0) maxminddb meta-tags (~> 2.18) + minitest-mock mission_control-jobs (~> 0.2.1) name_of_person (~> 1.1) omniauth (~> 2.1) @@ -633,8 +656,8 @@ DEPENDENCIES pghero possessive (~> 1.0) premailer-rails (~> 1.11) - puma (~> 6.4) - rails (~> 7.2.3, >= 7.2.3.2) + puma (~> 7.2, >= 7.2.1) + rails (~> 8.1.3, >= 8.1.3.1) rails_heroicon (~> 2.1.0) recaptcha redis (~> 4.0) @@ -651,7 +674,7 @@ DEPENDENCIES sprockets-rails stimulus-rails (~> 1.2.1) stripe (~> 7.0) - tailwindcss-rails (= 2.0.25) + tailwindcss-rails (~> 2.7.9) truemail (~> 2.7) turbo-rails (= 1.4.0) twitter (~> 7.0) @@ -664,7 +687,7 @@ DEPENDENCIES wicked (~> 1.4) RUBY VERSION - ruby 3.2.2p53 + ruby 3.4.10p104 BUNDLED WITH - 2.5.16 + 2.6.9 diff --git a/README.md b/README.md index 67352d4..809d1ef 100644 --- a/README.md +++ b/README.md @@ -21,22 +21,46 @@ This is the open source repository powering [postcard.page](https://postcard.pag Postcard requires the following dependencies to be installed on your system: -- **Ruby** (3.2.2) and **Rails** (7.2.3.2 or a newer 7.2 patch release) -- **PostgreSQL** +- **Ruby** (3.4.10) and **Rails** (8.1.3.1 or a newer 8.1 patch release) +- **PostgreSQL** (16 recommended; used in CI) - **libvips** (8.13 or newer; image processing library) -- **Node.js** and **npm** (for open graph image generation with Puppeteer) +- **Node.js** (24 LTS; exact version in `.node-version`) and **npm** (for Open Graph image generation with Puppeteer) ### Development quick start After installing dependencies: 1. Install Ruby gems: `bundle install` -2. Install JavaScript dependencies: `npm install puppeteer` +2. Install locked JavaScript dependencies and the matching browser: `npm ci` 3. Set up the database: `rails db:setup` 4. Start the Rails server: `./bin/dev-solo` 5. Access the application: [localtest.me:3000](http://localtest.me:3000) - (We cannot use straight localhost because of [hCaptcha constraints](https://docs.hcaptcha.com/#local-development)) +### Running checks + +Use a dedicated local PostgreSQL test database; Rails tests reset its contents. Never use a production `DATABASE_URL` for these commands. + +```sh +RAILS_ENV=test bundle exec rails db:prepare +bundle exec rails zeitwerk:check +bundle exec rails test:all +APP_MODE=MULTIUSER bundle exec rails test:all +npm test +bundle exec brakeman +bundle exec bundler-audit check --update +``` + +CI runs the Rails suite separately in SOLO and MULTIUSER modes on PostgreSQL 16. It also builds production assets, checks autoloading, renders PNGs through both Puppeteer and Grover, and boots the Docker image. The browser tests require the browser downloaded by `npm ci`; on Linux, install its system libraries with `sudo npx puppeteer browsers install chrome --install-deps`. + +Ruby versions in `.ruby-version`, `.tool-versions`, `Gemfile`, and `Dockerfile` must stay aligned. Node uses `.node-version`, `.tool-versions`, and `Dockerfile`. Container and Render builds use the committed npm lockfile. + +### Payment dependency compatibility + +Pay remains on version 5 to keep existing Stripe subscription records compatible. Its newer major versions require explicit schema and data migrations; those must be tested as a separate billing upgrade. The application backports the payment return-link fix for [CVE-2023-30614](https://github.com/pay-rails/pay/security/advisories/GHSA-cqf3-vpx7-rxhw), restricts payment return links to local paths, and enables only the Stripe processor. + +The two documented exceptions in `.bundler-audit.yml` cover that tested backport and the Paddle Billing signature advisory, whose controller was introduced after Pay 5 and is absent from this application. Mounted-route tests cover the return link and unavailable Paddle/Braintree webhooks. Review these exceptions when upgrading Pay; they do not mean the payment dependency is current. + ### Environment variables For basic solo mode development, Postcard works out of the box with minimal configuration. You can optionally create a `.env` file for any customizations. @@ -208,7 +232,7 @@ It also includes a `render.yaml` for managed hosting on [Render](https://render. ### Upgrading for CVE-2026-66066 -Deploy the updated bundle to every web and background worker process. Rails 7.2.3.2 blocks unsafe libvips loaders and savers during boot, including direct libvips calls used to generate profile icons. The Docker image uses Debian Bookworm for a compatible libvips. For native installations, including Render's Ruby runtime, verify `vips --version` reports 8.13 or newer before deploying; patched Rails refuses to boot with an older libvips. The `ruby-vips` gem must be at least 2.2.1. +Deploy the updated bundle to every web and background worker process. Rails 8.1.3.1 includes the fix that blocks unsafe libvips loaders and savers during boot, including direct libvips calls used to generate profile icons. The Docker image uses Debian Bookworm for a compatible libvips. For native installations, including Render's Ruby runtime, verify `vips --version` reports 8.13 or newer before deploying; patched Rails refuses to boot with an older libvips. The `ruby-vips` gem must be at least 2.2.1. Untrusted formats such as SVG, BMP, ICO, and PSD are no longer processed by libvips. Do not re-enable blocked loaders to restore support for those formats. Normal JPEG and PNG image processing remains supported. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 231aac2..aac3dce 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -89,19 +89,4 @@ def suppress_if_banned render file: 'public/403.html', status: :forbidden, layout: :default if @account&.locked_at.present? end - # Add somewhere appropriate in your application - Grover.configure do |config| - config.options = { - 'args' => [ - '--no-sandbox', - '--disable-setuid-sandbox', - '--disable-dev-shm-usage', - '--disable-accelerated-2d-canvas', - '--no-first-run', - '--no-zygote', - '--single-process', - '--disable-gpu' - ] - } - end end diff --git a/app/models/account.rb b/app/models/account.rb index 6224bf2..e369657 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -11,7 +11,7 @@ class Account < ApplicationRecord visitable :ahoy_signup_visit - enum source: { signup: 0 }, _prefix: true, _default: :signup + enum :source, { signup: 0 }, prefix: true, default: :signup has_many :visits, class_name: 'Ahoy::Visit', foreign_key: :user_id, dependent: :destroy, inverse_of: :account has_many :subscriptions, dependent: :destroy diff --git a/app/models/post.rb b/app/models/post.rb index d85e349..e3480ea 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -28,7 +28,7 @@ class Post < ApplicationRecord before_destroy :remove_pinned_by after_save :remove_pinned_by, if: proc { archived? or visibility_hidden? } - enum visibility: { public: 0, unlisted: 1, hidden: 2 }, _prefix: true, _default: :public + enum :visibility, { public: 0, unlisted: 1, hidden: 2 }, prefix: true, default: :public def published? published_at.present? diff --git a/app/models/subscription.rb b/app/models/subscription.rb index 220ae28..5553490 100644 --- a/app/models/subscription.rb +++ b/app/models/subscription.rb @@ -12,7 +12,7 @@ class Subscription < ApplicationRecord attr_accessor :verification_token - enum source: { signup: 0, invite: 1, import: 2 }, _prefix: true + enum :source, { signup: 0, invite: 1, import: 2 }, prefix: true validates :source, presence: true def active? diff --git a/bin/render-build.sh b/bin/render-build.sh index 91e62d3..d6654b5 100755 --- a/bin/render-build.sh +++ b/bin/render-build.sh @@ -9,6 +9,4 @@ bundle exec rake assets:clean #bundle exec rake db:migrate bundle exec rake sitemap:refresh:no_ping -npm install - -curl -g "https://api.honeybadger.io/v1/deploys?deploy[environment]=production&api_key=hbp_80nHltnYxlL3kfchmAYlpDRZqs60Ks0xc1WC" \ No newline at end of file +npm ci diff --git a/config/initializers/grover.rb b/config/initializers/grover.rb index 2f33450..af44a1e 100644 --- a/config/initializers/grover.rb +++ b/config/initializers/grover.rb @@ -5,6 +5,16 @@ viewport: { width: 1128, height: 600 - } + }, + args: [ + '--no-sandbox', + '--disable-setuid-sandbox', + '--disable-dev-shm-usage', + '--disable-accelerated-2d-canvas', + '--no-first-run', + '--no-zygote', + '--single-process', + '--disable-gpu' + ] } end diff --git a/config/initializers/pay.rb b/config/initializers/pay.rb index 3f838ef..dee1c2d 100644 --- a/config/initializers/pay.rb +++ b/config/initializers/pay.rb @@ -13,6 +13,8 @@ def secrets end Pay.setup do |config| + config.enabled_processors = [:stripe] + # For use in the receipt/refund/renewal mailers config.business_name = 'Contraption Co. LLC' config.business_address = '169 Madison Ave #2174, New York, NY 10016' @@ -29,3 +31,32 @@ def secrets config.emails.refund = false config.emails.subscription_renewing = false end + +# Backport CVE-2023-30614 without changing the Pay 5 billing schema. +# Remove this when upgrading Pay to a release with the upstream fix: +# https://github.com/pay-rails/pay/commit/5d6283a24062bd272a524ec48415f536a67ad57f +module PostcardPayPaymentRedirect + def show + params[:back] = safe_payment_return_path(params[:back]) + super + end + + private + + def safe_payment_return_path(value) + return '/' unless value.is_a?(String) + return '/' if value.match?(/[\\\x00-\x20\x7f]/) + + uri = URI.parse(value) + return '/' if uri.scheme || uri.host + return '/' unless value.start_with?('/') && !value.start_with?('//') + + value + rescue URI::InvalidURIError + '/' + end +end + +Rails.application.config.to_prepare do + Pay::PaymentsController.prepend(PostcardPayPaymentRedirect) +end diff --git a/config/tailwind.config.js b/config/tailwind.config.js index 6075e34..e6e30d3 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -103,6 +103,5 @@ module.exports = { require("@tailwindcss/forms"), require("@tailwindcss/aspect-ratio"), require("@tailwindcss/typography"), - require("@tailwindcss/line-clamp"), ], }; diff --git a/package-lock.json b/package-lock.json index 8e4c3fd..0109549 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,459 +9,124 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "puppeteer": "^22.10.0" - }, - "devDependencies": {} - }, - "node_modules/@babel/code-frame": { - "version": "7.28.6", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.28.6.tgz", - "integrity": "sha512-JYgintcMjRiCvS8mMECzaEn+m3PfoQiyqukOMCCVQtoJGYJw8j/8LBJEiqkHLkfwCcs74E3pbAUFNg7d9VNJ+Q==", - "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" + "puppeteer": "^25.10.0" }, + "devDependencies": {}, "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", - "license": "MIT", - "engines": { - "node": ">=6.9.0" + "node": "24.x" } }, "node_modules/@puppeteer/browsers": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.0.tgz", - "integrity": "sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-3.2.2.tgz", + "integrity": "sha512-q2BU4YfO9h/Wt7IcWPcggpOOqLk2Tbs1hDwolvKZrweRjy751OJBKMN9zO5bfD0pzU7X/tvKw/exQds4pM/LOg==", "license": "Apache-2.0", "dependencies": { - "debug": "^4.3.5", - "extract-zip": "^2.0.1", - "progress": "^2.0.3", - "proxy-agent": "^6.4.0", - "semver": "^7.6.3", - "tar-fs": "^3.0.6", - "unbzip2-stream": "^1.4.3", - "yargs": "^17.7.2" + "modern-tar": "^0.8.4", + "yargs": "^18.0.0" }, "bin": { - "browsers": "lib/cjs/main-cli.js" + "browsers": "lib/main-cli.js" }, "engines": { - "node": ">=18" - } - }, - "node_modules/@tootallnate/quickjs-emscripten": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", - "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "25.0.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.10.tgz", - "integrity": "sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==", - "license": "MIT", - "optional": true, - "dependencies": { - "undici-types": "~7.16.0" - } - }, - "node_modules/@types/yauzl": { - "version": "2.10.3", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", - "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", - "license": "MIT", - "optional": true, - "dependencies": { - "@types/node": "*" - } - }, - "node_modules/agent-base": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", - "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", - "license": "MIT", - "engines": { - "node": ">= 14" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" + "node": ">=22.12.0" }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "license": "Python-2.0" - }, - "node_modules/ast-types": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz", - "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", - "license": "MIT", - "dependencies": { - "tslib": "^2.0.1" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/b4a": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", - "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", - "license": "Apache-2.0", "peerDependencies": { - "react-native-b4a": "*" + "proxy-agent": ">=8.0.1", + "yauzl": "^2.10.0 || ^3.4.0" }, "peerDependenciesMeta": { - "react-native-b4a": { - "optional": true - } - } - }, - "node_modules/bare-events": { - "version": "2.8.2", - "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz", - "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", - "license": "Apache-2.0", - "peerDependencies": { - "bare-abort-controller": "*" - }, - "peerDependenciesMeta": { - "bare-abort-controller": { - "optional": true - } - } - }, - "node_modules/bare-fs": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.5.3.tgz", - "integrity": "sha512-9+kwVx8QYvt3hPWnmb19tPnh38c6Nihz8Lx3t0g9+4GoIf3/fTgYwM4Z6NxgI+B9elLQA7mLE9PpqcWtOMRDiQ==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "bare-events": "^2.5.4", - "bare-path": "^3.0.0", - "bare-stream": "^2.6.4", - "bare-url": "^2.2.2", - "fast-fifo": "^1.3.2" - }, - "engines": { - "bare": ">=1.16.0" - }, - "peerDependencies": { - "bare-buffer": "*" - }, - "peerDependenciesMeta": { - "bare-buffer": { - "optional": true - } - } - }, - "node_modules/bare-os": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.6.2.tgz", - "integrity": "sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A==", - "license": "Apache-2.0", - "optional": true, - "engines": { - "bare": ">=1.14.0" - } - }, - "node_modules/bare-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz", - "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "bare-os": "^3.0.1" - } - }, - "node_modules/bare-stream": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.7.0.tgz", - "integrity": "sha512-oyXQNicV1y8nc2aKffH+BUHFRXmx6VrPzlnaEvMhram0nPBrKcEdcyBg5r08D0i8VxngHFAiVyn1QKXpSG0B8A==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "streamx": "^2.21.0" - }, - "peerDependencies": { - "bare-buffer": "*", - "bare-events": "*" - }, - "peerDependenciesMeta": { - "bare-buffer": { + "proxy-agent": { "optional": true }, - "bare-events": { + "yauzl": { "optional": true } } }, - "node_modules/bare-url": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.3.2.tgz", - "integrity": "sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw==", - "license": "Apache-2.0", - "optional": true, - "dependencies": { - "bare-path": "^3.0.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/basic-ftp": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.1.0.tgz", - "integrity": "sha512-RkaJzeJKDbaDWTIPiJwubyljaEPwpVWkm9Rt5h9Nd6h7tEXTJ3VB4qxdZBioV7JO5yLUaOKwz7vDOzlncUsegw==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "node_modules/ansi-regex": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.3.0.tgz", + "integrity": "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ==", "license": "MIT", "engines": { - "node": "*" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", "license": "MIT", "engines": { - "node": ">=6" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/chromium-bidi": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.3.tgz", - "integrity": "sha512-qXlsCmpCZJAnoTYI83Iu6EdYQpMYdVkCfq08KDh2pmlVqK5t5IA9mGs4/LwCwp4fqisSOMXZxP3HIh8w8aRn0A==", + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-17.0.2.tgz", + "integrity": "sha512-5v9GQFhTktFvotn/OFNJBmKLKRAb6n9r0bVCwf7sHgWc3/JryK0bj1nn93L3pHFrfgcsu6Be6EWsDi+1XHTGDg==", "license": "Apache-2.0", "dependencies": { - "mitt": "3.0.1", - "urlpattern-polyfill": "10.0.0", - "zod": "3.23.8" + "mitt": "^3.0.1", + "zod": "^3.24.1" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0" }, "peerDependencies": { "devtools-protocol": "*" } }, "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", "license": "ISC", "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" }, "engines": { - "node": ">=7.0.0" + "node": ">=20" } }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "license": "MIT" - }, - "node_modules/cosmiconfig": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz", - "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", + "node_modules/cliui/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", "license": "MIT", "dependencies": { - "env-paths": "^2.2.1", - "import-fresh": "^3.3.0", - "js-yaml": "^4.1.0", - "parse-json": "^5.2.0" + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=14" + "node": ">=18" }, "funding": { - "url": "https://github.com/sponsors/d-fischer" - }, - "peerDependencies": { - "typescript": ">=4.9.5" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/data-uri-to-buffer": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", - "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", - "license": "MIT", - "engines": { - "node": ">= 14" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/degenerator": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", - "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", - "license": "MIT", - "dependencies": { - "ast-types": "^0.13.4", - "escodegen": "^2.1.0", - "esprima": "^4.0.1" - }, - "engines": { - "node": ">= 14" + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/devtools-protocol": { - "version": "0.0.1312386", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", - "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", + "version": "0.0.1666840", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1666840.tgz", + "integrity": "sha512-gCcO42XCHKEs7Ag0S7aGYsnJ7hlgrO3qderYqeiY0Eqk+0GFfuvT13IA0hHreJTa2KCdDVyGMeOhdMNmrrTjVg==", "license": "BSD-3-Clause" }, "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", "license": "MIT" }, - "node_modules/end-of-stream": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", - "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", - "license": "MIT", - "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/env-paths": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", - "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/error-ex": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz", - "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==", - "license": "MIT", - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -471,102 +136,6 @@ "node": ">=6" } }, - "node_modules/escodegen": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz", - "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", - "license": "BSD-2-Clause", - "dependencies": { - "esprima": "^4.0.1", - "estraverse": "^5.2.0", - "esutils": "^2.0.2" - }, - "bin": { - "escodegen": "bin/escodegen.js", - "esgenerate": "bin/esgenerate.js" - }, - "engines": { - "node": ">=6.0" - }, - "optionalDependencies": { - "source-map": "~0.6.1" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "license": "BSD-2-Clause", - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esutils": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", - "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/events-universal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", - "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", - "license": "Apache-2.0", - "dependencies": { - "bare-events": "^2.7.0" - } - }, - "node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "license": "BSD-2-Clause", - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/fast-fifo": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", - "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "license": "MIT" - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", - "license": "MIT", - "dependencies": { - "pend": "~1.2.0" - } - }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -576,158 +145,28 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "node_modules/get-east-asian-width": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz", + "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==", "license": "MIT", - "dependencies": { - "pump": "^3.0.0" - }, "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/get-uri": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz", - "integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==", - "license": "MIT", - "dependencies": { - "basic-ftp": "^5.0.2", - "data-uri-to-buffer": "^6.0.2", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/http-proxy-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", - "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.0", - "debug": "^4.3.4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/https-proxy-agent": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", - "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.2", - "debug": "4" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "BSD-3-Clause" - }, - "node_modules/import-fresh": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", - "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", "license": "MIT", - "dependencies": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, "engines": { - "node": ">=6" + "node": ">=14" }, "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ip-address": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", - "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "license": "MIT" - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "license": "MIT" - }, - "node_modules/js-yaml": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", - "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "license": "MIT" - }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "license": "MIT" - }, - "node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "license": "ISC", - "engines": { - "node": ">=12" + "url": "https://github.com/sponsors/antonk52" } }, "node_modules/mitt": { @@ -736,395 +175,134 @@ "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", "license": "MIT" }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "license": "MIT" - }, - "node_modules/netmask": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", - "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", - "license": "MIT", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "license": "ISC", - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/pac-proxy-agent": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", - "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", - "license": "MIT", - "dependencies": { - "@tootallnate/quickjs-emscripten": "^0.23.0", - "agent-base": "^7.1.2", - "debug": "^4.3.4", - "get-uri": "^6.0.1", - "http-proxy-agent": "^7.0.0", - "https-proxy-agent": "^7.0.6", - "pac-resolver": "^7.0.1", - "socks-proxy-agent": "^8.0.5" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/pac-resolver": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz", - "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", - "license": "MIT", - "dependencies": { - "degenerator": "^5.0.0", - "netmask": "^2.0.2" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "license": "MIT", - "dependencies": { - "callsites": "^3.0.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "license": "MIT" - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "license": "ISC" - }, - "node_modules/progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "node_modules/modern-tar": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/modern-tar/-/modern-tar-0.8.4.tgz", + "integrity": "sha512-gN54ddmyzEg10orwZ2u4OOv+bjpMWdIl5jIkodK97bMq8QBSL5c0D7YX0lT1Ooz+99S7+PvFbnxzdjgHo1r41g==", "license": "MIT", "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/proxy-agent": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz", - "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.2", - "debug": "^4.3.4", - "http-proxy-agent": "^7.0.1", - "https-proxy-agent": "^7.0.6", - "lru-cache": "^7.14.1", - "pac-proxy-agent": "^7.1.0", - "proxy-from-env": "^1.1.0", - "socks-proxy-agent": "^8.0.5" - }, - "engines": { - "node": ">= 14" - } - }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT" - }, - "node_modules/pump": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", - "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", - "license": "MIT", - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" + "node": ">=18.0.0" } }, "node_modules/puppeteer": { - "version": "22.15.0", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.15.0.tgz", - "integrity": "sha512-XjCY1SiSEi1T7iSYuxS82ft85kwDJUS7wj1Z0eGVXKdtr5g4xnVcbjwxhq5xBnpK/E7x1VZZoJDxpjAOasHT4Q==", - "deprecated": "< 24.15.0 is no longer supported", + "version": "25.10.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-25.10.0.tgz", + "integrity": "sha512-9ZfkiaZDQWpGPJp9XTS+Bkn/D78hPvYmtjPfIBeybn05oeY6Jj7aiSbYdfcSQD2UMvC0vE7Yi9PSDo179euRzw==", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.3.0", - "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1312386", - "puppeteer-core": "22.15.0" + "@puppeteer/browsers": "3.2.2", + "chromium-bidi": "17.0.2", + "devtools-protocol": "0.0.1666840", + "lilconfig": "^3.1.3", + "puppeteer-core": "25.10.0", + "typed-query-selector": "^2.12.2" }, "bin": { - "puppeteer": "lib/esm/puppeteer/node/cli.js" + "puppeteer": "lib/puppeteer/node/cli.js" }, "engines": { - "node": ">=18" + "node": ">=22.12.0" } }, "node_modules/puppeteer-core": { - "version": "22.15.0", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.15.0.tgz", - "integrity": "sha512-cHArnywCiAAVXa3t4GGL2vttNxh7GqXtIYGym99egkNJ3oG//wL9LkvO4WE8W1TJe95t1F1ocu9X4xWaGsOKOA==", + "version": "25.10.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-25.10.0.tgz", + "integrity": "sha512-Hy5eMQshOEMil4JUUx03h5pw1HYkYCso1RG/gcpPlFSd4cYPOcopxcXEAxpLPOkOPJb9LIJtwxuj66bSdvknFg==", "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.3.0", - "chromium-bidi": "0.6.3", - "debug": "^4.3.6", - "devtools-protocol": "0.0.1312386", - "ws": "^8.18.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "license": "MIT", - "engines": { - "node": ">=4" - } - }, - "node_modules/semver": { - "version": "7.7.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", - "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/smart-buffer": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", - "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "license": "MIT", - "engines": { - "node": ">= 6.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks": { - "version": "2.8.7", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", - "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", - "license": "MIT", - "dependencies": { - "ip-address": "^10.0.1", - "smart-buffer": "^4.2.0" - }, - "engines": { - "node": ">= 10.0.0", - "npm": ">= 3.0.0" - } - }, - "node_modules/socks-proxy-agent": { - "version": "8.0.5", - "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", - "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", - "license": "MIT", - "dependencies": { - "agent-base": "^7.1.2", - "debug": "^4.3.4", - "socks": "^2.8.3" + "@puppeteer/browsers": "3.2.2", + "chromium-bidi": "17.0.2", + "devtools-protocol": "0.0.1666840", + "typed-query-selector": "^2.12.2", + "webdriver-bidi-protocol": "0.4.3", + "ws": "^8.21.3" }, "engines": { - "node": ">= 14" - } - }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "license": "BSD-3-Clause", - "optional": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/streamx": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", - "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", - "license": "MIT", - "dependencies": { - "events-universal": "^1.0.0", - "fast-fifo": "^1.3.2", - "text-decoder": "^1.1.0" + "node": ">=22.12.0" } }, "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz", + "integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==", "license": "MIT", "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" + "get-east-asian-width": "^1.5.0", + "strip-ansi": "^7.1.2" }, "engines": { - "node": ">=8" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz", + "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==", "license": "MIT", "dependencies": { - "ansi-regex": "^5.0.1" + "ansi-regex": "^6.2.2" }, "engines": { - "node": ">=8" - } - }, - "node_modules/tar-fs": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz", - "integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==", - "license": "MIT", - "dependencies": { - "pump": "^3.0.0", - "tar-stream": "^3.1.5" + "node": ">=12" }, - "optionalDependencies": { - "bare-fs": "^4.0.1", - "bare-path": "^3.0.0" - } - }, - "node_modules/tar-stream": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", - "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", - "license": "MIT", - "dependencies": { - "b4a": "^1.6.4", - "fast-fifo": "^1.2.0", - "streamx": "^2.15.0" - } - }, - "node_modules/text-decoder": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", - "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", - "license": "Apache-2.0", - "dependencies": { - "b4a": "^1.6.4" + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", + "node_modules/typed-query-selector": { + "version": "2.12.2", + "resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.2.tgz", + "integrity": "sha512-EOPFbyIub4ngnEdqi2yOcNeDLaX/0jcE1JoAXQDDMIthap7FoN795lc/SHfIq2d416VufXpM8z/lD+WRm2gfOQ==", "license": "MIT" }, - "node_modules/tslib": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", - "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" + "node_modules/webdriver-bidi-protocol": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.3.tgz", + "integrity": "sha512-uuN0goWfxP22B7J/uAgBpOYNPttC+XVseYE+rSY5+rQ+YBeVz/VORw8WbmLVcqW78zNg5A4qnjNXYUWR3il2ig==", + "license": "Apache-2.0" }, - "node_modules/unbzip2-stream": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", - "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", + "node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", "license": "MIT", "dependencies": { - "buffer": "^5.2.1", - "through": "^2.3.8" + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/undici-types": { - "version": "7.16.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", - "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", - "license": "MIT", - "optional": true - }, - "node_modules/urlpattern-polyfill": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.0.0.tgz", - "integrity": "sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==", - "license": "MIT" - }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", "license": "MIT", "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" - }, "node_modules/ws": { - "version": "8.19.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", - "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", + "version": "8.21.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz", + "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -1152,46 +330,35 @@ } }, "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "version": "18.1.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.1.0.tgz", + "integrity": "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==", "license": "MIT", "dependencies": { - "cliui": "^8.0.1", + "cliui": "^9.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", + "string-width": "^8.2.1", "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" + "yargs-parser": "^22.0.0" }, "engines": { - "node": ">=12" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "license": "ISC", "engines": { - "node": ">=12" - } - }, - "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", - "license": "MIT", - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, "node_modules/zod": { - "version": "3.23.8", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index d07c2df..3da50c8 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "test": "test" }, "dependencies": { - "puppeteer": "^22.10.0" + "puppeteer": "^25.10.0" }, "devDependencies": {}, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "node --test test/javascript/*.test.cjs" }, "repository": { "type": "git", @@ -23,5 +23,8 @@ "bugs": { "url": "https://github.com/contraptionco/postcard/issues" }, - "homepage": "https://github.com/contraptionco/postcard#readme" + "homepage": "https://github.com/contraptionco/postcard#readme", + "engines": { + "node": "24.x" + } } diff --git a/render.yaml b/render.yaml index e5fa747..bd32059 100644 --- a/render.yaml +++ b/render.yaml @@ -16,7 +16,7 @@ services: name: postcard env: ruby plan: standard - buildCommand: "bundle install && npm install puppeteer && bundle exec rails assets:precompile && bundle exec rails db:migrate" + buildCommand: "bundle install && npm ci && bundle exec rails assets:precompile && bundle exec rails db:migrate" startCommand: "bundle exec puma -C config/puma.rb" numInstances: 1 envVars: diff --git a/test/config/grover_runtime_test.rb b/test/config/grover_runtime_test.rb new file mode 100644 index 0000000..2fd33cc --- /dev/null +++ b/test/config/grover_runtime_test.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +require 'test_helper' + +class GroverRuntimeTest < ActiveSupport::TestCase + test 'Ruby renders an Open Graph image using the locked Node browser' do + png = Grover.new('

Postcard

').to_png + + assert_equal "\x89PNG\r\n\x1a\n".b, png.byteslice(0, 8) + assert_equal [1128, 600], png.byteslice(16, 8).unpack('NN') + end +end diff --git a/test/controllers/pay_payment_redirect_test.rb b/test/controllers/pay_payment_redirect_test.rb new file mode 100644 index 0000000..324c474 --- /dev/null +++ b/test/controllers/pay_payment_redirect_test.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +require 'test_helper' +require 'minitest/mock' + +class PayPaymentRedirectTest < ActionDispatch::IntegrationTest + Payment = Struct.new(:client_secret, :status, :customer) do + def succeeded? + true + end + end + + setup do + host! Rails.configuration.base_host + @payment = Payment.new('test-secret', 'succeeded', 'test-customer') + end + + [ + 'javascript:alert(document.domain)', + 'data:text/html,', + 'https://example.com/phishing', + '//example.com/phishing', + '/\\example.com/phishing', + "/\n/example.com/phishing", + '%invalid', + nil + ].each do |unsafe_back| + test "payment page rejects unsafe return path #{unsafe_back.inspect}" do + Pay::Payment.stub(:from_id, @payment) do + get '/pay/payments/pi_test', params: { back: unsafe_back } + end + + assert_response :success + assert_select 'a', text: I18n.t('pay.back'), count: 1 do |links| + assert_equal '/', links.first['href'] + end + end + end + + test 'payment page preserves a local return path and query' do + Pay::Payment.stub(:from_id, @payment) do + get '/pay/payments/pi_test', params: { back: '/pages/test-user?tab=billing' } + end + + assert_response :success + assert_select 'a[href="/pages/test-user?tab=billing"]', text: I18n.t('pay.back') + end + + test 'only Stripe webhook routes are exposed' do + assert_equal [:stripe], Pay.enabled_processors + stripe_route = Pay::Engine.routes.recognize_path('/webhooks/stripe', method: :post) + assert_equal 'pay/webhooks/stripe', stripe_route[:controller] + + %w[paddle paddle_billing braintree].each do |processor| + assert_raises(ActionController::RoutingError) do + post "/pay/webhooks/#{processor}" + end + end + end +end diff --git a/test/javascript/browser_runtime.test.cjs b/test/javascript/browser_runtime.test.cjs new file mode 100644 index 0000000..bef606b --- /dev/null +++ b/test/javascript/browser_runtime.test.cjs @@ -0,0 +1,24 @@ +const assert = require('node:assert/strict'); +const test = require('node:test'); +const puppeteer = require('puppeteer'); + +test('the installed browser renders an Open Graph-sized PNG', async () => { + const browser = await puppeteer.launch({ + headless: true, + args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox'] : [], + }); + + try { + const page = await browser.newPage(); + await page.setViewport({ width: 1128, height: 600 }); + await page.setContent('

Postcard

'); + const png = Buffer.from(await page.screenshot({ type: 'png' })); + + assert.equal(await page.$eval('h1', (heading) => heading.textContent), 'Postcard'); + assert.deepEqual(png.subarray(0, 8), Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])); + assert.equal(png.readUInt32BE(16), 1128); + assert.equal(png.readUInt32BE(20), 600); + } finally { + await browser.close(); + } +}); From 10df3cc532ec4b590c6f357f3fa29d212e6e4a6f Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:31:59 -0600 Subject: [PATCH 2/7] Use Ruby 3.4-compatible ffi binaries on Linux --- Gemfile.lock | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86ea341..dc8d64f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -203,11 +203,10 @@ GEM logger faraday-net_http (3.1.0) net-http - ffi (1.17.0) - ffi (1.17.0-aarch64-linux-gnu) - ffi (1.17.0-arm64-darwin) - ffi (1.17.0-x86_64-darwin) - ffi (1.17.0-x86_64-linux-gnu) + ffi (1.17.4-aarch64-linux-gnu) + ffi (1.17.4-arm64-darwin) + ffi (1.17.4-x86_64-darwin) + ffi (1.17.4-x86_64-linux-gnu) ffi-compiler (1.3.2) ffi (>= 1.15.5) rake From a881b4e8c0cae1a87da2262cb46a9f091fab89e4 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:32:25 -0600 Subject: [PATCH 3/7] Avoid duplicate CI runs for pull request branch pushes --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b9c985..662cf0a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,8 @@ name: Tests -on: [push, pull_request] +on: + push: + branches: [main] + pull_request: permissions: contents: read From aacbe58f1179b26e58376edb6f9c6ab7520d6089 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:38:43 -0600 Subject: [PATCH 4/7] Install the approved browser and preserve solo homepage rendering --- .github/workflows/test.yml | 3 ++- Dockerfile | 1 + README.md | 2 +- app/controllers/marketing_pages_controller.rb | 2 +- package.json | 3 +++ test/controllers/homepage_runtime_test.rb | 21 +++++++++++++++++++ 6 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 test/controllers/homepage_runtime_test.rb diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 662cf0a..056c7fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,6 +38,7 @@ jobs: DISABLE_ANONYMOUS_TELEMETRY: 'true' AWS_EC2_METADATA_DISABLED: 'true' GROVER_NO_SANDBOX: 'true' + PUPPETEER_CHROME_HEADLESS_SHELL_SKIP_DOWNLOAD: 'true' steps: - uses: actions/checkout@v7 - name: Install native dependencies @@ -56,7 +57,7 @@ jobs: - name: Install JavaScript dependencies run: npm ci - name: Install browser libraries - run: sudo npx puppeteer browsers install chrome --install-deps + run: sudo env "PUPPETEER_CACHE_DIR=$HOME/.cache/puppeteer" npx puppeteer browsers install chrome --install-deps - name: Prepare database and assets run: | bundle exec rails db:create db:migrate diff --git a/Dockerfile b/Dockerfile index aeb3ac0..0e4fc19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ ENV RAILS_ENV="production" \ RAILS_SERVE_STATIC_FILES="true" \ RAILS_LOG_TO_STDOUT="1" \ GROVER_NO_SANDBOX="true" \ + PUPPETEER_CHROME_HEADLESS_SHELL_SKIP_DOWNLOAD="true" \ PUPPETEER_CACHE_DIR="/rails/.cache/puppeteer" # Node's official binary avoids compiling Node during every image build. diff --git a/README.md b/README.md index 809d1ef..52fe626 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ bundle exec bundler-audit check --update CI runs the Rails suite separately in SOLO and MULTIUSER modes on PostgreSQL 16. It also builds production assets, checks autoloading, renders PNGs through both Puppeteer and Grover, and boots the Docker image. The browser tests require the browser downloaded by `npm ci`; on Linux, install its system libraries with `sudo npx puppeteer browsers install chrome --install-deps`. -Ruby versions in `.ruby-version`, `.tool-versions`, `Gemfile`, and `Dockerfile` must stay aligned. Node uses `.node-version`, `.tool-versions`, and `Dockerfile`. Container and Render builds use the committed npm lockfile. +Ruby versions in `.ruby-version`, `.tool-versions`, `Gemfile`, and `Dockerfile` must stay aligned. Node uses `.node-version`, `.tool-versions`, and `Dockerfile`. Container and Render builds use the committed npm lockfile. The reviewed Puppeteer install script is approved for its exact version in `package.json`; review and refresh that entry when updating Puppeteer. ### Payment dependency compatibility diff --git a/app/controllers/marketing_pages_controller.rb b/app/controllers/marketing_pages_controller.rb index 1820e08..64fd595 100644 --- a/app/controllers/marketing_pages_controller.rb +++ b/app/controllers/marketing_pages_controller.rb @@ -34,6 +34,7 @@ class MarketingPagesController < ApplicationController ].freeze def homepage + @email_address = EmailAddress.new if Rails.configuration.solo_mode return redirect_to new_account_registration_path if Account.count.zero? @@ -41,7 +42,6 @@ def homepage return render 'public_pages/show' end - @email_address = EmailAddress.new redirect_to page_path(current_account.slug) if current_account end diff --git a/package.json b/package.json index 3da50c8..1cbc0fb 100644 --- a/package.json +++ b/package.json @@ -26,5 +26,8 @@ "homepage": "https://github.com/contraptionco/postcard#readme", "engines": { "node": "24.x" + }, + "allowScripts": { + "puppeteer@25.10.0": true } } diff --git a/test/controllers/homepage_runtime_test.rb b/test/controllers/homepage_runtime_test.rb new file mode 100644 index 0000000..b579573 --- /dev/null +++ b/test/controllers/homepage_runtime_test.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'test_helper' + +class HomepageRuntimeTest < ActionDispatch::IntegrationTest + test 'an existing solo account renders a working subscription form' do + original_solo_mode = Rails.configuration.solo_mode + original_multiuser_mode = Rails.configuration.multiuser_mode + Rails.configuration.solo_mode = true + Rails.configuration.multiuser_mode = false + host! Rails.configuration.base_host + + get '/' + + assert_response :success + assert_select 'input[name="email_address[email]"]' + ensure + Rails.configuration.solo_mode = original_solo_mode + Rails.configuration.multiuser_mode = original_multiuser_mode + end +end From e621aaa08eee0a5d8e75e9a86c1488e05cff38b5 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:46:45 -0600 Subject: [PATCH 5/7] Exercise production container startup and address runtime review --- .github/workflows/test.yml | 38 +++++++++++++++++++--- Dockerfile | 5 ++- Gemfile.lock | 6 ++++ README.md | 4 +-- app/controllers/public_pages_controller.rb | 2 +- app/controllers/public_posts_controller.rb | 2 +- 6 files changed, 47 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 056c7fa..d6df1bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,14 +76,42 @@ jobs: docker-smoke-test: runs-on: ubuntu-24.04 timeout-minutes: 30 + services: + postgres: + image: postgres:16 + env: + POSTGRES_DB: postcard_smoke + POSTGRES_PASSWORD: postgres + ports: ['5432:5432'] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - uses: actions/checkout@v7 - name: Build Docker image run: docker build -t postcard:test . - - name: Verify Rails boots without deployment credentials - run: >- - docker run --rm --entrypoint bundle - -e RAILS_ENV=build -e SECRET_KEY_BASE=DUMMY postcard:test - exec rails runner 'puts Rails.version' + - name: Verify default production startup with disposable services + run: | + docker run --detach --name postcard-smoke --network host \ + -e DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/postcard_smoke \ + -e APP_MODE=SOLO -e BASE_HOST=localtest.me \ + -e SECRET_KEY_BASE=ci-only-secret-key-base \ + -e AWS_ACCESS_KEY_ID=ci-only -e AWS_SECRET_ACCESS_KEY=ci-only \ + -e AWS_REGION=us-east-1 -e AWS_STORAGE_BUCKET=postcard-ci \ + -e AWS_EC2_METADATA_DISABLED=true -e DISABLE_ANONYMOUS_TELEMETRY=true \ + postcard:test + curl --fail --silent --show-error --retry 30 --retry-delay 2 \ + --retry-connrefused --max-time 10 \ + -H 'X-Forwarded-Proto: https' http://127.0.0.1:3000/.postcard \ + | tee /tmp/postcard-smoke-response + test "$(cat /tmp/postcard-smoke-response)" = postcard + docker exec postcard-smoke test -s /rails/tmp/pids/server.pid - name: Verify the image includes a working browser run: docker run --rm --entrypoint npm postcard:test test + - name: Collect production logs and stop the smoke container + if: always() + run: | + docker logs postcard-smoke || true + docker rm -f postcard-smoke || true diff --git a/Dockerfile b/Dockerfile index 0e4fc19..b0df61c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,7 +45,9 @@ RUN bundle install && \ rm -rf /usr/local/bundle/cache /usr/local/bundle/ruby/*/cache COPY --link package.json package-lock.json ./ -RUN npm ci --omit=dev && npm cache clean --force +RUN npm ci --omit=dev && \ + npx puppeteer browsers install chrome && \ + npm cache clean --force COPY --link . . RUN SECRET_KEY_BASE=DUMMY RAILS_ENV=build ./bin/rails assets:precompile @@ -55,6 +57,7 @@ COPY --from=build /usr/local/bundle /usr/local/bundle COPY --from=build /rails /rails RUN useradd rails --create-home --shell /bin/bash && \ + mkdir -p /rails/tmp/pids && \ chown -R rails:rails /rails USER rails:rails diff --git a/Gemfile.lock b/Gemfile.lock index dc8d64f..541d5ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -203,6 +203,7 @@ GEM logger faraday-net_http (3.1.0) net-http + ffi (1.17.4) ffi (1.17.4-aarch64-linux-gnu) ffi (1.17.4-arm64-darwin) ffi (1.17.4-x86_64-darwin) @@ -306,6 +307,7 @@ GEM actionpack (>= 6.0.0) mini_magick (4.12.0) mini_mime (1.1.5) + mini_portile2 (2.8.9) minitest (6.0.6) drb (~> 2.0) prism (~> 1.5) @@ -334,6 +336,9 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.5) + nokogiri (1.19.4) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) nokogiri (1.19.4-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.19.4-arm64-darwin) @@ -605,6 +610,7 @@ GEM PLATFORMS aarch64-linux arm64-darwin + ruby x86_64-darwin-21 x86_64-linux diff --git a/README.md b/README.md index 52fe626..86a0c58 100644 --- a/README.md +++ b/README.md @@ -51,13 +51,13 @@ bundle exec brakeman bundle exec bundler-audit check --update ``` -CI runs the Rails suite separately in SOLO and MULTIUSER modes on PostgreSQL 16. It also builds production assets, checks autoloading, renders PNGs through both Puppeteer and Grover, and boots the Docker image. The browser tests require the browser downloaded by `npm ci`; on Linux, install its system libraries with `sudo npx puppeteer browsers install chrome --install-deps`. +CI runs the Rails suite separately in SOLO and MULTIUSER modes on PostgreSQL 16. It also builds production assets, checks autoloading, and renders PNGs through both Puppeteer and Grover. The Docker check runs the default production entrypoint against disposable PostgreSQL with dummy service credentials, requests the health endpoint, and verifies Puma's PID file. The browser tests require the browser downloaded by `npm ci`; on Linux, install its system libraries with `sudo npx puppeteer browsers install chrome --install-deps`. Ruby versions in `.ruby-version`, `.tool-versions`, `Gemfile`, and `Dockerfile` must stay aligned. Node uses `.node-version`, `.tool-versions`, and `Dockerfile`. Container and Render builds use the committed npm lockfile. The reviewed Puppeteer install script is approved for its exact version in `package.json`; review and refresh that entry when updating Puppeteer. ### Payment dependency compatibility -Pay remains on version 5 to keep existing Stripe subscription records compatible. Its newer major versions require explicit schema and data migrations; those must be tested as a separate billing upgrade. The application backports the payment return-link fix for [CVE-2023-30614](https://github.com/pay-rails/pay/security/advisories/GHSA-cqf3-vpx7-rxhw), restricts payment return links to local paths, and enables only the Stripe processor. +Pay remains on version 5 to keep existing Stripe subscription records compatible. Its newer major versions require explicit schema and data migrations; those must be tested as a [separate billing upgrade](https://github.com/contraptionco/postcard/issues/79). The application backports the payment return-link fix for [CVE-2023-30614](https://github.com/pay-rails/pay/security/advisories/GHSA-cqf3-vpx7-rxhw), restricts payment return links to local paths, and enables only the Stripe processor. The two documented exceptions in `.bundler-audit.yml` cover that tested backport and the Paddle Billing signature advisory, whose controller was introduced after Pay 5 and is absent from this application. Mounted-route tests cover the return link and unavailable Paddle/Braintree webhooks. Review these exceptions when upgrading Pay; they do not mean the payment dependency is current. diff --git a/app/controllers/public_pages_controller.rb b/app/controllers/public_pages_controller.rb index b64d931..5362672 100644 --- a/app/controllers/public_pages_controller.rb +++ b/app/controllers/public_pages_controller.rb @@ -40,7 +40,7 @@ def llms_txt end def og_image - png = Rails.cache.fetch("account-#{@account.id}-#{@account.updated_at.to_i}-og-img-v7") do + png = Rails.cache.fetch("account-#{@account.id}-#{@account.updated_at.to_i}-og-img-v8") do generate_og_image end diff --git a/app/controllers/public_posts_controller.rb b/app/controllers/public_posts_controller.rb index 3a4ad9d..109b639 100644 --- a/app/controllers/public_posts_controller.rb +++ b/app/controllers/public_posts_controller.rb @@ -29,7 +29,7 @@ def show end def og_image - png = Rails.cache.fetch("post-#{@post.id}-#{@post.updated_at.to_i}-og-img-v0") do + png = Rails.cache.fetch("post-#{@post.id}-#{@post.updated_at.to_i}-og-img-v1") do generate_og_image end From 378cfb17991817bd580f6647faf62e7107181632 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:49:57 -0600 Subject: [PATCH 6/7] Install archive extraction support for Puppeteer in Docker --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b0df61c..9fed834 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN apt-get update -qq && \ FROM base AS build RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential libpq-dev pkg-config && \ + apt-get install --no-install-recommends -y build-essential libpq-dev pkg-config unzip && \ rm -rf /var/lib/apt/lists/* COPY --link Gemfile Gemfile.lock ./ From 6f0b2d13dced64d48785ff48b8df7246f25439c2 Mon Sep 17 00:00:00 2001 From: "Philip I. Thomas" Date: Sat, 5 Sep 2026 10:59:23 -0600 Subject: [PATCH 7/7] Serve patched bundled Trix and test editor paste sanitization --- README.md | 2 ++ app/javascript/dashboard.js | 4 +-- config/importmap.rb | 3 +- test/controllers/homepage_runtime_test.rb | 4 +++ test/javascript/trix_editor.test.cjs | 43 +++++++++++++++++++++++ 5 files changed, 53 insertions(+), 3 deletions(-) create mode 100644 test/javascript/trix_editor.test.cjs diff --git a/README.md b/README.md index 86a0c58..dc0a7e7 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,8 @@ bundle exec bundler-audit check --update CI runs the Rails suite separately in SOLO and MULTIUSER modes on PostgreSQL 16. It also builds production assets, checks autoloading, and renders PNGs through both Puppeteer and Grover. The Docker check runs the default production entrypoint against disposable PostgreSQL with dummy service credentials, requests the health endpoint, and verifies Puma's PID file. The browser tests require the browser downloaded by `npm ci`; on Linux, install its system libraries with `sudo npx puppeteer browsers install chrome --install-deps`. +Trix is served from the `action_text-trix` gem so its version is locked and included in the Ruby dependency audit. Browser tests load the actual dashboard editor code and verify normal formatting and malicious pasted-content sanitization. Avoid replacing its importmap entry with a separately pinned CDN version. + Ruby versions in `.ruby-version`, `.tool-versions`, `Gemfile`, and `Dockerfile` must stay aligned. Node uses `.node-version`, `.tool-versions`, and `Dockerfile`. Container and Render builds use the committed npm lockfile. The reviewed Puppeteer install script is approved for its exact version in `package.json`; review and refresh that entry when updating Puppeteer. ### Payment dependency compatibility diff --git a/app/javascript/dashboard.js b/app/javascript/dashboard.js index 4d5e191..4463d2f 100644 --- a/app/javascript/dashboard.js +++ b/app/javascript/dashboard.js @@ -1,11 +1,11 @@ import * as ActiveStorage from "@rails/activestorage"; -import Trix from "trix"; +import "trix"; import "@rails/actiontext"; ActiveStorage.start(); // Init -window.Trix = Trix; // Don't need to bind to the window, but useful for debugging. +const Trix = window.Trix; Trix.config.toolbar.getDefaultHTML = toolbarDefaultHTML; document.addEventListener( "trix-initialize", diff --git a/config/importmap.rb b/config/importmap.rb index cf2928a..6b8d7a1 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -19,4 +19,5 @@ pin 'stimulus-dropdown' # @2.1.0 pin 'stimulus-use', preload: true # @0.51.3 pin 'hotkeys-js' # @3.10.1 -pin "trix", to: "https://cdn.jsdelivr.net/npm/trix@2.1.1/dist/trix.esm.js" \ No newline at end of file +# Use the patched editor tracked by the action_text-trix gem and bundle audit. +pin 'trix', to: 'trix.js' diff --git a/test/controllers/homepage_runtime_test.rb b/test/controllers/homepage_runtime_test.rb index b579573..88adcee 100644 --- a/test/controllers/homepage_runtime_test.rb +++ b/test/controllers/homepage_runtime_test.rb @@ -14,6 +14,10 @@ class HomepageRuntimeTest < ActionDispatch::IntegrationTest assert_response :success assert_select 'input[name="email_address[email]"]' + + importmap = JSON.parse(css_select('script[type="importmap"]').first.content) + trix_path = URI.parse(importmap.fetch('imports').fetch('trix')).path + assert_match %r{\A/assets/trix-[a-f0-9]+\.js\z}, trix_path ensure Rails.configuration.solo_mode = original_solo_mode Rails.configuration.multiuser_mode = original_multiuser_mode diff --git a/test/javascript/trix_editor.test.cjs b/test/javascript/trix_editor.test.cjs new file mode 100644 index 0000000..70e8f63 --- /dev/null +++ b/test/javascript/trix_editor.test.cjs @@ -0,0 +1,43 @@ +const assert = require('node:assert/strict'); +const { execFileSync } = require('node:child_process'); +const { readFileSync } = require('node:fs'); +const path = require('node:path'); +const test = require('node:test'); +const puppeteer = require('puppeteer'); + +test('the bundled editor preserves formatting and sanitizes pasted attachment attributes', async () => { + const trixGem = execFileSync('bundle', ['show', 'action_text-trix'], { encoding: 'utf8' }).trim(); + const actionTextGem = execFileSync('bundle', ['show', 'actiontext'], { encoding: 'utf8' }).trim(); + const moduleUrl = (file) => `data:text/javascript;base64,${readFileSync(file).toString('base64')}`; + const browser = await puppeteer.launch({ + headless: true, + args: process.env.GROVER_NO_SANDBOX === 'true' ? ['--no-sandbox'] : [], + }); + + try { + const page = await browser.newPage(); + const imports = { + trix: moduleUrl(path.join(trixGem, 'app/assets/javascripts/trix.js')), + '@rails/actiontext': moduleUrl(path.join(actionTextGem, 'app/assets/javascripts/actiontext.js')), + '@rails/activestorage': moduleUrl(path.join(__dirname, '../../vendor/javascript/@rails--activestorage.js')), + }; + await page.setContent(``); + await page.evaluate(async (url) => { await import(url); }, moduleUrl(path.join(__dirname, '../../app/javascript/dashboard.js'))); + await page.waitForFunction(() => document.querySelector('trix-editor').editor); + await page.waitForSelector('[data-trix-attribute="heading2"]'); + + const result = await page.evaluate(() => { + const editor = document.querySelector('trix-editor').editor; + editor.insertHTML('A postcard Read more'); + editor.insertHTML('Malicious link'); + return document.querySelector('#content').value; + }); + + assert.match(result, /A postcard<\/strong>/); + assert.match(result, /href="https:\/\/example.com\/story"/); + assert.match(result, /Malicious link/); + assert.doesNotMatch(result, /javascript:|__postcardXss/i); + } finally { + await browser.close(); + } +});