Skip to content

Remove unsupported plugins and centralize HTTP fetching - #146

Merged
id774 merged 1 commit into
masterfrom
claude/automatic-ruby-plugin-modernize-mtokxm
Aug 15, 2026
Merged

Remove unsupported plugins and centralize HTTP fetching#146
id774 merged 1 commit into
masterfrom
claude/automatic-ruby-plugin-modernize-mtokxm

Conversation

@id774

@id774 id774 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

This change removes plugins for services that no longer exist or have deprecated APIs, and introduces a centralized HTTP fetching utility to improve security and consistency across the codebase.

Summary

The branch modernizes the plugin ecosystem by removing 11 plugins that depend on defunct services or deprecated APIs, while introducing Automatic::Http as a single point for all HTTP fetching in plugins. This improves security by restricting URL schemes to HTTP/HTTPS and enforcing timeouts.

Key Changes

Removed Plugins (Services No Longer Available):

  • PublishGoogleCalendar - Google Calendar GData API v2 and ClientLogin were withdrawn
  • PublishTwitter, SubscriptionTwitter, SubscriptionTwitterSearch - Twitter API changes
  • PublishPocket, SubscriptionPocket - Service deprecated
  • PublishHipchat - Service shutdown
  • SubscriptionGGuide, SubscriptionChanToru, SubscriptionWeather - Services no longer available
  • FilterGoogleNews - Google News API deprecated

New HTTP Utility:

  • Added lib/automatic/http.rb with Automatic::Http class providing:
    • Http.read(url) - fetch URL body with validation
    • Http.uri(url) - parse and validate URI
    • Http.fetchable?(url) - check if URL can be fetched without raising
    • Enforces HTTP/HTTPS schemes only (prevents file:// attacks)
    • Configurable timeouts (10s connect, 30s read)
    • Bounded redirect chain
    • Proper User-Agent header

Updated Plugins to Use New HTTP Utility:

  • FilterFullFeed, FilterImageSource, FilterDescriptionLink - removed direct open-uri calls
  • SubscriptionTumblr, SubscriptionFeed, SubscriptionLink, SubscriptionXml - use centralized HTTP
  • CustomFeedSVNLog - replaced xml-simple dependency with rexml
  • PublishInstapaper, PublishHatenaBookmark - use Net::Http directly with proper HTTPS

Documentation Updates:

  • Updated doc/PLUGINS.md with new section 3.8.1 explaining HTTP fetching best practices
  • Updated plugin catalogue example from xml-simple/xmlsimple to activerecord/active_record
  • Clarified security rationale: links come from feeds (untrusted sources)
  • Updated doc/POLICY.md to reflect removal of unsupported plugins

Test Updates:

  • Added spec/doc/plugins_catalogue_spec.rb to verify plugin documentation consistency
  • Updated specs for remaining plugins with proper comments about their status
  • Changed test intervals from 1 to 0 seconds to speed up test suite
  • Fixed test assertions to use returned values instead of instance variables

Dependency Changes:

  • Removed nkf gem dependency (no longer needed)
  • Removed xml-simple gem dependency (replaced with rexml)
  • Added rexml and rss as explicit dependencies

Notable Implementation Details

  • The Automatic::Http utility escapes and re-parses URLs with invalid characters (spaces, non-ASCII) rather than raising, improving robustness
  • Security-critical: scheme restriction prevents reading file:///etc/passwd when processing untrusted feed links
  • PublishHatenaBookmark marked as "Needs rework" but transport corrected to HTTPS to prevent password digest exposure
  • PublishAmazonS3 updated to handle S3 schemes (s3, s3n) separately from HTTP
  • Plugin catalogue now verified by automated tests to prevent documentation drift

https://claude.ai/code/session_01PpGaCj366pPvFCa3JX4Dh5

The plugin set shipped with the gem was written between 2012 and 2015 and
had not been reviewed against the services and libraries it talks to. Each
of the forty-five plugins was checked against the current state of its
service, its API and its gem, and the set was reduced to what still has a
use and made to work on Ruby 3.3 through 4.0.

Removed eleven plugins whose service or API no longer exists: the three
Twitter plugins, both Pocket plugins, HipChat, Google Calendar, livedoor
Weather, So-net G-Guide and Chan-Toru, and Google News link rewriting.
Their specs, integration recipes and optional dependencies went with them.
A Recipe naming one now fails at load rather than at runtime, and
doc/PLUGINS.md section 8 records each reason.

Migrated PublishAmazonS3 and the S3 path of StoreFile from AWS SDK for Ruby
v1 to aws-sdk-s3, keeping the Recipe keys and adding an optional region;
both now also accept the SDK's own credential chain, so a bucket can be
reached without a secret in the Recipe. Dropped xml-simple from
CustomFeedSVNLog in favour of REXML, which the framework already depends
on, and nkf from FilterDescriptionLink, whose parser detects an encoding
for itself. PublishHatenaBookmark remains Needs rework -- the service and
its API are current, the WSSE interface it speaks is not -- but no longer
sends a password digest over plain HTTP.

Corrected defects the review turned up: `interval` was never waited,
because the line meant to do it assigned to a local variable named sleep;
FilterDescriptionLink read neither of its settings, because it tested for
Hash and a Recipe produces a Hashie::Mash; FilterAbsoluteURI treated an
https link as relative; PublishMemcached could not take a port written as a
number; FilterTumblrResize and FilterImage did not recognise the URL shapes
those services now use.

Added Automatic::Http, the one way in for what plugins fetch, so that the
scheme allowlist, timeouts and redirect limit are decided once rather than
by omission in seven plugins. A link in a pipeline item comes from a feed,
and URI.open on such a string would read a local file as readily as an
article.

Every Supported plugin now has deterministic local tests that reach no
network and need no credential, and a spec holds doc/PLUGINS.md and README
to the files in plugins/, so a catalogue entry or a count cannot drift.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PpGaCj366pPvFCa3JX4Dh5
@id774
id774 merged commit 2dc5229 into master Aug 15, 2026
8 checks passed
@id774
id774 deleted the claude/automatic-ruby-plugin-modernize-mtokxm branch August 15, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants