Skip to content

Commit df4bf0b

Browse files
authored
[headers] Support headers for verb tunnelling (#720)
<!-- Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors. All rights reserved. SPDX-License-Identifier: Apache-2.0 --> ### Description trying to support the verb tunnelling required by TUS https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-odata/bdbabfa6-8c4a-4741-85a9-8d93ffd66c41 https://tus.io/protocols/resumable-upload#x-http-method-override verb tunnelling seems to also be supported by [grpc](grpc-ecosystem/grpc-gateway#3918) ### Test Coverage <!-- Please put an `x` in the correct box e.g. `[x]` to indicate the testing coverage of this change. --> - [x] This change is covered by existing or additional automated tests. - [ ] Manual testing has been performed (and evidence provided) as automated testing was not feasible. - [ ] Additional tests are not required for this change (e.g. documentation update).
1 parent 1f765c0 commit df4bf0b

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

changes/20251006152230.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
:sparkles: `[headers]` Support headers for [verb tunnelling](https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-odata/bdbabfa6-8c4a-4741-85a9-8d93ffd66c41)

utils/http/headers/headers.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,19 @@ const (
3131
HeaderDeprecation = "Deprecation" // https://datatracker.ietf.org/doc/html/draft-ietf-httpapi-deprecation-header-02
3232
HeaderLink = headers.Link // https://datatracker.ietf.org/doc/html/rfc8288
3333
// TUS Headers https://tus.io/protocols/resumable-upload#headers
34-
HeaderUploadOffset = "Upload-Offset"
35-
HeaderTusVersion = "Tus-Version"
36-
HeaderUploadLength = "Upload-Length"
37-
HeaderTusResumable = "Tus-Resumable"
38-
HeaderTusExtension = "Tus-Extension"
39-
HeaderTusMaxSize = "Tus-Max-Size"
34+
HeaderUploadOffset = "Upload-Offset"
35+
HeaderTusVersion = "Tus-Version"
36+
HeaderUploadLength = "Upload-Length"
37+
HeaderTusResumable = "Tus-Resumable"
38+
HeaderTusExtension = "Tus-Extension"
39+
HeaderTusMaxSize = "Tus-Max-Size"
40+
// Verb tunnelling (see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-odata/bdbabfa6-8c4a-4741-85a9-8d93ffd66c41)
41+
// CAUTION see the security risk of supporting such headers https://www.sidechannel.blog/en/http-method-override-what-it-is-and-how-a-pentester-can-use-it/
4042
HeaderXHTTPMethodOverride = "X-HTTP-Method-Override"
43+
HeaderXHTTPMethod = "X-HTTP-Method"
44+
HeaderXMethodOverride = "X-Method-Override"
45+
HeaderXOverrideMethod = "X-Override-Method"
46+
4147
// TUS extensions Headers
4248
HeaderUploadMetadata = "Upload-Metadata" // See https://tus.io/protocols/resumable-upload#upload-metadata
4349
HeaderUploadDeferLength = "Upload-Defer-Length" // See https://tus.io/protocols/resumable-upload#upload-defer-length
@@ -51,6 +57,8 @@ const (
5157
)
5258

5359
var (
60+
// VerbTunnellingHeaders defines the non-standard headers which can be used for Verb tunnelling (see https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-odata/bdbabfa6-8c4a-4741-85a9-8d93ffd66c41)
61+
VerbTunnellingHeaders = []string{HeaderXHTTPMethodOverride, HeaderXHTTPMethod, HeaderXMethodOverride, HeaderXOverrideMethod}
5462
// SafeHeaders corresponds to headers which do not store personal data.
5563
SafeHeaders = []string{
5664
HeaderVersion,
@@ -76,6 +84,9 @@ var (
7684
HeaderChecksumAlgorithm,
7785
HeaderChecksum,
7886
HeaderUploadConcat,
87+
HeaderXHTTPMethod,
88+
HeaderXMethodOverride,
89+
HeaderXOverrideMethod,
7990
headers.Accept,
8091
headers.AcceptCharset,
8192
headers.AcceptEncoding,

0 commit comments

Comments
 (0)