accumulated fixes and improvements from neodb#44
Open
alphatownsman wants to merge 1 commit into
Open
Conversation
abdec60 to
2cd26de
Compare
Aggregated, NeoDB-agnostic changes accumulated on neodb-social/neodb-incarnator
since upstream/main diverged. Reviewable as a single squash; happy to split per
maintainer preference.
ActivityPub compatibility
- accept list-form attributedTo (WriteFreely blog Articles)
- follow Link rel=alternate to resolve AP Article URLs
- only accept URL-shaped quote values (validate scheme and length)
- give identity Update/Delete/Move activities unique IDs (deduplication)
- serve QuoteAuthorization at a dereferenceable URL (FEP-044f):
new QuoteAuthorization model + view + migration
- treat image-only Notes as Posts instead of Interactions
- skip emoji tag ingestion when author has no domain
- handle vote-type in PostInteraction undo to prevent ValueError
- validate URI scheme before fetching posts and replies
- return 400 (VerificationFormatError) for unparseable HTTP signatures
- use ActivityPubError subtypes for invalid inbound activities
(ActorMismatchError / ActivityPubFormatError instead of ValueError)
- coalesce list-typed poll option name to string (pl.fediverse.pl)
- expose federation.enabled in nodeinfo metadata (FEP-0151)
Security
- add SSRF protection to all outbound HTTP requests
(core.files.check_url_safety + SSRFAttemptError, attached via httpx
event_hooks so redirect hops are also checked)
- enforce CSRF verification for session-authenticated API requests
- harden OAuth token exchange against error leak and timing attack
(constant-time compare for client_id/secret, single-shot code lookup)
- use safer URL-redirection sanitizers (_safe_remote_redirect) so CodeQL
recognises the sanitiser pattern
- treat DNS resolution failures as httpx.ConnectError instead of
SSRFAttemptError so logs are less noisy
Performance
- partial index on TimelineEvent(identity, -id) WHERE NOT dismissed; bell
follows matched by target_id, not Follow id; avoid OR-subquery in
notification queries
- collapse Hashtag stator stats into 2 queries
- use timestamp ranges in Hashtag stat filters (avoid per-row
AT TIME ZONE / EXTRACT casts)
Robustness
- translate ClearTimeline deadlocks to TryAgainLater so Stator silently
reschedules instead of logging OperationalError
- bump sentry-sdk
Article rendering
- preserve full AS Article on inbound by storing type_data = {"object": data}
so name/summary/source survive (the old ArticleData parse with
extra="ignore" dropped them)
- add templates/activities/_type_article.html so Article posts render as
title + body instead of falling through to the unknown-type path
Tests
- QuoteAuthorization, list-form attributedTo, search URL with
Link rel=alternate fallback, Article type_data shape, ClearTimeline
deadlock translation, json edge cases, identity RSS feed (with quote link)
2cd26de to
3068808
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main fix is QuoteAuthorization which was incomplete in previous implementation.
ActivityPub compatibility
Security
Performance
Robustness