web: allow direct IP dashboard and worker access (#26)
Support direct HTTP IP access on port 5187 without hostname registration or a required proxy. Preserve dashboard/machine authentication and CSRF checks. Update Proxmox setup, D14, tests and documentation for 1.2.3. Closes #25
This commit was merged in pull request #26.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using FinalToken.Fleet;
|
||||
using Xunit;
|
||||
|
||||
namespace FinalToken.Fleet.Tests;
|
||||
|
||||
public sealed class OriginTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("http://10.0.30.150:5187")]
|
||||
[InlineData("https://10.0.30.150")]
|
||||
[InlineData("http://[2001:db8::5]:5187/")]
|
||||
[InlineData("https://usage.example.test/")]
|
||||
public void AcceptHttpAndHttpsOrigins(string value) => Assert.True(FleetValidation.TryHttpOrigin(value, out _));
|
||||
|
||||
[Theory]
|
||||
[InlineData("ftp://10.0.30.150")]
|
||||
[InlineData("http://" + "synthetic-user:[email protected]")]
|
||||
[InlineData("http://10.0.30.150/path")]
|
||||
[InlineData("http://10.0.30.150/?key=value")]
|
||||
[InlineData("http://10.0.30.150/#fragment")]
|
||||
[InlineData("not an origin")]
|
||||
[InlineData(null)]
|
||||
public void RejectNonOrigins(string? value) => Assert.False(FleetValidation.TryHttpOrigin(value, out _));
|
||||
|
||||
[Theory]
|
||||
[InlineData("http://10.0.30.150:5187", "10.0.30.150:5187", true)]
|
||||
[InlineData("https://usage.example.test", "USAGE.EXAMPLE.TEST:443", true)]
|
||||
[InlineData("http://[2001:db8::5]:5187", "[2001:db8::5]:5187", true)]
|
||||
[InlineData("http://10.0.30.150:5187", "10.0.30.150:5188", false)]
|
||||
[InlineData("http://evil.example.test", "10.0.30.150:5187", false)]
|
||||
public void BrowserOriginMustMatchActualRequestHost(string value, string host, bool matches) =>
|
||||
Assert.Equal(matches, FleetValidation.MatchesRequestHost(new Uri(value), host));
|
||||
}
|
||||
Reference in New Issue
Block a user