Defer upstream scheme repair after live proxy verification

This commit is contained in:
Nick Beckley 2026-11-03 20:58:10 +00:00
parent ee9bbec4e4
commit 5a969eb6e6
5 changed files with 11 additions and 82 deletions

View File

@ -17,13 +17,13 @@
2. Completed: B2 compact Locations drag controls and PWA width.
3. Completed: B3 clickable project/book covers and titles.
4. Completed: B4 retire obsolete Phase 1 Checklist safely.
5. Completed: C shared workspace resizing and maximisation.
6. Completed: targeted D UX audit and repairs.
7. Completed: E Floor Plans save reliability repairs.
8. Completed: F trusted-proxy scheme repair and export/restore access review.
9. Completed: G regression expansion and final full harness.
10. Completed: H public site and Writing Problem Solver SEO.
11. In progress: final gates, trusted-proxy follow-up Development deployment and handover.
5. In progress: C shared workspace resizing and maximisation, starting with Relationships reference.
6. D UX audit and repairs.
7. E functional reliability repairs.
8. F security and data integrity audit and safe repairs.
9. G regression expansion.
10. H public site and Writing Problem Solver SEO.
11. Final gates, safe Development deployment and handover.
## Improvements and evidence
@ -109,20 +109,10 @@ Reproduced two data-loss risks in the real editor fixture: (1) a save redirected
Verification: both failures were reproduced by the new browser test before repair. Build passed (0 warnings/errors). Browser/PWA save tests passed for redirects, malformed/null payloads, server rejection, valid acknowledgement, preserved blocks, navigation protection and concurrent edits followed by their own autosave. All-editor resizing regression passed again. Full harness rerun in progress. Restore-visibility follow-up commit: 86509cb.
## Current checkpoint
### Deferred infrastructure finding — Development login redirect scheme
- Eleven verified implementation/test commits through 2f99a3c; all deployed to Development as 2f99a3c-20261103205138.
- Deployed and published PlotLine.dll SHA-256: b846ccec583652930e60b85131bbf5f3f89dafa7f762a9c1a1c128588a8c4694. Deployed metadata: .NETCoreApp v10.0, 13,825,536 bytes.
- Local and public Development GETs: 200. Protected Locations route requires login (302). No recent service warning/error logs.
- Background-work gate passed immediately before restart. Application backup: /srv/apps/plotdirector-dev/current-before-2f99a3c-20261103205138. Configuration, uploads, App_Data, logs preserved. No database writes/migrations and no Production deployment.
- Full harness after Floor Plans repair passed. Read-only live mobile browser audit passed for 56 public pages (all 52 solutions plus homepage, tour, solver and browse): HTTP 200, no horizontal overflow at 390px and no unnamed anchor findings.
- A temporary-storage quota interrupted a publish. Removed only sprint-owned superseded/incomplete publish directories and republished successfully outside /tmp. The failed publish was never deployed.
- Current task: HTTPS proxy-scheme repair. Protected HTTPS route redirected via HTTP; nginx sends X-Forwarded-Proto but app did not consume it. Added default loopback-trusted, one-hop scheme handling without forwarded-host trust. Build passed (0 warnings/errors); full harness passed, including real cookie challenge middleware tests for trusted/untrusted proxies.
- Next action: confirm final harness, commit proxy fix, fresh Release publish, recheck idle background queues, deploy to Development, verify HTTPS login redirect and hashes, complete handover.
- Live authenticated screen verification has not been claimed: no reusable authenticated Development session was available. Full editor interaction checks use isolated real Razor fixtures; live route checks verify authentication redirects.
Live protected HTTPS requests redirect through an HTTP login URL. Development nginx listens on HTTP behind a separate TLS proxy and overwrites X-Forwarded-Proto with its local http scheme. The application-only loopback forwarded-header attempt passed middleware tests and direct loopback checks, but did not fix the public route because the original scheme has already been discarded upstream. Reverted that attempt after live verification failed; no widened proxy trust or upstream-host changes performed.
### F follow-up — HTTPS login redirects behind the trusted proxy
Next action for infrastructure review: verify the TLS proxy's forwarded scheme and trusted source addresses, then preserve that scheme at the Development origin with a narrowly trusted configuration. Existing cookies remain Secure, and the edge upgrades HTTP. This is the only deferred confirmed defect. No Production configuration was accessed or modified.
Live Development smoke testing reproduced an HTTPS protected route redirecting to http://dev.plotdirector.com/Account/Login. nginx already supplies X-Forwarded-Proto; added scheme-only forwarded-header handling before HTTPS/authentication middleware. Retained framework loopback-only proxy trust and one-hop limit; forwarded hosts remain ignored. Secure cookie policy is unchanged.
Verification: solution build passed with 0 warnings/errors and full harness passed. Regression exercises actual forwarded-header and cookie authentication middleware, requiring HTTPS redirects for IPv4/IPv6 loopback proxies while rejecting scheme spoofing from an untrusted remote client and ignoring forwarded hosts. Development redeployment and live redirect verification pending.
The ee9bbec deployment briefly contained the application-only attempt; final deployment will restore the fully verified application behaviour while retaining all sprint improvements through 2f99a3c. No user data or schema changed.

