mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-04 21:02:35 +08:00
Bumps [net-imap](https://github.com/ruby/net-imap) from 0.4.20 to 0.4.24. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/ruby/net-imap/releases">net-imap's releases</a>.</em></p> <blockquote> <h2>v0.4.24</h2> <blockquote> <p>[!IMPORTANT] <em>The <code>0.4.x</code> release branch will only receive critical security fixes, and will be unsupported when ruby 3.3 is EOL. Please upgrade to a newer version.</em></p> </blockquote> <h2>What's Changed</h2> <h3>🔒 Security</h3> <p>This release contains fixes for <strong>multiple vulnerabilities</strong> concerning <em><strong><code>STARTTLS</code> stripping</strong></em>, argument validation, and denial of service attacks.</p> <blockquote> <p>[!WARNING] <a href="https://redirect.github.com/ruby/net-imap/pull/666">ruby/net-imap#666</a> fixes a <code>STARTTLS</code> stripping vulnerability (GHSA-vcgp-9326-pqcp). Without this fix, a man-in-the-middle attacker can cause <code>Net::IMAP#starttls</code> to return "successfully", <strong><em>without starting TLS</em></strong>.</p> </blockquote> <blockquote> <p>[!IMPORTANT] Argument validation is significantly improved. Several injection vulnerabilities have been fixed: <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a> fixes CRLF/command/argument injection via Symbol arguments (GHSA-75xq-5h9v-w6px). <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a> fixes CRLF/command/argument injection via the <code>attr</code> argument to <code>#store</code>/<code>#uid_store</code> (GHSA-hm49-wcqc-g2xg) <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a> fixes CRLF/command/argument injection via the <code>storage_limit</code> argument to <code>#setquota</code> (GHSA-hm49-wcqc-g2xg). <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a> fixes CRLF/command injection via <code>RawData</code> (GHSA-hm49-wcqc-g2xg):</p> <ul> <li><code>#search</code> and <code>#uid_search</code> send <code>criteria</code> as raw data, when it is a String</li> <li><code>#fetch</code> and <code>#uid_fetch</code> send <code>attr</code> as raw data, when it is a String. When <code>attr</code> is an Array, its String members are sent as raw data.</li> </ul> </blockquote> <blockquote> <p>[!CAUTION] <code>RawData</code> does not defend against <em>other</em> forms of argument injection! It is an intentionally low-level API.</p> </blockquote> <blockquote> <p>[!NOTE] Two denial of service vulnerabilities have been addressed. These are generally only relevant when connecting to an <em>untrusted hostile server</em> (or without TLS).</p> <p><a href="https://redirect.github.com/ruby/net-imap/pull/651">ruby/net-imap#651</a> fixes quadratic time complexity when reading large responses containing many string literals (GHSA-q2mw-fvj9-vvcw). <a href="https://redirect.github.com/ruby/net-imap/pull/655">ruby/net-imap#655</a> adds a configurable <code>max_iterations</code> count for <code>SCRAM-*</code> authentication (GHSA-87pf-fpwv-p7m7).</p> <p>The default <code>ScramAuthenticator#max_iterations</code> is <code>2**31 - 1</code> (max 32-bit signed int), which was already OpenSSL's maximum value. <em>It provides no protection</em> against hostile servers unless it is explicitly set to a lower value by the user.</p> </blockquote> <h3>Added</h3> <ul> <li>🔒 Add <code>ScramAuthenticator#max_iterations</code> (backports <a href="https://redirect.github.com/ruby/net-imap/issues/654">#654</a>) in <a href="https://redirect.github.com/ruby/net-imap/pull/655">ruby/net-imap#655</a>, reported by <a href="https://github.com/Masamuneee"><code>@Masamuneee</code></a></li> </ul> <h3>Fixed</h3> <ul> <li>🔒 Fix STARTTLS stripping vulnerability (backports <a href="https://redirect.github.com/ruby/net-imap/issues/664">#664</a>) in <a href="https://redirect.github.com/ruby/net-imap/pull/666">ruby/net-imap#666</a>, reported by <a href="https://github.com/Masamuneee"><code>@Masamuneee</code></a></li> <li>🔒 Fix CRLF injection vulnerabilities (backports <a href="https://redirect.github.com/ruby/net-imap/issues/657">#657</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/658">#658</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/659">#659</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/660">#660</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/636">#636</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/661">#661</a>) in <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a>, reported by <a href="https://github.com/manunio"><code>@manunio</code></a></li> <li>⚡ Much faster ResponseReader performance (backports <a href="https://redirect.github.com/ruby/net-imap/issues/642">#642</a>) in <a href="https://redirect.github.com/ruby/net-imap/pull/651">ruby/net-imap#651</a>, reported by <a href="https://github.com/Masamuneee"><code>@Masamuneee</code></a></li> <li>🐛 Wait to continue RawData literals (backports <a href="https://redirect.github.com/ruby/net-imap/issues/660">#660</a>) by <a href="https://github.com/nevans"><code>@nevans</code></a> in <a href="https://redirect.github.com/ruby/net-imap/pull/663">ruby/net-imap#663</a></li> </ul> <h3>Other Changes</h3> <ul> <li>♻️ Improve internal literal sending (partially backports <a href="https://redirect.github.com/ruby/net-imap/issues/358">#358</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/616">#616</a>, <a href="https://redirect.github.com/ruby/net-imap/issues/649">#649</a>) by <a href="https://github.com/nevans"><code>@nevans</code></a> in <a href="https://redirect.github.com/ruby/net-imap/pull/653">ruby/net-imap#653</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/ruby/net-imap/compare/v0.4.23...v0.4.24">https://github.com/ruby/net-imap/compare/v0.4.23...v0.4.24</a></p> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="24a4e770b4"><code>24a4e77</code></a> 🔀 Merge pull request <a href="https://redirect.github.com/ruby/net-imap/issues/666">#666</a> from ruby/backport/v0.4/STARTTLS-stripping</li> <li><a href="63f53ffdef"><code>63f53ff</code></a> 🔖 Bump version to 0.4.24</li> <li><a href="038ae35d5e"><code>038ae35</code></a> 🍒 pick 24d5c773d: 🔒🥅 Handle tagged "OK" to incomplete command [backport <a href="https://redirect.github.com/ruby/net-imap/issues/664">#664</a>]</li> <li><a href="705aa59faa"><code>705aa59</code></a> 🍒 pick 62eea6ffe: 🔒🥅 Ensure STARTTLS tagged response was handled [backport <a href="https://redirect.github.com/ruby/net-imap/issues/664">#664</a>]</li> <li><a href="c9a6f28f87"><code>c9a6f28</code></a> 🍒 pick 46636cae8: ❌🔒 Add failing test for STARTTLS stripping [backport <a href="https://redirect.github.com/ruby/net-imap/issues/664">#664</a>]</li> <li><a href="aec06996eb"><code>aec0699</code></a> 🔀 Merge pull request <a href="https://redirect.github.com/ruby/net-imap/issues/663">#663</a> from ruby/backport/v0.4/raw_data-warnings</li> <li><a href="fd245ddd1e"><code>fd245dd</code></a> 🍒 pick be32e712e: 📚 Improve documentation of RawData arguments [backports <a href="https://redirect.github.com/ruby/net-imap/issues/661">#661</a>]</li> <li><a href="6dd110bfda"><code>6dd110b</code></a> 🍒 pick 47c72186d: 🐛 Validate RawData and wait to continue literals [backports...</li> <li><a href="4e93149e65"><code>4e93149</code></a> 🔀 Merge branch 'backport/v0.4/QUOTA-argument-validation' into backport/v0.4/s...</li> <li><a href="d2b23602e8"><code>d2b2360</code></a> 🍒 pick 0ec4fd351: 🥅 Validate <code>#setquota</code> storage limit argument [backports <a href="https://redirect.github.com/ruby/net-imap/issues/659">#659</a>]</li> <li>Additional commits viewable in <a href="https://github.com/ruby/net-imap/compare/v0.4.20...v0.4.24">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/chatwoot/chatwoot/network/alerts). </details> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pranav <pranav@chatwoot.com>
375 lines
12 KiB
YAML
375 lines
12 KiB
YAML
version: 2.1
|
|
orbs:
|
|
node: circleci/node@6.1.0
|
|
qlty-orb: qltysh/qlty-orb@0.0
|
|
|
|
# Shared defaults for setup steps
|
|
defaults: &defaults
|
|
working_directory: ~/build
|
|
machine:
|
|
image: ubuntu-2204:2024.05.1
|
|
resource_class: large
|
|
environment:
|
|
RAILS_LOG_TO_STDOUT: false
|
|
COVERAGE: true
|
|
LOG_LEVEL: warn
|
|
|
|
jobs:
|
|
# Separate job for linting (no parallelism needed)
|
|
lint:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
|
|
# Install minimal system dependencies for linting
|
|
- run:
|
|
name: Install System Dependencies
|
|
command: |
|
|
sudo apt-get update
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
|
|
libpq-dev \
|
|
build-essential \
|
|
git \
|
|
curl \
|
|
libssl-dev \
|
|
zlib1g-dev \
|
|
libreadline-dev \
|
|
libyaml-dev \
|
|
openjdk-11-jdk \
|
|
jq \
|
|
software-properties-common \
|
|
ca-certificates \
|
|
imagemagick \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
file \
|
|
g++ \
|
|
gcc \
|
|
autoconf \
|
|
gnupg2 \
|
|
patch \
|
|
ruby-dev \
|
|
liblzma-dev \
|
|
libgmp-dev \
|
|
libncurses5-dev \
|
|
libffi-dev \
|
|
libgdbm6 \
|
|
libgdbm-dev \
|
|
libvips
|
|
|
|
- run:
|
|
name: Install RVM and Ruby 3.4.4
|
|
command: |
|
|
sudo apt-get install -y gpg
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
|
\curl -sSL https://get.rvm.io | bash -s stable
|
|
echo 'source ~/.rvm/scripts/rvm' >> $BASH_ENV
|
|
source ~/.rvm/scripts/rvm
|
|
rvm install "3.4.4"
|
|
rvm use 3.4.4 --default
|
|
gem install bundler -v 2.5.16
|
|
|
|
- run:
|
|
name: Install Application Dependencies
|
|
command: |
|
|
source ~/.rvm/scripts/rvm
|
|
bundle install
|
|
|
|
- node/install:
|
|
node-version: '24.13'
|
|
- node/install-pnpm
|
|
- node/install-packages:
|
|
pkg-manager: pnpm
|
|
override-ci-command: pnpm i
|
|
|
|
# Swagger verification
|
|
- run:
|
|
name: Verify swagger API specification
|
|
command: |
|
|
bundle exec rake swagger:build
|
|
if [[ `git status swagger/swagger.json --porcelain` ]]
|
|
then
|
|
echo "ERROR: The swagger.json file is not in sync with the yaml specification. Run 'rake swagger:build' and commit 'swagger/swagger.json'."
|
|
exit 1
|
|
fi
|
|
mkdir -p ~/tmp
|
|
curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.19.0/openapi-generator-cli-7.19.0.jar > ~/tmp/openapi-generator-cli-7.19.0.jar
|
|
java -jar ~/tmp/openapi-generator-cli-7.19.0.jar validate -i swagger/swagger.json
|
|
|
|
# Bundle audit
|
|
- run:
|
|
name: Bundle audit
|
|
command: bundle exec bundle audit update && bundle exec bundle audit check -v
|
|
|
|
# Rubocop linting
|
|
- run:
|
|
name: Rubocop
|
|
command: bundle exec rubocop --parallel
|
|
|
|
# ESLint linting
|
|
- run:
|
|
name: eslint
|
|
command: pnpm run eslint
|
|
|
|
# Separate job for frontend tests
|
|
frontend-tests:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- node/install:
|
|
node-version: '24.13'
|
|
- node/install-pnpm
|
|
- node/install-packages:
|
|
pkg-manager: pnpm
|
|
override-ci-command: pnpm i
|
|
|
|
- run:
|
|
name: Run frontend tests (with coverage)
|
|
command: pnpm run test:coverage
|
|
|
|
- run:
|
|
name: Move coverage files if they exist
|
|
command: |
|
|
if [ -d "coverage" ]; then
|
|
mkdir -p ~/build/coverage
|
|
cp -r coverage ~/build/coverage/frontend || true
|
|
fi
|
|
when: always
|
|
|
|
- persist_to_workspace:
|
|
root: ~/build
|
|
paths:
|
|
- coverage
|
|
|
|
# Backend tests with parallelization
|
|
backend-tests:
|
|
<<: *defaults
|
|
parallelism: 20
|
|
steps:
|
|
- checkout
|
|
- node/install:
|
|
node-version: '24.13'
|
|
- node/install-pnpm
|
|
- node/install-packages:
|
|
pkg-manager: pnpm
|
|
override-ci-command: pnpm i
|
|
|
|
- run:
|
|
name: Add PostgreSQL repository and update
|
|
command: |
|
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
|
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
|
sudo apt-get update -y
|
|
|
|
- run:
|
|
name: Install System Dependencies
|
|
command: |
|
|
sudo apt-get update
|
|
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
|
|
libpq-dev \
|
|
redis-server \
|
|
postgresql-common \
|
|
postgresql-16 \
|
|
postgresql-16-pgvector \
|
|
build-essential \
|
|
git \
|
|
curl \
|
|
libssl-dev \
|
|
zlib1g-dev \
|
|
libreadline-dev \
|
|
libyaml-dev \
|
|
openjdk-11-jdk \
|
|
jq \
|
|
software-properties-common \
|
|
ca-certificates \
|
|
imagemagick \
|
|
libxml2-dev \
|
|
libxslt1-dev \
|
|
file \
|
|
g++ \
|
|
gcc \
|
|
autoconf \
|
|
gnupg2 \
|
|
patch \
|
|
ruby-dev \
|
|
liblzma-dev \
|
|
libgmp-dev \
|
|
libncurses5-dev \
|
|
libffi-dev \
|
|
libgdbm6 \
|
|
libgdbm-dev \
|
|
libvips
|
|
|
|
- run:
|
|
name: Install RVM and Ruby 3.4.4
|
|
command: |
|
|
sudo apt-get install -y gpg
|
|
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
|
\curl -sSL https://get.rvm.io | bash -s stable
|
|
echo 'source ~/.rvm/scripts/rvm' >> $BASH_ENV
|
|
source ~/.rvm/scripts/rvm
|
|
rvm install "3.4.4"
|
|
rvm use 3.4.4 --default
|
|
gem install bundler -v 2.5.16
|
|
|
|
- run:
|
|
name: Install Application Dependencies
|
|
command: |
|
|
source ~/.rvm/scripts/rvm
|
|
bundle install
|
|
|
|
# Install and configure OpenSearch
|
|
- run:
|
|
name: Install OpenSearch
|
|
command: |
|
|
# Download and install OpenSearch 2.11.0 (compatible with Elasticsearch 7.x clients)
|
|
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.11.0/opensearch-2.11.0-linux-x64.tar.gz
|
|
tar -xzf opensearch-2.11.0-linux-x64.tar.gz
|
|
sudo mv opensearch-2.11.0 /opt/opensearch
|
|
|
|
- run:
|
|
name: Configure and Start OpenSearch
|
|
command: |
|
|
# Configure OpenSearch for single-node testing
|
|
cat > /opt/opensearch/config/opensearch.yml \<< EOF
|
|
cluster.name: chatwoot-test
|
|
node.name: node-1
|
|
network.host: 0.0.0.0
|
|
http.port: 9200
|
|
discovery.type: single-node
|
|
plugins.security.disabled: true
|
|
EOF
|
|
|
|
# Set ownership and permissions
|
|
sudo chown -R $USER:$USER /opt/opensearch
|
|
|
|
# Start OpenSearch in background
|
|
/opt/opensearch/bin/opensearch -d -p /tmp/opensearch.pid
|
|
|
|
- run:
|
|
name: Wait for OpenSearch to be ready
|
|
command: |
|
|
echo "Waiting for OpenSearch to start..."
|
|
for i in {1..30}; do
|
|
if curl -s http://localhost:9200/_cluster/health | grep -q '"status"'; then
|
|
echo "OpenSearch is ready!"
|
|
exit 0
|
|
fi
|
|
echo "Waiting... ($i/30)"
|
|
sleep 2
|
|
done
|
|
echo "OpenSearch failed to start"
|
|
exit 1
|
|
|
|
# Configure environment and database
|
|
- run:
|
|
name: Database Setup and Configure Environment Variables
|
|
command: |
|
|
pg_pass=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 15 ; echo '')
|
|
sed -i "s/REPLACE_WITH_PASSWORD/${pg_pass}/g" ${PWD}/.circleci/setup_chatwoot.sql
|
|
chmod 644 ${PWD}/.circleci/setup_chatwoot.sql
|
|
mv ${PWD}/.circleci/setup_chatwoot.sql /tmp/
|
|
sudo -i -u postgres psql -f /tmp/setup_chatwoot.sql
|
|
cp .env.example .env
|
|
sed -i '/^FRONTEND_URL/d' .env
|
|
sed -i -e '/REDIS_URL/ s/=.*/=redis:\/\/localhost:6379/' .env
|
|
sed -i -e '/POSTGRES_HOST/ s/=.*/=localhost/' .env
|
|
sed -i -e '/POSTGRES_USERNAME/ s/=.*/=chatwoot/' .env
|
|
sed -i -e "/POSTGRES_PASSWORD/ s/=.*/=$pg_pass/" .env
|
|
echo -en "\nINSTALLATION_ENV=circleci" >> ".env"
|
|
echo -en "\nOPENSEARCH_URL=http://localhost:9200" >> ".env"
|
|
|
|
# Database setup
|
|
- run:
|
|
name: Run DB migrations
|
|
command: bundle exec rails db:chatwoot_prepare
|
|
|
|
# Run backend tests (parallelized)
|
|
- run:
|
|
name: Run backend tests
|
|
command: |
|
|
mkdir -p ~/tmp/test-results/rspec
|
|
mkdir -p ~/tmp/test-artifacts
|
|
mkdir -p ~/build/coverage/backend
|
|
|
|
# Use round-robin distribution (same as GitHub Actions) for better test isolation
|
|
# This prevents tests with similar timing from being grouped on the same runner
|
|
SPEC_FILES=($(find spec -name '*_spec.rb' | sort))
|
|
TESTS=""
|
|
|
|
for i in "${!SPEC_FILES[@]}"; do
|
|
if [ $(( i % $CIRCLE_NODE_TOTAL )) -eq $CIRCLE_NODE_INDEX ]; then
|
|
TESTS="$TESTS ${SPEC_FILES[$i]}"
|
|
fi
|
|
done
|
|
|
|
bundle exec rspec -I ./spec --require coverage_helper --require spec_helper --format progress \
|
|
--format RspecJunitFormatter \
|
|
--out ~/tmp/test-results/rspec.xml \
|
|
-- $TESTS
|
|
no_output_timeout: 30m
|
|
|
|
# Store test results for better splitting in future runs
|
|
- store_test_results:
|
|
path: ~/tmp/test-results
|
|
|
|
- run:
|
|
name: Move coverage files if they exist
|
|
command: |
|
|
if [ -d "coverage" ]; then
|
|
mkdir -p ~/build/coverage
|
|
cp -r coverage ~/build/coverage/backend || true
|
|
fi
|
|
when: always
|
|
|
|
- persist_to_workspace:
|
|
root: ~/build
|
|
paths:
|
|
- coverage
|
|
|
|
# Collect coverage from all jobs
|
|
coverage:
|
|
<<: *defaults
|
|
steps:
|
|
- checkout
|
|
- attach_workspace:
|
|
at: ~/build
|
|
|
|
# Qlty coverage publish
|
|
- qlty-orb/coverage_publish:
|
|
files: |
|
|
coverage/frontend/lcov.info
|
|
|
|
- run:
|
|
name: List coverage directory contents
|
|
command: |
|
|
ls -R ~/build/coverage || echo "No coverage directory"
|
|
|
|
- store_artifacts:
|
|
path: coverage
|
|
destination: coverage
|
|
|
|
build:
|
|
<<: *defaults
|
|
steps:
|
|
- run:
|
|
name: Legacy build aggregator
|
|
command: |
|
|
echo "All main jobs passed; build job kept only for GitHub required check compatibility."
|
|
|
|
workflows:
|
|
version: 2
|
|
build:
|
|
jobs:
|
|
- lint
|
|
- frontend-tests
|
|
- backend-tests
|
|
- coverage:
|
|
requires:
|
|
- frontend-tests
|
|
- backend-tests
|
|
- build:
|
|
requires:
|
|
- lint
|
|
- coverage
|