Skip to content

Commit 86e8cf4

Browse files
authored
Allow setting Headers in DownloadableFile message (#197)
Fixes #194 This PR amends the spec and protos to include an optional set of headers in DownloadableFile, to be used in the download GET request to set up auth parameters. This is only one of the ways we could implement setting authentication paramaters to be used by Agents when downloading packages, but it is consistent with other uses of the headers field and generic enough to cover different use cases so I feel it's worth considering.
1 parent 58acf6b commit 86e8cf4

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

proto/opamp.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,14 @@ message DownloadableFile {
515515
// https://github.com/open-telemetry/opamp-spec/blob/main/specification.md#code-signing
516516
// for recommendations.
517517
bytes signature = 3;
518+
519+
// Optional headers to use when downloading a file. Typically used to set
520+
// access tokens or other authorization headers. For HTTP-based protocols
521+
// the Agent should set these in the request headers.
522+
// For example:
523+
// key="Authorization", Value="Basic YWxhZGRpbjpvcGVuc2VzYW1l".
524+
// Status: [Development]
525+
Headers headers = 4;
518526
}
519527

520528
message ServerErrorResponse {

specification.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Status: [Beta]
154154
- [DownloadableFile.download_url](#downloadablefiledownload_url)
155155
- [DownloadableFile.content_hash](#downloadablefilecontent_hash)
156156
- [DownloadableFile.signature](#downloadablefilesignature)
157+
- [DownloadableFile.headers](#downloadablefileheaders)
157158
* [Custom Messages](#custom-messages)
158159
+ [Motivation](#motivation)
159160
+ [CustomCapabilities](#customcapabilities)
@@ -2412,7 +2413,9 @@ should download the file:
24122413
and the file SHOULD be downloaded from the location specified in the
24132414
[download_url](#downloadablefiledownload_url) field of the
24142415
[DownloadableFile](#downloadablefile-message) message. The Agent SHOULD use an
2415-
HTTP GET message to download the file.
2416+
HTTP GET message to download the file. The Agent SHOULD include the HTTP
2417+
headers provided in the [headers](#downloadablefileheaders) field for the GET
2418+
request.
24162419

24172420
The procedure outlined above allows the Agent to efficiently download only new
24182421
or changed packages and only download new or changed files.
@@ -2605,6 +2608,7 @@ message DownloadableFile {
26052608
string download_url = 1;
26062609
bytes content_hash = 2;
26072610
bytes signature = 3;
2611+
headers headers = 4; // Status: [Development]
26082612
}
26092613
```
26102614

@@ -2627,6 +2631,16 @@ authenticity of the downloaded file, for example can be the
26272631
The exact signing and verification method is Agent specific. See
26282632
[Code Signing](#code-signing) for recommendations.
26292633

2634+
##### DownloadableFile.headers
2635+
2636+
Status: [Development]
2637+
2638+
Optional headers to use for the HTTP GET request. Typically used to set access
2639+
tokens or other authorization headers. For HTTP-based protocols the Agent
2640+
should set these in the request headers.
2641+
For example:
2642+
key="Authorization", Value="Basic YWxhZGRpbjpvcGVuc2VzYW1l".
2643+
26302644
### Custom Messages
26312645

26322646
Status: [Development]

0 commit comments

Comments
 (0)