Skip to content

chore: May 2026 batch#33

Merged
henvic merged 19 commits into
mainfrom
chore/2026-may
Jul 22, 2026
Merged

chore: May 2026 batch#33
henvic merged 19 commits into
mainfrom
chore/2026-may

Conversation

@henvic

@henvic henvic commented May 23, 2026

Copy link
Copy Markdown
Owner

May 2026 maintenance batch.
The library supports the last two major Go releases whenever updated. Now: 1.25 and 1.26.

  • Color response status line by status class.
  • http.Flusher and http.ResponseController support in Middleware.
  • Print subjectAltName line in curl format on printCertificate.
  • Recognize application/gzip as a binary media type
    • Use tls.VersionName and tls.CipherSuiteName from the stdlib, deleting the hand-maintained tlsCiphers/tlsProtocolVersions tables in tls.go.
  • Show Transfer-Encoding header
  • Log HTTP trailers

Fixes

  • isBinary was checking the wrong portion of the body — it sliced body[512:] (skipping the first 512 bytes) instead of body[:512], so the binary-detection heuristic looked at the wrong region.
  • printServerResponse Content-Type check now uses the response header (rec.Header()) instead of the request header (req.Header), so binary-response detection keys off the actual response Content-Type.
  • Typo fixes in comments and a test error message.

henvic added 8 commits May 3, 2026 14:46
body[512:] examined bytes *after* position 512 instead of the first
512 bytes. Binary detection (BOM check, control character scan, and
http.DetectContentType) operated on the tail of the body rather than
the head, which is what the MIME sniffing spec and DetectContentType
expect.

A body of length 513+ with a leading BOM was misclassified, since the
BOM check requires len(body) >= 3 against the start of the slice.
- Removes the locally maintained tls.go maps in favor of the standard library.
- tls.CipherSuiteName available since Go 1.14.
- tls.VersionName available since Go 1.21.
- Implements Unwrap() on responseRecorder to support http.ResponseController (Go 1.20+).
- Let handlers stream via direct w.(http.Flusher) assertions when the underlying writer supports it.
Previously, the response status line was always printed red.
Now httpretty picks the color depending on the HTTP status class:
2xx green, 3xx yellow, 4xx red, 5xx bold red, and blue for 1xx.
@socket-security

socket-security Bot commented May 23, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedgolang.org/​x/​tools@​v0.14.0 ⏵ v0.48.075 +1100100100100

View full report

@socket-security

socket-security Bot commented May 23, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: golang golang.org/x/tools is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: go.modgolang/golang.org/x/tools@v0.48.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore golang/golang.org/x/tools@v0.48.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@henvic henvic changed the title chore: May 2026 batch — TLS SAN output, status-class colors, Flusher/ResponseController, binary-detection fixes, Go 1.25/1.26 chore: May 2026 batch May 23, 2026
henvic added 9 commits June 1, 2026 01:20
Split multipart requests and responses into parts, printing each part's
headers, and applying formatters and binary detection per part.

Splitting is capped at two levels of nesting as a maliciously nested
multipart body of n bytes would otherwise amplify to O(n²) memory.
Deeper levels than that are printed as-is.
Windows checkouts convert text files to CRLF by default (autocrlf),
which broke the goldens embedded from testdata: every byte-for-byte
comparison against logger output failed.

This went on for some time with continue-on-error masking the failed jobs.
@henvic
henvic merged commit 6b2c342 into main Jul 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant