14 lines
798 B
JavaScript
14 lines
798 B
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { sameOriginUpgrade } from "../src/proxySecurity.js";
|
|
|
|
test("the authenticated proxy checks Origin before discarding it upstream", () => {
|
|
assert.equal(sameOriginUpgrade("http://localhost:8095", "localhost:8095"), true);
|
|
assert.equal(sameOriginUpgrade("https://pipelines.example", "pipelines.example"), true);
|
|
assert.equal(sameOriginUpgrade("https://untrusted.example", "pipelines.example"), false);
|
|
assert.equal(sameOriginUpgrade("http://localhost:8094", "localhost:8095"), false);
|
|
assert.equal(sameOriginUpgrade("null", "localhost:8095"), false);
|
|
assert.equal(sameOriginUpgrade("file:///report.html", "localhost:8095"), false);
|
|
assert.equal(sameOriginUpgrade(undefined, "localhost:8095"), true);
|
|
});
|