Skip to content

Commit 4fc2027

Browse files
committed
Increase user agent suffix length to 128 characters
1 parent b350923 commit 4fc2027

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The configuration of the MultiApps CF plugin is done via env variables. The foll
7171
For example, with a 100MB MTAR the minimum value for this environment variable would be 2, and for a 400MB MTAR it would be 8. Finally, the minimum value cannot grow over 50, so with a 4GB MTAR, the minimum value would be 50 and not 80.
7272
* `MULTIAPPS_UPLOAD_CHUNKS_SEQUENTIALLY=<BOOLEAN>` - By default, MTAR chunks are uploaded in parallel for better performance. In case of a bad internet connection, the option to upload them sequentially will lessen network load.
7373
* `MULTIAPPS_DISABLE_UPLOAD_PROGRESS_BAR=<BOOLEAN>` - By default, the file upload shows a progress bar. In case of CI/CD systems where console text escaping isn't supported, the bar can be disabled to reduce unnecessary logs.
74-
* `MULTIAPPS_USER_AGENT_SUFFIX=<STRING>` - Allows customization of the User-Agent header sent with all HTTP requests. The value will be appended to the standard User-Agent string format: "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_value}". Only alphanumeric characters, spaces, hyphens, dots, and underscores are allowed. Maximum length is 64 characters; longer values will be truncated. Dangerous characters (control characters, colons, semicolons) are automatically removed for security. This can be useful for tracking requests from specific environments or CI/CD systems.
74+
* `MULTIAPPS_USER_AGENT_SUFFIX=<STRING>` - Allows customization of the User-Agent header sent with all HTTP requests. The value will be appended to the standard User-Agent string format: "Multiapps-CF-plugin/{version} ({operating system version}) {golang builder version} {custom_value}". Only alphanumeric characters, spaces, hyphens, dots, and underscores are allowed. Maximum length is 128 characters; longer values will be truncated. Dangerous characters (control characters, colons, semicolons) are automatically removed for security. This can be useful for tracking requests from specific environments or CI/CD systems.
7575

7676
# How to contribute
7777
* [Did you find a bug?](CONTRIBUTING.md#did-you-find-a-bug)

util/env_configuration_help.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const BaseEnvHelpText = `
55
ENVIRONMENT:
66
DEBUG=1 Enables the logging of HTTP requests in STDOUT and STDERR.
77
MULTIAPPS_CONTROLLER_URL=<URL> Overrides the default deploy-service.<system-domain> with a custom URL.
8-
MULTIAPPS_USER_AGENT_SUFFIX=<STRING> Appends custom text to User-Agent header. Only alphanumeric, spaces, hyphens, dots, underscores allowed. Max 64 chars, excess truncated.
8+
MULTIAPPS_USER_AGENT_SUFFIX=<STRING> Appends custom text to User-Agent header. Only alphanumeric, spaces, hyphens, dots, underscores allowed. Max 128 chars, excess truncated.
99
`
1010
const UploadEnvHelpText = BaseEnvHelpText + `
1111
MULTIAPPS_UPLOAD_CHUNK_SIZE=<POSITIVE_INTEGER> Configures chunk size (in MB) for MTAR upload.

util/user_agent_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
)
1010

1111
// Limit for MULTIAPPS_USER_AGENT_SUFFIX
12-
const maxSuffixLength = 64
12+
const maxSuffixLength = 128
1313

1414
// pluginVersion stores the version set from the main package
1515
var pluginVersion string = "0.0.0"

util/user_agent_builder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ var _ = Describe("UserAgentBuilder", func() {
150150
})
151151

152152
It("should truncate excessively long values", func() {
153-
longValue := strings.Repeat("a", 600) // 600 chars, should be truncated to 64
153+
longValue := strings.Repeat("a", 600) // 600 chars, should be truncated to 128
154154
os.Setenv("MULTIAPPS_USER_AGENT_SUFFIX", longValue)
155155
userAgent := util.BuildUserAgent()
156156

157157
// Should contain truncated suffix
158-
expectedSuffix := strings.Repeat("a", 64)
158+
expectedSuffix := strings.Repeat("a", 128)
159159
Expect(userAgent).To(ContainSubstring(expectedSuffix))
160160
// But not the full original value
161161
Expect(userAgent).ToNot(ContainSubstring(longValue))
@@ -165,7 +165,7 @@ var _ = Describe("UserAgentBuilder", func() {
165165
Context("with maximum length suffix", func() {
166166
BeforeEach(func() {
167167
util.SetPluginVersion("1.0.0")
168-
longSuffix := strings.Repeat("a", 64)
168+
longSuffix := strings.Repeat("a", 128)
169169
os.Setenv("MULTIAPPS_USER_AGENT_SUFFIX", longSuffix)
170170
})
171171

0 commit comments

Comments
 (0)