| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…F, and disable XML DTD processing
|
This sounds like multiple separate issues. I'm no longer at Google so I don;t know how likely external contributions are to be considered but in general:
Grab bag PRs tend not to go anywhere. |
Sorry, something went wrong.
|
Splitting this into focused, single-purpose PRs per your feedback:
Each has its own issue and isolated diff. Closing this one in favor of those four. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR implements security hardening improvements in the google-http-java-client library to strengthen credential handling across redirects, improve HTTP header validation, and harden XML parsing.
When handling redirects, the original request origin is recorded and compared against the redirected request. If a redirect targets a different origin (scheme, host, or port), sensitive headers such as Authorization and Cookie are removed after execution interceptors run, preventing credentials from being forwarded to cross-origin destinations while preserving existing behavior for same-origin redirects. Unit tests have been added to verify both same-origin and cross-origin redirect behavior.
This PR also adds validation in HttpHeaders#addHeader to reject header names and serialized header values containing carriage return (\r) or line feed (\n) characters by throwing an IllegalArgumentException. Corresponding tests verify that invalid headers are rejected while valid headers continue to serialize correctly.
Additionally, Xml#createParser() now disables DTD processing using XmlPullParser.FEATURE_PROCESS_DOCDECL where supported by the parser implementation, with a graceful fallback for implementations that do not support the feature. Tests have been added to verify that XML documents containing DTD declarations do not process external entities while maintaining normal XML parsing behavior.
The implementation has been validated by running the relevant unit tests. HttpRequestTest, HttpHeadersTest, and XmlTest all pass successfully, with no test failures or errors.