Skip to content

Various medium-severity bug fixes#214

Open
connelly38 wants to merge 6 commits into
mainfrom
bugfix/medium_severity_fixes
Open

Various medium-severity bug fixes#214
connelly38 wants to merge 6 commits into
mainfrom
bugfix/medium_severity_fixes

Conversation

@connelly38

Copy link
Copy Markdown
Member

Fixed:

  • Make prepared-query byte arrays immutable
  • Redact sensitive information from SystemResult.toString() and SystemRequest.toString()
  • Add/drop replica retries lack SDK idempotency token support
  • Resource-scope header values can inject outbound HTTP headers
  • Extension user-agent can inject outbound HTTP headers
  • Internal query copies drop caller-specified durability for query DML

@connelly38 connelly38 requested review from cezarfx and dario-vega June 26, 2026 22:24
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 26, 2026
}
for (int i = 0; i < value.length(); i++) {
char ch = value.charAt(i);
if (ch <= 0x1f || ch == 0x7f) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both name and value must be checked and there are different rules for them, this is what I got from GPT:

static boolean isValidHttpHeaderName(String name) {
if (name == null || name.isEmpty()) {
return false;
}

for (int i = 0; i < name.length(); i++) {
    char c = name.charAt(i);

    boolean valid =
        (c >= 'A' && c <= 'Z') ||
        (c >= 'a' && c <= 'z') ||
        (c >= '0' && c <= '9') ||
        c == '!' || c == '#' || c == '$' || c == '%' ||
        c == '&' || c == '\'' || c == '*' || c == '+' ||
        c == '-' || c == '.' || c == '^' || c == '_' ||
        c == '`' || c == '|' || c == '~';

    if (!valid) {
        return false;
    }
}

return true;

}

static boolean isValidHttpHeaderValue(String value) {
if (value == null) {
return false;
}

for (int i = 0; i < value.length(); i++) {
    char c = value.charAt(i);

    // Reject control chars except horizontal tab.
    // This rejects CR/LF too, preventing header injection.
    if ((c < 0x20 && c != '\t') || c == 0x7f) {
        return false;
    }
}

return true;

}

Also http2 and 3 should also check:
if (c >= 'A' && c <= 'Z') {
return false;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have a way for users to affect the header field that we send. We only allow appending to the value. So I don't think we need header field validation at this point.
The purpose of this change was to eliminate the chance of injected headers, so throwing an error on CR/LF is really the most important part. The current code change covers that with the simple <= 0x1f check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants