Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13a74265a8 |
No files matched your search
@@ -29,9 +29,8 @@ Decide whether the repo moves to the layout `REPO_POLICIES.md` gives, with
|
|||||||
origin can send a `text/plain` POST without a CORS preflight, so any site
|
origin can send a `text/plain` POST without a CORS preflight, so any site
|
||||||
could make its visitors' browsers store reports; a JSON POST waits for the
|
could make its visitors' browsers store reports; a JSON POST waits for the
|
||||||
preflight, which only an origin in `CORS_ALLOWED_ORIGINS` passes. The page
|
preflight, which only an origin in `CORS_ALLOWED_ORIGINS` passes. The page
|
||||||
already sent `application/json`. A test posts a report as `text/plain`, as
|
already sent `application/json`. A test posts a report as `text/plain`, with
|
||||||
`application/x-www-form-urlencoded`, as `multipart/form-data`, with no
|
no `Content-Type`, and as `application/json` with and without a charset, and
|
||||||
`Content-Type`, and as `application/json` with and without a charset, and
|
|
||||||
checks which are stored
|
checks which are stored
|
||||||
- 2026-10-07: the files shared from `sneak/prompts` are its copies at commit
|
- 2026-10-07: the files shared from `sneak/prompts` are its copies at commit
|
||||||
`dd4027b` ([#113](https://git.eeqj.de/sneak/netwatch/issues/113)), with this
|
`dd4027b` ([#113](https://git.eeqj.de/sneak/netwatch/issues/113)), with this
|
||||||
|
|||||||
+1
-1
@@ -150,7 +150,7 @@ credentials, so it is bounded instead. Each refusal below answers with the same
|
|||||||
parameters such as `charset` allowed, as the page sends it; any other is
|
parameters such as `charset` allowed, as the page sends it; any other is
|
||||||
refused with 415, and nothing of it is stored. A page on another origin can
|
refused with 415, and nothing of it is stored. A page on another origin can
|
||||||
send a `text/plain` POST, or a form, without a CORS preflight; refusing them
|
send a `text/plain` POST, or a form, without a CORS preflight; refusing them
|
||||||
keeps any site from making its visitors' browsers store reports (see
|
keeps any site from making its visitors' browsers send reports (see
|
||||||
[CORS](#cors)).
|
[CORS](#cors)).
|
||||||
- **Rate limit.** Each client address, resolved through `TRUSTED_PROXIES`, may
|
- **Rate limit.** Each client address, resolved through `TRUSTED_PROXIES`, may
|
||||||
send `REPORTS_PER_MINUTE` reports a minute; past that it gets 429 with
|
send `REPORTS_PER_MINUTE` reports a minute; past that it gets 429 with
|
||||||
|
|||||||
@@ -117,8 +117,8 @@ func TestHandleReportAcceptsValidReports(t *testing.T) {
|
|||||||
|
|
||||||
// TestHandleReportStoresOnlyJSON checks that a report is stored only
|
// TestHandleReportStoresOnlyJSON checks that a report is stored only
|
||||||
// when sent as application/json, as the page sends it. One sent as
|
// when sent as application/json, as the page sends it. One sent as
|
||||||
// text/plain or as a form, which a page on another origin can send
|
// text/plain, which a page on another origin can send without a CORS
|
||||||
// without a CORS preflight, is refused with 415.
|
// preflight, is refused with 415.
|
||||||
func TestHandleReportStoresOnlyJSON(t *testing.T) {
|
func TestHandleReportStoresOnlyJSON(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -134,18 +134,6 @@ func TestHandleReportStoresOnlyJSON(t *testing.T) {
|
|||||||
wantStatus: http.StatusUnsupportedMediaType,
|
wantStatus: http.StatusUnsupportedMediaType,
|
||||||
wantStored: 0,
|
wantStored: 0,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "a urlencoded form",
|
|
||||||
contentType: "application/x-www-form-urlencoded",
|
|
||||||
wantStatus: http.StatusUnsupportedMediaType,
|
|
||||||
wantStored: 0,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "a multipart form",
|
|
||||||
contentType: "multipart/form-data; boundary=x",
|
|
||||||
wantStatus: http.StatusUnsupportedMediaType,
|
|
||||||
wantStored: 0,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "no Content-Type",
|
name: "no Content-Type",
|
||||||
contentType: "",
|
contentType: "",
|
||||||
|
|||||||
Reference in new issue
Block a user