Files
Ricardo 12454749ad fix: comprehensive security, performance, and architecture audit fixes
27 issues fixed from multi-dimensional code review (4 Critical, 6 High, 11 Medium, 6 Low):

Security (Critical):
- Escape HTML in OAuth authorization page to prevent XSS (C1)
- Add CSRF protection to OAuth authorize flow (C2)
- Replace bypassable regex sanitizer with sanitize-html library (C3)
- Enforce OAuth scopes on all Mastodon API routes (C4)

Security (Medium/Low):
- Fix SSRF via DNS resolution before private IP check (M1)
- Add rate limiting to API, auth, and app registration endpoints (M2)
- Validate redirect_uri on POST /oauth/authorize (M4)
- Fix custom emoji URL injection with scheme validation + escaping (M5)
- Remove data: scheme from allowed image sources (L6)
- Add access token expiry (1hr) and refresh token rotation (90d) (M3)
- Hash client secrets before storage (L3)

Architecture:
- Extract batch-broadcast.js — shared delivery logic (H1a)
- Extract init-indexes.js — MongoDB index creation (H1b)
- Extract syndicator.js — syndication logic (H1c)
- Create federation-actions.js facade for controllers (M6)
- index.js reduced from 1810 to ~1169 lines (35%)

Performance:
- Cache moderation data with 30s TTL + write invalidation (H6)
- Increase inbox queue throughput to 10 items/sec (H5)
- Make account enrichment non-blocking with fire-and-forget (H4)
- Remove ephemeral getReplies/getLikes/getShares from ingest (M11)
- Fix LRU caches to use true LRU eviction (L1)
- Fix N+1 backfill queries with batch $in lookup (L2)

UI/UX:
- Split 3441-line reader.css into 15 feature-scoped files (H2)
- Extract inline Alpine.js interaction component (H3)
- Reduce sidebar navigation from 7 to 3 items (M7)
- Add ARIA live regions for dynamic content updates (M8)
- Extract shared CW/non-CW content partial (M9)
- Document form handling pattern convention (M10)
- Add accessible labels to functional emoji icons (L4)
- Convert profile editor to Alpine.js (L5)

Audit: documentation-central/audits/2026-03-24-activitypub-code-review.md
Plan: documentation-central/plans/2026-03-24-activitypub-audit-fixes.md
2026-03-25 07:41:20 +01:00

159 lines
3.2 KiB
CSS

/* ==========================================================================
Messages
========================================================================== */
.ap-messages__layout {
display: grid;
grid-template-columns: 240px 1fr;
gap: var(--space-m);
min-height: 300px;
}
.ap-messages__sidebar {
border-right: var(--border-width-thin) solid var(--color-outline);
display: flex;
flex-direction: column;
gap: 2px;
padding-right: var(--space-m);
overflow-y: auto;
max-height: 70vh;
}
.ap-messages__partner {
align-items: center;
border-radius: var(--border-radius-small);
color: var(--color-on-background);
display: flex;
gap: var(--space-s);
padding: var(--space-s);
text-decoration: none;
transition: background 0.15s ease;
}
.ap-messages__partner:hover {
background: var(--color-offset);
}
.ap-messages__partner--active {
background: var(--color-offset);
border-left: 3px solid var(--color-primary);
font-weight: var(--font-weight-bold);
}
.ap-messages__partner-avatar {
flex-shrink: 0;
height: 32px;
position: relative;
width: 32px;
}
.ap-messages__partner-avatar img {
border-radius: 50%;
height: 100%;
object-fit: cover;
position: absolute;
inset: 0;
width: 100%;
z-index: 1;
}
.ap-messages__partner-initial {
align-items: center;
background: var(--color-offset-variant);
border-radius: 50%;
color: var(--color-on-offset);
display: flex;
font-size: var(--font-size-s);
height: 100%;
justify-content: center;
width: 100%;
}
.ap-messages__partner-info {
display: flex;
flex-direction: column;
min-width: 0;
overflow: hidden;
}
.ap-messages__partner-name {
font-size: var(--font-size-s);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ap-messages__partner-handle {
color: var(--color-on-offset);
font-size: var(--font-size-xs);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ap-messages__content {
min-width: 0;
}
.ap-message--outbound {
border-left: 3px solid var(--color-primary);
}
.ap-message .ap-notification__time {
padding-right: var(--space-l);
}
.ap-message__direction {
color: var(--color-on-offset);
font-size: var(--font-size-s);
margin-right: var(--space-xs);
}
.ap-message__content {
color: var(--color-on-background);
font-size: var(--font-size-s);
line-height: 1.5;
margin-top: var(--space-xs);
}
.ap-message__content p {
margin: 0 0 var(--space-xs);
}
.ap-message__content p:last-child {
margin-bottom: 0;
}
/* Inline mention links in DM content (Mastodon wraps @user in span inside a link) */
.ap-message__content .h-card,
.ap-message__content a.mention,
.ap-message__content a span {
display: inline;
}
.ap-message__content a {
overflow-wrap: break-word;
}
@media (max-width: 640px) {
.ap-messages__layout {
grid-template-columns: 1fr;
}
.ap-messages__sidebar {
border-bottom: var(--border-width-thin) solid var(--color-outline);
border-right: none;
flex-direction: row;
max-height: none;
overflow-x: auto;
padding-bottom: var(--space-s);
padding-right: 0;
-webkit-overflow-scrolling: touch;
}
.ap-messages__partner {
flex-shrink: 0;
white-space: nowrap;
}
}