From 5cbc30cdabfc63de895d85077e1d6765cb6be07f Mon Sep 17 00:00:00 2001
From: Vijay Swamidass
Date: Fri, 20 Nov 2026 12:13:50 -0800
Subject: [PATCH 1/4] Preserve blank lines when rendering Markdown so lists
close before headings.
Stripping every blank line pulled the next heading into the previous list item as literal text.
---
app/helpers/markdown_helper.rb | 9 ++++--
app/views/shared/_doc_list.html.erb | 2 +-
app/views/shared/_markdown.html.erb | 2 +-
spec/helpers/markdown_helper_spec.rb | 48 ++++++++++++++++++++++++++++
4 files changed, 57 insertions(+), 4 deletions(-)
create mode 100644 spec/helpers/markdown_helper_spec.rb
diff --git a/app/helpers/markdown_helper.rb b/app/helpers/markdown_helper.rb
index f1a9d0f6..88b3a6b1 100644
--- a/app/helpers/markdown_helper.rb
+++ b/app/helpers/markdown_helper.rb
@@ -77,9 +77,14 @@ def list(content, list_type)
module MarkdownHelper
def render_markdown(text)
- renderer = CustomRender.new(escape_html: true, no_images: true)
- # renderer = Redcarpet::Render::HTML.new(hard_wrap: true)
+ return ''.html_safe if text.blank?
+
+ # Drop only leading blank lines. Internal blank lines are what end lists
+ # and separate headings, so stripping them pulls the next heading into the
+ # previous list item as literal "##" text.
+ text = text.sub(/\A(?:[ \t]*\r?\n)+/, '')
+ renderer = CustomRender.new(escape_html: true, no_images: true)
markdown = Redcarpet::Markdown.new(renderer, fenced_code_blocks: true, tables: true)
markdown.render(text).html_safe
end
diff --git a/app/views/shared/_doc_list.html.erb b/app/views/shared/_doc_list.html.erb
index 290e0daf..f03ce971 100644
--- a/app/views/shared/_doc_list.html.erb
+++ b/app/views/shared/_doc_list.html.erb
@@ -56,7 +56,7 @@
<% cache document do %>
- <%= render_markdown(document.document.gsub(/^\s*\n/, '')) if document.document %>
+ <%= render_markdown(document.document) if document.document %>
<% end %>
diff --git a/app/views/shared/_markdown.html.erb b/app/views/shared/_markdown.html.erb
index 9ec124ea..39a53dc7 100644
--- a/app/views/shared/_markdown.html.erb
+++ b/app/views/shared/_markdown.html.erb
@@ -1 +1 @@
-<%= render_markdown(text.gsub(/^\s*\n/, '')) if text %>
\ No newline at end of file
+<%= render_markdown(text) if text %>
\ No newline at end of file
diff --git a/spec/helpers/markdown_helper_spec.rb b/spec/helpers/markdown_helper_spec.rb
new file mode 100644
index 00000000..5d43a48c
--- /dev/null
+++ b/spec/helpers/markdown_helper_spec.rb
@@ -0,0 +1,48 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe MarkdownHelper, type: :helper do
+ describe '#render_markdown' do
+ it 'ends a list before the following heading' do
+ source = <<~MD
+ 1. First prerequisite
+ 2. Second prerequisite
+ 3. Third prerequisite
+ 4. Fourth prerequisite
+
+ ## What ACP is
+
+ Body text.
+ MD
+
+ html = helper.render_markdown(source)
+
+ expect(html).to include('What ACP is
')
+ expect(html).not_to include('## What ACP is')
+ expect(html).to include('')
+ expect(html.index('')).to be < html.index('Next section
')
+ expect(html).not_to include('## Next section')
+ end
+
+ it 'drops leading blank lines without removing the ones that structure the document' do
+ html = helper.render_markdown("\n\n# Title\n\nParagraph\n")
+
+ expect(html).to start_with('Paragraph
')
+ end
+ end
+end
From 10da3cd4c0685666795f44ffe4f0b8c26da9c894 Mon Sep 17 00:00:00 2001
From: Vijay Swamidass
Date: Fri, 20 Nov 2026 12:17:09 -0800
Subject: [PATCH 2/4] Use the latest Ruby 3.3 patch on CI.
ubuntu-latest no longer publishes Ruby 3.3.8, so setup-ruby was returning 404.
---
.github/workflows/rubyonrails.yml | 5 ++++-
Gemfile | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml
index 439d3bdf..7371a0e4 100644
--- a/.github/workflows/rubyonrails.yml
+++ b/.github/workflows/rubyonrails.yml
@@ -32,6 +32,8 @@ jobs:
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1 # v1.146.0
with:
+ # ubuntu-latest only has the newest patch of each Ruby series.
+ ruby-version: '3.3'
bundler-cache: true
- name: Set up database schema
@@ -49,7 +51,8 @@ jobs:
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
- ruby-version: '3.3.8'
+ # ubuntu-latest only has the newest patch of each Ruby series.
+ ruby-version: '3.3'
bundler-cache: true
# Add or replace any other lints here
- name: Security audit dependencies
diff --git a/Gemfile b/Gemfile
index 0ddd15df..ef548243 100644
--- a/Gemfile
+++ b/Gemfile
@@ -3,7 +3,7 @@
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
-ruby '3.3.8'
+ruby '~> 3.3.8'
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem 'rails', '~> 8.1.3', '>= 8.1.3.1'
From 9c5410fcdbb4de6fb8d6cbdbf6a5b0893ae0c286 Mon Sep 17 00:00:00 2001
From: Vijay Swamidass
Date: Fri, 20 Nov 2026 12:20:37 -0800
Subject: [PATCH 3/4] Update gems flagged by bundler-audit.
Rails 8.1.4 and several dependencies were below the patched versions the lint job requires.
---
Gemfile | 16 +++--
Gemfile.lock | 171 ++++++++++++++++++++++++++-------------------------
2 files changed, 99 insertions(+), 88 deletions(-)
diff --git a/Gemfile b/Gemfile
index ef548243..ca588eba 100644
--- a/Gemfile
+++ b/Gemfile
@@ -6,7 +6,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '~> 3.3.8'
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
-gem 'rails', '~> 8.1.3', '>= 8.1.3.1'
+gem 'rails', '~> 8.1.3', '>= 8.1.4.1'
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'
@@ -15,7 +15,7 @@ gem 'sprockets-rails'
gem 'pg', '~> 1.1'
# Use the Puma web server [https://github.com/puma/puma]
-gem 'puma', '>= 7.2.1', '< 8.0'
+gem 'puma', '>= 7.2.2', '< 8.0'
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
gem 'importmap-rails'
@@ -96,19 +96,25 @@ gem 'httparty', '>= 0.24.0'
gem 'faraday', '>= 2.14.2', '< 3.0'
# Security: direct minimum versions to address current advisories
-gem 'addressable', '>= 2.9.0'
+gem 'addressable', '>= 2.9.1'
gem 'jwt', '>= 2.10.3'
gem 'rack-session', '>= 2.1.2'
gem 'erb', '>= 6.0.4'
gem 'net-imap', '>= 0.6.4'
# Security: Fix GHSA-c4rq-3m3g-8wgx, GHSA-v2fc-qm4h-8hqv (nokogiri), CVE-2026-22860, CVE-2026-25500 (rack)
-gem 'nokogiri', '>= 1.19.3'
-gem 'rack', '~> 3.1.20'
+gem 'nokogiri', '>= 1.19.5'
+gem 'rack', '~> 3.1.23'
# Security: Fix GHSA-pp92-crg2-gfv9 (oauth2 redirect/authority leak)
gem 'oauth2', '>= 2.0.22'
+# Security: patched floors from bundler-audit (Rails 8.1.4.1 advisory set)
+gem 'loofah', '>= 2.25.3'
+gem 'msgpack', '>= 1.8.7'
+gem 'omniauth', '>= 2.2.0'
+gem 'rails-html-sanitizer', '>= 1.7.2'
+
# Markdown renderer
gem 'redcarpet'
diff --git a/Gemfile.lock b/Gemfile.lock
index 00faf551..b06cc9dc 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -3,29 +3,29 @@ GEM
specs:
action_text-trix (2.1.19)
railties
- actioncable (8.1.4)
- actionpack (= 8.1.4)
- activesupport (= 8.1.4)
+ actioncable (8.1.4.1)
+ actionpack (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
- actionmailbox (8.1.4)
- actionpack (= 8.1.4)
- activejob (= 8.1.4)
- activerecord (= 8.1.4)
- activestorage (= 8.1.4)
- activesupport (= 8.1.4)
+ actionmailbox (8.1.4.1)
+ actionpack (= 8.1.4.1)
+ activejob (= 8.1.4.1)
+ activerecord (= 8.1.4.1)
+ activestorage (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
mail (>= 2.8.0)
- actionmailer (8.1.4)
- actionpack (= 8.1.4)
- actionview (= 8.1.4)
- activejob (= 8.1.4)
- activesupport (= 8.1.4)
+ actionmailer (8.1.4.1)
+ actionpack (= 8.1.4.1)
+ actionview (= 8.1.4.1)
+ activejob (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
- actionpack (8.1.4)
- actionview (= 8.1.4)
- activesupport (= 8.1.4)
+ actionpack (8.1.4.1)
+ actionview (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
@@ -33,36 +33,36 @@ GEM
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
- actiontext (8.1.4)
+ actiontext (8.1.4.1)
action_text-trix (~> 2.1.15)
- actionpack (= 8.1.4)
- activerecord (= 8.1.4)
- activestorage (= 8.1.4)
- activesupport (= 8.1.4)
+ actionpack (= 8.1.4.1)
+ activerecord (= 8.1.4.1)
+ activestorage (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
- actionview (8.1.4)
- activesupport (= 8.1.4)
+ actionview (8.1.4.1)
+ activesupport (= 8.1.4.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
- rails-html-sanitizer (~> 1.6)
- activejob (8.1.4)
- activesupport (= 8.1.4)
+ rails-html-sanitizer (~> 1.6, >= 1.7.2)
+ activejob (8.1.4.1)
+ activesupport (= 8.1.4.1)
globalid (>= 0.3.6)
- activemodel (8.1.4)
- activesupport (= 8.1.4)
- activerecord (8.1.4)
- activemodel (= 8.1.4)
- activesupport (= 8.1.4)
+ activemodel (8.1.4.1)
+ activesupport (= 8.1.4.1)
+ activerecord (8.1.4.1)
+ activemodel (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
timeout (>= 0.4.0)
- activestorage (8.1.4)
- actionpack (= 8.1.4)
- activejob (= 8.1.4)
- activerecord (= 8.1.4)
- activesupport (= 8.1.4)
+ activestorage (8.1.4.1)
+ actionpack (= 8.1.4.1)
+ activejob (= 8.1.4.1)
+ activerecord (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
marcel (~> 1.0)
- activesupport (8.1.4)
+ activesupport (8.1.4.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
@@ -76,7 +76,7 @@ GEM
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
acts_as_votable (0.14.0)
- addressable (2.9.0)
+ addressable (2.9.2)
public_suffix (>= 2.0.2, < 8.0)
akami (1.3.3)
base64
@@ -192,7 +192,7 @@ GEM
gyoku (1.4.0)
builder (>= 2.1.2)
rexml (~> 3.0)
- hashie (5.1.0)
+ hashie (5.2.0)
logger
httparty (0.24.2)
csv
@@ -211,8 +211,8 @@ GEM
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
railties (>= 6.0.0)
- io-console (0.9.4)
- irb (1.18.0)
+ io-console (0.9.5)
+ irb (1.19.0)
pp (>= 0.6.0)
prism (>= 1.3.0)
rdoc (>= 4.0.0)
@@ -238,9 +238,9 @@ GEM
language_server-protocol (3.17.0.5)
lint_roller (1.1.0)
logger (1.7.0)
- loofah (2.25.2)
+ loofah (2.25.3)
crass (~> 1.0.2)
- nokogiri (>= 1.12.0)
+ nokogiri (>= 1.19.5)
mail (2.9.1)
logger
mini_mime (>= 0.1.1)
@@ -250,10 +250,10 @@ GEM
marcel (1.2.1)
matrix (0.4.3)
mini_mime (1.1.5)
- minitest (6.0.6)
+ minitest (6.1.0)
drb (~> 2.0)
- prism (~> 1.5)
- msgpack (1.8.3)
+ prism (>= 1.5, < 3)
+ msgpack (1.8.7)
multi_xml (0.9.1)
bigdecimal (>= 3.1, < 5)
multipart-post (2.4.1)
@@ -274,11 +274,11 @@ GEM
net-protocol
nio4r (2.7.5)
nkf (0.3.0)
- nokogiri (1.19.4-arm64-darwin)
+ nokogiri (1.19.7-arm64-darwin)
racc (~> 1.4)
- nokogiri (1.19.4-x86_64-darwin)
+ nokogiri (1.19.7-x86_64-darwin)
racc (~> 1.4)
- nokogiri (1.19.4-x86_64-linux-gnu)
+ nokogiri (1.19.7-x86_64-linux-gnu)
racc (~> 1.4)
nori (2.7.1)
bigdecimal
@@ -291,10 +291,11 @@ GEM
rack (>= 1.2, < 4)
snaky_hash (~> 2.0, >= 2.0.5)
version_gem (~> 1.1, >= 1.1.11)
- omniauth (2.1.3)
- hashie (>= 3.4.6)
- rack (>= 2.2.3)
- rack-protection
+ omniauth (2.4.2)
+ hashie (>= 3.5.2)
+ logger
+ rack (>= 2.2.8)
+ rack-protection (>= 2.2.0)
omniauth-google-oauth2 (1.2.1)
jwt (>= 2.9.2)
oauth2 (~> 2.0)
@@ -325,16 +326,16 @@ GEM
prism (1.9.0)
pstore (0.2.1)
public_suffix (7.0.5)
- puma (7.2.1)
+ puma (7.2.3)
nio4r (~> 2.0)
pundit (2.5.0)
activesupport (>= 3.0.0)
racc (1.8.1)
- rack (3.1.22)
+ rack (3.1.23)
rack-cors (3.0.0)
logger
rack (>= 3.0.14)
- rack-protection (4.1.1)
+ rack-protection (4.2.2)
base64 (>= 0.1.0)
logger (>= 1.6.0)
rack (>= 3.0.0, < 4)
@@ -345,20 +346,20 @@ GEM
rack (>= 1.3)
rackup (2.3.1)
rack (>= 3)
- rails (8.1.4)
- actioncable (= 8.1.4)
- actionmailbox (= 8.1.4)
- actionmailer (= 8.1.4)
- actionpack (= 8.1.4)
- actiontext (= 8.1.4)
- actionview (= 8.1.4)
- activejob (= 8.1.4)
- activemodel (= 8.1.4)
- activerecord (= 8.1.4)
- activestorage (= 8.1.4)
- activesupport (= 8.1.4)
+ rails (8.1.4.1)
+ actioncable (= 8.1.4.1)
+ actionmailbox (= 8.1.4.1)
+ actionmailer (= 8.1.4.1)
+ actionpack (= 8.1.4.1)
+ actiontext (= 8.1.4.1)
+ actionview (= 8.1.4.1)
+ activejob (= 8.1.4.1)
+ activemodel (= 8.1.4.1)
+ activerecord (= 8.1.4.1)
+ activestorage (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
bundler (>= 1.15.0)
- railties (= 8.1.4)
+ railties (= 8.1.4.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
@@ -367,12 +368,12 @@ GEM
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
- rails-html-sanitizer (1.7.1)
- loofah (~> 2.25, >= 2.25.2)
+ rails-html-sanitizer (1.7.2)
+ loofah (~> 2.25, >= 2.25.3)
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)
- railties (8.1.4)
- actionpack (= 8.1.4)
- activesupport (= 8.1.4)
+ railties (8.1.4.1)
+ actionpack (= 8.1.4.1)
+ activesupport (= 8.1.4.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
@@ -533,10 +534,10 @@ GEM
event_emitter
mutex_m
websocket
- websocket-driver (0.8.2)
+ websocket-driver (0.9.0)
base64
- websocket-extensions (>= 0.1.0)
- websocket-extensions (0.1.5)
+ websocket-extensions (>= 0.2.0)
+ websocket-extensions (0.2.0)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.8.3)
@@ -552,7 +553,7 @@ PLATFORMS
DEPENDENCIES
acts_as_votable
- addressable (>= 2.9.0)
+ addressable (>= 2.9.1)
bcrypt (>= 3.1.22)
bootsnap
brakeman
@@ -574,23 +575,27 @@ DEPENDENCIES
jbuilder
jwt (>= 2.10.3)
kaminari
+ loofah (>= 2.25.3)
+ msgpack (>= 1.8.7)
neighbor
net-imap (>= 0.6.4)
- nokogiri (>= 1.19.3)
+ nokogiri (>= 1.19.5)
oauth2 (>= 2.0.22)
+ omniauth (>= 2.2.0)
omniauth-google-oauth2
optparse
pager_duty-connection
pg (~> 1.1)
pg_search
pgvector
- puma (>= 7.2.1, < 8.0)
+ puma (>= 7.2.2, < 8.0)
pundit (~> 2.3)
- rack (~> 3.1.20)
+ rack (~> 3.1.23)
rack-cors
rack-session (>= 2.1.2)
- rails (~> 8.1.3, >= 8.1.3.1)
+ rails (~> 8.1.3, >= 8.1.4.1)
rails-controller-testing
+ rails-html-sanitizer (>= 1.7.2)
redcarpet
redis (~> 4.0)
restforce
From ec3d0de11462c853068282c6f38fec69837a30a6 Mon Sep 17 00:00:00 2001
From: Vijay Swamidass
Date: Fri, 20 Nov 2026 12:25:56 -0800
Subject: [PATCH 4/4] Pin setup-ruby to a commit SHA.
The SAST check flags the mutable v1 tag on both CI jobs.
---
.github/workflows/rubyonrails.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/rubyonrails.yml b/.github/workflows/rubyonrails.yml
index 7371a0e4..13fe7cb0 100644
--- a/.github/workflows/rubyonrails.yml
+++ b/.github/workflows/rubyonrails.yml
@@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4
# Add or replace dependency steps here
- name: Install Ruby and gems
- uses: ruby/setup-ruby@v1 # v1.146.0
+ uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
# ubuntu-latest only has the newest patch of each Ruby series.
ruby-version: '3.3'
@@ -49,7 +49,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ruby and gems
- uses: ruby/setup-ruby@v1
+ uses: ruby/setup-ruby@be3c7df29b3349ec6bcfc6b4792f1cf9f5237d18 # v1.343.0
with:
# ubuntu-latest only has the newest patch of each Ruby series.
ruby-version: '3.3'