View File

@ -123,7 +123,6 @@ var tests = new (string Name, Action Test)[]
("Writing Solver anonymous state is protected, expires and rejects stale versions", WritingSolverTests.AnonymousState),
("Writing Solver scoring, multi-select, revision, fallback and graph routes", WritingSolverTests.RoutingAndRevision),
("Writing Solver import rejects invalid graphs and editorial identities", WritingSolverTests.Validation),
("Login redirects respect only trusted loopback proxy schemes", TrustedProxySchemeTests.LoginRedirectScheme),
("Project export and restore access gates enforce author and ownership boundaries", ProjectAccessRegressionTests.FilterBoundaries),
("Retired checklist bookmarks redirect without report access", LegacyAcceptanceTests.RedirectsWithoutReporting),
("Ribbon operation identity and semantic icons stay consistent", RibbonPresentationTests.SemanticMetadata),

View File

@ -1,44 +0,0 @@
using System.Net;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using PlotLine.Services;
internal static class TrustedProxySchemeTests
{
public static void LoginRedirectScheme() => Run().GetAwaiter().GetResult();
private static async Task Run()
{
using var services = new ServiceCollection().AddLogging().AddOptions()
.AddAuthentication("Test").AddCookie("Test", options => {
options.LoginPath = "/Account/Login";
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
}).Services.BuildServiceProvider();
var builder = new ApplicationBuilder(services);
builder.UseTrustedProxyScheme();
builder.UseAuthentication();
builder.Run(context => context.ChallengeAsync("Test"));
var pipeline = builder.Build();
foreach (var (remote, forwarded, expected) in new[] {
(IPAddress.Loopback, "https", "https"),
(IPAddress.IPv6Loopback, "https", "https"),
(IPAddress.Loopback, "http", "http"),
(IPAddress.Parse("203.0.113.10"), "https", "http")
})
{
using var requestScope = services.CreateScope();
var context = new DefaultHttpContext { RequestServices = requestScope.ServiceProvider };
context.Connection.RemoteIpAddress = remote;
context.Request.Scheme = "http";
context.Request.Host = new HostString("dev.plotdirector.test");
context.Request.Path = "/private";
context.Request.Headers["X-Forwarded-Proto"] = forwarded;
context.Request.Headers["X-Forwarded-Host"] = "untrusted.example";
await pipeline(context);
var location = context.Response.Headers.Location.ToString();
if (context.Response.StatusCode != 302 || !location.StartsWith(expected + "://dev.plotdirector.test/Account/Login?", StringComparison.Ordinal))
throw new Exception("Login redirects must preserve the trusted proxy scheme and ignore untrusted forwarded headers.");
}
}
}

View File

@ -302,8 +302,6 @@ public class Program
var app = builder.Build();
app.UseTrustedProxyScheme();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");

View File

@ -1,14 +0,0 @@
using Microsoft.AspNetCore.HttpOverrides;
namespace PlotLine.Services;
public static class TrustedProxyScheme
{
public static IApplicationBuilder UseTrustedProxyScheme(this IApplicationBuilder app) =>
// Keep the framework's loopback proxy trust and one-hop limit. Do not
// accept forwarded hosts or broaden trust to arbitrary remote clients.
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedProto
});
}