mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-12-06 16:22:15 +00:00
test(integration): add canary routes that prove filtered requests never leave
This commit is contained in:
@@ -48,7 +48,7 @@ Available tags:
|
||||
|
||||
- `I have a default Gotenberg container`
|
||||
- `I have a Gotenberg container with the following environment variable(s):` (table: key | value)
|
||||
- `I have a (webhook|static) server`: one helper server per scenario, whichever word is used; a second step reuses it. Besides the webhook and file routes, it answers RFC 3161 timestamp requests at `{helper}/tsa`, and never answers `{helper}/slow`, for timeouts
|
||||
- `I have a (webhook|static) server`: one helper server per scenario, whichever word is used; a second step reuses it. Besides the webhook and file routes, it answers RFC 3161 timestamp requests at `{helper}/tsa`, and never answers `{helper}/slow`, for timeouts. Its canary routes check that a filter refuses a request before it leaves: `{helper}/canary/<anything>` records every request it receives, whatever its method, `{helper}/canary-redirect/<anything>` redirects to `{helper}/canary/<anything>`, and `{helper}/canary-page/testdata/<path>` serves a fixture with each `{canary}` token replaced by `{helper}/canary`, as Gotenberg reaches it (fixtures cannot hold the helper URL, whose port changes with every scenario)
|
||||
|
||||
### When (action)
|
||||
|
||||
@@ -102,6 +102,7 @@ Available tags:
|
||||
- `all concurrent responses should have <N> PDF(s)`
|
||||
- `at least one concurrent response status code should be <code>`
|
||||
- `the (webhook request|file request|server request) method should be "<method>"`
|
||||
- `the helper server (should|should NOT) have received a canary request` (any request to `{helper}/canary/`; pair a `should NOT` with a control scenario that proves the canary is reachable)
|
||||
- `all sequential response status codes should be <code>`
|
||||
- `all probe response status codes should be <code>`
|
||||
- `the "<name>" image should be <width>x<height> pixels`
|
||||
|
||||
@@ -590,6 +590,45 @@ Feature: /forms/chromium/convert/html
|
||||
| Page.printToPDF |
|
||||
| --chromium-debug-protocol (CHROMIUM_DEBUG_PROTOCOL) logs every DevTools |
|
||||
|
||||
# Chromium renders header.html and footer.html as print templates, apart
|
||||
# from the page, and loads none of their network resources: no image,
|
||||
# background, script, frame or fetch reaches the helper server, even with
|
||||
# no filter configured. The page's own canary scenarios prove that
|
||||
# Chromium reaches the helper server, and the rendered header proves that
|
||||
# the downloaded template is in use. Should a Chromium upgrade start
|
||||
# loading template resources, this scenario fails before anyone assumes
|
||||
# the outbound filters cover them.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/html (Canary resources in the header and footer never leave)
|
||||
Given I have a static server
|
||||
Given I have a default Gotenberg container
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
|
||||
| files | testdata/page-1-html/index.html | file |
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-header-footer/header.html"},{"url":"{helper}/canary-page/testdata/canary-header-footer/footer.html"}] | field |
|
||||
| marginTop | 1 | field |
|
||||
| marginBottom | 1 | field |
|
||||
| Gotenberg-Output-Filename | foo | header |
|
||||
Then the response status code should be 200
|
||||
Then the "foo.pdf" PDF should have content matching "Canary header" at page 1, artifacts included
|
||||
Then the "foo.pdf" PDF should have content matching "Canary footer" at page 1, artifacts included
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# A style sheet a print template links fails the print instead of loading:
|
||||
# the request never reaches the helper server. @font-face behaves the same.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/html (Canary style sheet in the header fails the print, never leaves)
|
||||
Given I have a static server
|
||||
Given I have a default Gotenberg container
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/html" endpoint with the following form data and header(s):
|
||||
| files | testdata/page-1-html/index.html | file |
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-header-stylesheet/header.html"}] | field |
|
||||
Then the response status code should be 400
|
||||
Then the response body should match string:
|
||||
"""
|
||||
Chromium failed to print the PDF; this usually happens when the page is too large
|
||||
"""
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# Control for the WebSocket scenario below. An ordinary fetch to a loopback
|
||||
# address is surfaced as a Fetch.requestPaused event, so it is blocked by
|
||||
# CHROMIUM_DENY_PRIVATE_IPS and the block is logged. The allow-list is
|
||||
|
||||
@@ -471,6 +471,87 @@ Feature: /forms/chromium/convert/url
|
||||
Then the Gotenberg container should log the following entries:
|
||||
| "url":"http://127.0.0.1:9999/redirected","rule":"allow-list" |
|
||||
|
||||
# Control for the canary scenarios below: with no filter in the way, the
|
||||
# canary page's resources reach the helper server. Without it, a canary
|
||||
# that stays silent could mean a broken page, not a working filter.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Canary resources load when no filter refuses them)
|
||||
Given I have a static server
|
||||
Given I have a default Gotenberg container
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary-page/testdata/canary-html/index.html | field |
|
||||
| waitDelay | 1s | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should have received a canary request
|
||||
|
||||
# The deny-list names every canary resource: style sheet, script, font,
|
||||
# background, image, frame, fetch, XHR, beacon and EventSource. A logged
|
||||
# refusal is not enough; none of them may reach the helper server.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Canary resources in the deny-list never leave)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_DENY_LIST | ^http://{helper-host}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary-page/testdata/canary-html/index.html | field |
|
||||
| waitDelay | 1s | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# Pins a known limitation. The pinning proxy sees only the host and port of
|
||||
# a WebSocket tunnel, so a deny-list rule that names a path cannot sever the
|
||||
# handshake: the conversion fails with a 403, but the handshake has already
|
||||
# reached the target. Flip the last step once the handshake is refused
|
||||
# before it leaves. See listenForEventWebSocketCreated.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Canary WebSocket in a path deny-list rule fails the conversion, after the handshake)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_DENY_LIST | ^ws://{helper-host}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary-page/testdata/canary-websocket-html/index.html | field |
|
||||
| waitDelay | 1s | field |
|
||||
Then the response status code should be 403
|
||||
Then the helper server should have received a canary request
|
||||
|
||||
# The allow-list admits the page but not its WebSocket: the pinning proxy
|
||||
# refuses the tunnel, so the handshake never reaches the helper server.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Canary WebSocket outside the allow-list never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_ALLOW_LIST | ^http://{helper-host}/canary-page/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary-page/testdata/canary-websocket-html/index.html | field |
|
||||
| waitDelay | 1s | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The main URL passes the deny-list, but redirects to one it names. The
|
||||
# redirected request must be refused before it leaves.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Redirect to a canary in the deny-list never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_DENY_LIST | ^http://{helper-host}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary-redirect/main | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The helper server resolves to a non-public address: the main URL must be
|
||||
# refused before Chromium navigates to it.
|
||||
@chromium-ssrf
|
||||
Scenario: POST /forms/chromium/convert/url (Main URL canary on a non-public address never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_ALLOW_LIST | |
|
||||
| CHROMIUM_DENY_PRIVATE_IPS | true |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/chromium/convert/url" endpoint with the following form data and header(s):
|
||||
| url | {helper}/canary/main | field |
|
||||
Then the response status code should be 403
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
Scenario: POST /forms/chromium/convert/url (Main URL resolves to a non-public IP, deny-private-ips on with allow-list bypass)
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| CHROMIUM_ALLOW_LIST | .+ |
|
||||
|
||||
@@ -1291,6 +1291,65 @@ Feature: /forms/libreoffice/convert
|
||||
Then there should be 1 PDF(s) in the response
|
||||
Then the "foo.pdf" PDF should have 0 image(s)
|
||||
|
||||
# Control for the canary scenarios below: with no filter in the way,
|
||||
# LibreOffice requests the style sheet an HTML document links. Without it,
|
||||
# a canary that stays silent could mean LibreOffice never tried.
|
||||
@libreoffice-ssrf
|
||||
Scenario: POST /forms/libreoffice/convert (Canary style sheet loads when no filter refuses it)
|
||||
Given I have a static server
|
||||
Given I have a default Gotenberg container
|
||||
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-libreoffice/index.html"}] | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should have received a canary request
|
||||
|
||||
@libreoffice-ssrf
|
||||
Scenario: POST /forms/libreoffice/convert (Canary in the deny-list never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| LIBREOFFICE_DENY_LIST | ^{helper}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-libreoffice/index.html"}] | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The helper server resolves to a non-public address. An allow-list match
|
||||
# would bypass the check: none here.
|
||||
@libreoffice-ssrf
|
||||
Scenario: POST /forms/libreoffice/convert (Canary on a non-public address never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| LIBREOFFICE_ALLOW_LIST | |
|
||||
| LIBREOFFICE_DENY_PRIVATE_IPS | true |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-libreoffice/index.html"}] | field |
|
||||
Then the response status code should be 200
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# An uploaded document loads from an untrusted location, so LibreOffice
|
||||
# refuses an image it links by URL, with no filter configured.
|
||||
@libreoffice-ssrf
|
||||
Scenario: POST /forms/libreoffice/convert (Canary image linked by URL never leaves)
|
||||
Given I have a static server
|
||||
Given I have a default Gotenberg container
|
||||
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
|
||||
| downloadFrom | [{"url":"{helper}/canary-page/testdata/canary-libreoffice/linked-image.fodt"}] | field |
|
||||
| Gotenberg-Output-Filename | foo | header |
|
||||
Then the response status code should be 200
|
||||
Then the "foo.pdf" PDF should have 0 image(s)
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The deny-list names the download URL itself.
|
||||
@download-from
|
||||
Scenario: POST /forms/libreoffice/convert (Download From canary in the deny-list never leaves)
|
||||
Given I have a static server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| API_DOWNLOAD_FROM_DENY_LIST | ^{helper}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/libreoffice/convert" endpoint with the following form data and header(s):
|
||||
| downloadFrom | [{"url":"{helper}/canary/page_1.docx"}] | field |
|
||||
Then the response status code should be 403
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The workbook was saved scrolled down to row 37. Without the topLeftCell
|
||||
# reset, singlePage would start the page there and drop the header rows,
|
||||
# so the "Meteor" column header only appears when the whole sheet is rendered.
|
||||
|
||||
@@ -230,20 +230,22 @@ Feature: Webhook
|
||||
"""
|
||||
|
||||
# The outbound filter refuses a webhook URL the deny-list names, even when
|
||||
# the allow-list matches every URL. A refusal stays generic for the client.
|
||||
# the allow-list matches every URL. A refusal stays generic for the client,
|
||||
# and neither the output nor the event reaches the canaries.
|
||||
Scenario: Webhook URL In The Deny-List
|
||||
Given I have a webhook server
|
||||
Given I have a Gotenberg container with the following environment variable(s):
|
||||
| WEBHOOK_DENY_LIST | ^{helper}/webhook$ |
|
||||
| WEBHOOK_DENY_LIST | ^{helper}/canary/ |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/pdf/flatten-form" endpoint with the following form data and header(s):
|
||||
| files | testdata/page_1.pdf | file |
|
||||
| Gotenberg-Webhook-Url | {helper}/webhook | header |
|
||||
| Gotenberg-Webhook-Events-Url | {helper}/webhook/events | header |
|
||||
| Gotenberg-Webhook-Url | {helper}/canary/webhook | header |
|
||||
| Gotenberg-Webhook-Events-Url | {helper}/canary/events | header |
|
||||
Then the response status code should be 403
|
||||
Then the response body should match string:
|
||||
"""
|
||||
Forbidden
|
||||
"""
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# The helper server resolves to a non-public address: a private one on Linux,
|
||||
# 0.250.250.254 on Docker Desktop.
|
||||
@@ -254,13 +256,14 @@ Feature: Webhook
|
||||
| WEBHOOK_DENY_PRIVATE_IPS | true |
|
||||
When I make a "POST" request to Gotenberg at the "/forms/pdf/flatten-form" endpoint with the following form data and header(s):
|
||||
| files | testdata/page_1.pdf | file |
|
||||
| Gotenberg-Webhook-Url | {helper}/webhook | header |
|
||||
| Gotenberg-Webhook-Events-Url | {helper}/webhook/events | header |
|
||||
| Gotenberg-Webhook-Url | {helper}/canary/webhook | header |
|
||||
| Gotenberg-Webhook-Events-Url | {helper}/canary/events | header |
|
||||
Then the response status code should be 403
|
||||
Then the response body should match string:
|
||||
"""
|
||||
Forbidden
|
||||
"""
|
||||
Then the helper server should NOT have received a canary request
|
||||
|
||||
# A host that does not resolve is the client's mistake, and says nothing of
|
||||
# the filters. An allow-list match skips the lookup: none here.
|
||||
|
||||
@@ -137,6 +137,7 @@ func InitializeScenario(ctx *godog.ScenarioContext) {
|
||||
ctx.Then(`^all concurrent response status codes should be (\d+)$`, s.allConcurrentResponseStatusCodesShouldBe)
|
||||
ctx.Then(`^at least one concurrent response status code should be (\d+)$`, s.someConcurrentResponseStatusCodeShouldBe)
|
||||
ctx.Then(`^the (webhook request|file request|server request) method should be "([^"]*)"$`, s.theRequestMethodShouldBe)
|
||||
ctx.Then(`^the helper server (should|should NOT) have received a canary request$`, s.theHelperServerShouldHaveReceivedACanaryRequest)
|
||||
ctx.Then(`^all probe response status codes should be (\d+)$`, s.allProbeResponseStatusCodesShouldBe)
|
||||
ctx.Then(`^all sequential response status codes should be (\d+)$`, s.allSequentialResponseStatusCodesShouldBe)
|
||||
ctx.Then(`^all concurrent responses should have (\d+) PDF\(s\)$`, s.allConcurrentResponsesShouldHavePdfs)
|
||||
|
||||
@@ -6,10 +6,12 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math/rand/v2"
|
||||
"mime"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
@@ -51,6 +53,10 @@ type server struct {
|
||||
page *request
|
||||
file *request
|
||||
eventBody []byte
|
||||
// canaries lists, as "METHOD /path", every request that reached /canary/.
|
||||
// A scenario that expects a filter to refuse a URL points it there: the
|
||||
// refusal holds only if the list stays empty.
|
||||
canaries []string
|
||||
|
||||
shutdown context.CancelFunc
|
||||
done chan struct{}
|
||||
@@ -185,6 +191,53 @@ func newServer(ctx context.Context, workdir string) (*server, error) {
|
||||
<-c.Request().Context().Done()
|
||||
return nil
|
||||
})
|
||||
// Canaries. Any request under /canary/ counts, whatever its method, a
|
||||
// WebSocket handshake included, so a filter that logs a refusal but lets
|
||||
// the request through still fails the scenario.
|
||||
srv.Any("/canary/*", func(c *echo.Context) error {
|
||||
r := c.Request()
|
||||
_, err := io.Copy(io.Discard, r.Body)
|
||||
if err != nil {
|
||||
return c.String(http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
|
||||
s.mu.Lock()
|
||||
s.canaries = append(s.canaries, r.Method+" "+r.URL.Path)
|
||||
s.mu.Unlock()
|
||||
|
||||
return c.String(http.StatusOK, "canary")
|
||||
})
|
||||
// A redirect to a canary, for a filter that checks the URL it is given
|
||||
// but must also check where that URL leads.
|
||||
srv.GET("/canary-redirect/*", func(c *echo.Context) error {
|
||||
return c.Redirect(http.StatusFound, "/canary/"+c.Param("*"))
|
||||
})
|
||||
// A testdata file whose "{canary}" tokens become the canary URL, as
|
||||
// Gotenberg reaches it. Fixtures cannot hold that URL themselves, since
|
||||
// the helper port changes with every scenario. No Content-Disposition:
|
||||
// Chromium renders an HTML page instead of downloading it, and
|
||||
// downloadFrom takes the filename from the path.
|
||||
srv.GET("/canary-page/*", func(c *echo.Context) error {
|
||||
path := filepath.Clean(c.Param("*"))
|
||||
if !strings.HasPrefix(path, "testdata/") {
|
||||
return c.String(http.StatusBadRequest, fmt.Sprintf("path %q is not under testdata/", path))
|
||||
}
|
||||
|
||||
b, err := os.ReadFile(filepath.Join(wd, path))
|
||||
if err != nil {
|
||||
return c.String(http.StatusInternalServerError, fmt.Sprintf("read file %q: %s", path, err))
|
||||
}
|
||||
|
||||
canary := fmt.Sprintf("http://%s/canary", c.Request().Host)
|
||||
b = []byte(strings.ReplaceAll(string(b), "{canary}", canary))
|
||||
|
||||
contentType := mime.TypeByExtension(filepath.Ext(path))
|
||||
if contentType == "" {
|
||||
contentType = "application/octet-stream"
|
||||
}
|
||||
|
||||
return c.Blob(http.StatusOK, contentType, b)
|
||||
})
|
||||
|
||||
return s, nil
|
||||
}
|
||||
@@ -291,6 +344,13 @@ func (s *server) received(kind string) (*request, error) {
|
||||
return rec, nil
|
||||
}
|
||||
|
||||
// canaryRequests returns the requests that reached /canary/, oldest first.
|
||||
func (s *server) canaryRequests() []string {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return slices.Clone(s.canaries)
|
||||
}
|
||||
|
||||
func (s *server) getEventBody() []byte {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
@@ -73,6 +73,27 @@ func (s *scenario) theRequestMethodShouldBe(kind, expected string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// theHelperServerShouldHaveReceivedACanaryRequest checks whether a request
|
||||
// reached the helper server's /canary/ routes. A filter's 403 or log line only
|
||||
// tells what Gotenberg decided; an empty canary list tells that no request left.
|
||||
func (s *scenario) theHelperServerShouldHaveReceivedACanaryRequest(should string) error {
|
||||
if s.server == nil {
|
||||
return errors.New("no helper server: add \"I have a webhook server\" before this step")
|
||||
}
|
||||
|
||||
canaries := s.server.canaryRequests()
|
||||
invert := should == "should NOT"
|
||||
|
||||
if invert && len(canaries) > 0 {
|
||||
return fmt.Errorf("expected no canary request, but the helper server received %d: %s", len(canaries), strings.Join(canaries, ", "))
|
||||
}
|
||||
if !invert && len(canaries) == 0 {
|
||||
return errors.New("expected a canary request, but the helper server received none")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *scenario) allConcurrentResponseStatusCodesShouldBe(expected int) error {
|
||||
if len(s.concurrentResps) == 0 {
|
||||
return errors.New("no concurrent responses recorded")
|
||||
|
||||
22
test/integration/testdata/canary-header-footer/footer.html
vendored
Normal file
22
test/integration/testdata/canary-header-footer/footer.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="{canary}/footer.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-size: 8px;
|
||||
margin: 0 16px;
|
||||
background-image: url("{canary}/footer-background.png");
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Canary footer</p>
|
||||
<img src="{canary}/footer-image.png" alt="" width="8" height="8" />
|
||||
<iframe src="{canary}/footer-frame.html"></iframe>
|
||||
<script type="application/javascript">
|
||||
fetch("{canary}/footer-fetch").catch(() => {});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
22
test/integration/testdata/canary-header-footer/header.html
vendored
Normal file
22
test/integration/testdata/canary-header-footer/header.html
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script src="{canary}/header.js"></script>
|
||||
<style>
|
||||
body {
|
||||
font-size: 8px;
|
||||
margin: 0 16px;
|
||||
background-image: url("{canary}/header-background.png");
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>Canary header</p>
|
||||
<img src="{canary}/header-image.png" alt="" width="8" height="8" />
|
||||
<iframe src="{canary}/header-frame.html"></iframe>
|
||||
<script type="application/javascript">
|
||||
fetch("{canary}/header-fetch").catch(() => {});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
10
test/integration/testdata/canary-header-stylesheet/header.html
vendored
Normal file
10
test/integration/testdata/canary-header-stylesheet/header.html
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="{canary}/header.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p>Canary header</p>
|
||||
</body>
|
||||
</html>
|
||||
37
test/integration/testdata/canary-html/index.html
vendored
Normal file
37
test/integration/testdata/canary-html/index.html
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canary</title>
|
||||
<link rel="stylesheet" href="{canary}/style.css" />
|
||||
<script src="{canary}/script.js"></script>
|
||||
<style>
|
||||
@font-face {
|
||||
font-family: "Canary";
|
||||
src: url("{canary}/font.woff2");
|
||||
}
|
||||
body {
|
||||
font-family: "Canary", sans-serif;
|
||||
background-image: url("{canary}/background.png");
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Canary</h1>
|
||||
<p>
|
||||
Every resource of this page points to the helper server's canary routes.
|
||||
The helper server serves it with each canary token replaced by the canary
|
||||
URL, as Gotenberg reaches it.
|
||||
</p>
|
||||
<img src="{canary}/image.png" alt="" />
|
||||
<iframe src="{canary}/frame.html"></iframe>
|
||||
<script type="application/javascript">
|
||||
fetch("{canary}/fetch").catch(() => {});
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "{canary}/xhr");
|
||||
xhr.send();
|
||||
navigator.sendBeacon("{canary}/beacon", "canary");
|
||||
new EventSource("{canary}/eventsource");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
12
test/integration/testdata/canary-libreoffice/index.html
vendored
Normal file
12
test/integration/testdata/canary-libreoffice/index.html
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canary</title>
|
||||
<link rel="stylesheet" href="{canary}/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p>LibreOffice requests the style sheet this page links.</p>
|
||||
<img src="{canary}/image.png" alt="" />
|
||||
</body>
|
||||
</html>
|
||||
7
test/integration/testdata/canary-libreoffice/linked-image.fodt
vendored
Normal file
7
test/integration/testdata/canary-libreoffice/linked-image.fodt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:body><office:text>
|
||||
<text:p>An image linked by an external URL must not load.</text:p>
|
||||
<text:p><draw:frame text:anchor-type="as-char" svg:width="3cm" svg:height="3cm"><draw:image xlink:href="{canary}/image.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame></text:p>
|
||||
</office:text></office:body>
|
||||
</office:document>
|
||||
13
test/integration/testdata/canary-websocket-html/index.html
vendored
Normal file
13
test/integration/testdata/canary-websocket-html/index.html
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Canary WebSocket</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Canary WebSocket</h1>
|
||||
<script type="application/javascript">
|
||||
new WebSocket("{canary}/websocket".replace(/^http/, "ws"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user