Skip to content

fix: allow RESPONSE_CODE_DETAILS and START_TIME in error page#277

Merged
mattdjenkinson merged 2 commits into
mainfrom
fix/error-page-allowlist-response-details-start-time
Jul 15, 2026
Merged

fix: allow RESPONSE_CODE_DETAILS and START_TIME in error page#277
mattdjenkinson merged 2 commits into
mainfrom
fix/error-page-allowlist-response-details-start-time

Conversation

@mattdjenkinson

Copy link
Copy Markdown
Contributor

Summary

The branded 5xx error page served on the downstream data plane has three fields: status code, error details, and a timestamp. Only the status code ever rendered. The other two showed up as literal Envoy %OPERATOR% tokens instead of real values.

The escaper that prepares this page for Envoy (escapeEnvoyFormatLiterals) only allowlists %RESPONSE_CODE%. Every other %...% token, including %RESPONSE_CODE_DETAILS% and %START_TIME(%Y-%m-%d %H:%M:%S UTC)%, gets its percent signs doubled to %%, which Envoy renders back as a literal % instead of invoking the operator. This is deliberate (issue #243: an unescaped literal % in this page's CSS once caused the whole listener xDS update to be rejected), but the allowlist was never extended past the one operator it shipped with.

This adds both operators to envoyBodyAllowedCommands so they resolve the same way %RESPONSE_CODE% already does.

Verified with new cases in TestEscapeEnvoyFormatLiterals covering both operators, plus the existing TestEmbeddedDefaultPageIsEnvoySafe regression guard, all passing.

The branded 5xx error page served on the downstream data plane shows
a "Status code", "Error details", and "Timestamp" row. Only the first
one ever rendered — the other two printed their literal Envoy
%OPERATOR% tokens instead of real values.

envoyBodyAllowedCommands only permitted %RESPONSE_CODE% through the
escaper. Every other %...% token, including %RESPONSE_CODE_DETAILS%
and %START_TIME(%Y-%m-%d %H:%M:%S UTC)%, got its percent signs
doubled to %%, which Envoy renders back as a literal percent instead
of invoking the operator.

Add both operators to the allowlist so they resolve like
%RESPONSE_CODE% already does.
@mattdjenkinson
mattdjenkinson marked this pull request as ready for review July 14, 2026 14:32
@mattdjenkinson
mattdjenkinson merged commit 24a8f0e into main Jul 15, 2026
8 checks passed
@mattdjenkinson
mattdjenkinson deleted the fix/error-page-allowlist-response-details-start-time branch July 15, 2026 09:42
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.

2 participants