Skip to content

Commit 2a14aae

Browse files
committed
Remove ssrf_filter dependency
1 parent 49074ef commit 2a14aae

10 files changed

Lines changed: 34 additions & 21 deletions

File tree

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ gem 'parallel'
1616
gem 'rack-cache'
1717
gem 'rack-timeout'
1818
gem 'roda'
19-
gem 'ssrf_filter'
2019
gem 'zeitwerk'
2120

2221
gem 'puma', require: false

Gemfile.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ GEM
333333
simplecov_json_formatter (~> 0.1)
334334
simplecov-html (0.13.2)
335335
simplecov_json_formatter (0.1.4)
336-
ssrf_filter (1.3.0)
337336
stackprof (0.2.28)
338337
thor (1.5.0)
339338
traces (0.18.2)
@@ -386,7 +385,6 @@ DEPENDENCIES
386385
ruby-lsp
387386
sentry-ruby
388387
simplecov
389-
ssrf_filter
390388
stackprof
391389
vcr
392390
webmock
@@ -513,7 +511,6 @@ CHECKSUMS
513511
simplecov (0.22.0) sha256=fe2622c7834ff23b98066bb0a854284b2729a569ac659f82621fc22ef36213a5
514512
simplecov-html (0.13.2) sha256=bd0b8e54e7c2d7685927e8d6286466359b6f16b18cb0df47b508e8d73c777246
515513
simplecov_json_formatter (0.1.4) sha256=529418fbe8de1713ac2b2d612aa3daa56d316975d307244399fa4838c601b428
516-
ssrf_filter (1.3.0) sha256=66882d7de7d09c019098d6d7372412950ae184ebbc7c51478002058307aba6f2
517514
stackprof (0.2.28) sha256=4ec2ace02f386012b40ca20ef80c030ad711831f59511da12e83b34efb0f9a04
518515
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
519516
traces (0.18.2) sha256=80f1649cb4daace1d7174b81f3b3b7427af0b93047759ba349960cb8f315e214

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ html2rss-web converts arbitrary websites into RSS 2.0 feeds with a slim Ruby bac
1515
- Responsive Preact interface for demo, sign-in, conversion, and result flows.
1616
- Automatic source discovery with token-scoped permissions.
1717
- Signed public feed URLs that work in standard RSS readers.
18-
- Built-in SSRF defences, input validation, and HMAC-protected tokens.
18+
- Built-in URL validation, scoped feed access controls, and HMAC-protected tokens.
1919

2020
## Architecture
2121

app/web/config/local_config.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ def embedded_feed_config(normalized_name)
9797
deep_dup(Html2rss::Configs.find_by_name(normalized_name))
9898
rescue Html2rss::Configs::ConfigNotFound
9999
nil
100-
rescue RuntimeError => e
101-
return nil if e.message == 'name must be in folder/file format'
100+
rescue RuntimeError => error
101+
return nil if error.message == 'name must be in folder/file format'
102102

103103
raise
104104
end

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Frontend verification lives at `http://127.0.0.1:4001/` while the dev container
4848
- Keep route composition in `app/web/routes/**`.
4949
- Keep `/api/v1` contract-specific code in `app/web/api/**`.
5050
- Keep feed fetching, caching, and orchestration in `app/web/feeds/**`.
51-
- Keep auth, token handling, SSRF strategy, and security logging in `app/web/security/**`.
51+
- Keep auth, token handling, URL validation, and security logging in `app/web/security/**`.
5252
- Keep request-scoped context in `app/web/request/**`.
5353
- Keep boot/runtime setup in `app/web/boot/**`.
5454
- Do not create generic buckets such as `services`, `helpers`, `utils`, or `concerns`.

frontend/src/__tests__/useFeedConversion.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ describe('useFeedConversion', () => {
7777
const { result } = renderHook(() => useFeedConversion());
7878

7979
await act(async () => {
80-
await expect(
81-
result.current.convertFeed('https://example.com', 'faraday', 'testtoken')
82-
).rejects.toThrow('Bad Request');
80+
await expect(result.current.convertFeed('https://example.com', 'faraday', 'testtoken')).rejects.toThrow(
81+
'Bad Request'
82+
);
8383
});
8484

8585
expect(result.current.isConverting).toBe(false);
@@ -93,9 +93,9 @@ describe('useFeedConversion', () => {
9393
const { result } = renderHook(() => useFeedConversion());
9494

9595
await act(async () => {
96-
await expect(
97-
result.current.convertFeed('https://example.com', 'faraday', 'testtoken')
98-
).rejects.toThrow('Network error');
96+
await expect(result.current.convertFeed('https://example.com', 'faraday', 'testtoken')).rejects.toThrow(
97+
'Network error'
98+
);
9999
});
100100

101101
expect(result.current.isConverting).toBe(false);

frontend/src/components/AppPanels.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ export function CreateFeedPanel({
158158
</p>
159159
))}
160160
<p>
161-
<a href="https://html2rss.github.io/web-application/how-to/use-included-configs/" target="_blank" rel="noopener noreferrer">
161+
<a
162+
href="https://html2rss.github.io/web-application/how-to/use-included-configs/"
163+
target="_blank"
164+
rel="noopener noreferrer"
165+
>
162166
Learn how included configs work.
163167
</a>
164168
</p>

spec/html2rss/web/app_spec.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def app = described_class
160160

161161
get '/missing-feed'
162162

163-
expect(last_response.status).to eq(500)
163+
expect(last_response.status).to eq(404)
164164
expect(last_response.headers['Content-Type']).to eq('application/xml')
165165
expect(last_response.body).to eq('<error/>')
166166
end
@@ -169,8 +169,15 @@ def app = described_class
169169
get '/missing-feed.json'
170170

171171
expect(json_feed_error_tuple).to eq(
172-
[500, 'application/feed+json', { 'version' => 'https://jsonfeed.org/version/1.1', 'title' => 'Error',
173-
'description' => 'Failed to generate feed: Internal Server Error' }]
172+
[
173+
404,
174+
'application/feed+json',
175+
{
176+
'version' => 'https://jsonfeed.org/version/1.1',
177+
'title' => 'Error',
178+
'description' => "Failed to generate feed: Feed 'missing-feed' is not available on this instance"
179+
}
180+
]
174181
)
175182
end
176183

spec/html2rss/web/feeds/source_resolver_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ def resolved_tuple(resolved)
6262
end
6363

6464
it 'returns a not-found error when the static feed is unavailable' do
65-
allow(Html2rss::Web::LocalConfig).to receive(:find).with('legacy')
65+
allow(Html2rss::Web::LocalConfig)
66+
.to receive(:find)
67+
.with('legacy')
6668
.and_raise(Html2rss::Web::LocalConfig::NotFound, 'missing')
6769

6870
expect { described_class.call(feed_request) }

spec/html2rss/web/local_config_spec.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,13 @@ def titles_for(*names)
2323
end
2424

2525
it 'falls back to embedded configs when the feed is not in local yaml' do
26-
stub_const('Html2rss::Configs', Module.new)
26+
stub_const('Html2rss::Configs', Module.new do
27+
def self.find_by_name(_name); end
28+
end)
2729
stub_const('Html2rss::Configs::ConfigNotFound', Class.new(StandardError))
28-
allow(Html2rss::Configs).to receive(:find_by_name).with('support.apple.com/en_gb_ht201222')
30+
allow(Html2rss::Configs)
31+
.to receive(:find_by_name)
32+
.with('support.apple.com/en_gb_ht201222')
2933
.and_return({ channel: { title: 'Apple security releases' } })
3034
allow(described_class).to receive(:snapshot)
3135
.and_return(Html2rss::Web::ConfigSnapshot::Snapshot.new(global: {}, feeds: {}, accounts: []))

0 commit comments

Comments
 (0)