[Extensions] Sanitize extension short name in LoadShortName [chromium/src : main]

0 views
Skip to first unread message

Andrea Orru (Gerrit)

unread,
May 29, 2026, 8:21:36 PM (3 days ago) May 29
to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Solomon Kinard

Andrea Orru voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Solomon Kinard
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ibf1d62da2456d1d96512da90818b1e54f363aa49
Gerrit-Change-Number: 7885964
Gerrit-PatchSet: 2
Gerrit-Owner: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
Gerrit-Comment-Date: Sat, 30 May 2026 00:21:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Solomon Kinard (Gerrit)

unread,
1:23 PM (4 hours ago) 1:23 PM
to Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
Attention needed from Andrea Orru

Solomon Kinard added 1 comment

File extensions/common/extension.cc
Line 777, Patchset 2 (Latest): localized_short_name = base::CollapseWhitespace(localized_short_name, true);
base::i18n::SanitizeUserSuppliedString(&localized_short_name);
base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
short_name_ = base::UTF16ToUTF8(localized_short_name);
} else {
short_name_ = display_name_;
}
Solomon Kinard . unresolved
Thoughts on a catch all so that `display_name_` can get the same sanitization, for consistency?
```suggestion
base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
short_name_ = base::UTF16ToUTF8(localized_short_name);
} else {
short_name_ = display_name_;
}
  // Now that short_name_ is populated from either branch, sanitize it.
std::u16string sanitized_short_name = base::UTF8ToUTF16(short_name_);
sanitized_short_name = base::CollapseWhitespace(sanitized_short_name, true);
base::i18n::SanitizeUserSuppliedString(&sanitized_short_name);
base::i18n::AdjustStringForLocaleDirection(&sanitized_short_name);
short_name_ = base::UTF16ToUTF8(sanitized_short_name);

```

Open in Gerrit

Related details

Attention is currently required from:
  • Andrea Orru
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibf1d62da2456d1d96512da90818b1e54f363aa49
    Gerrit-Change-Number: 7885964
    Gerrit-PatchSet: 2
    Gerrit-Owner: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Attention: Andrea Orru <andre...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 17:22:37 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Andrea Orru (Gerrit)

    unread,
    1:35 PM (3 hours ago) 1:35 PM
    to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Solomon Kinard

    Andrea Orru added 1 comment

    File extensions/common/extension.cc
    Line 777, Patchset 2 (Latest): localized_short_name = base::CollapseWhitespace(localized_short_name, true);
    base::i18n::SanitizeUserSuppliedString(&localized_short_name);
    base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
    short_name_ = base::UTF16ToUTF8(localized_short_name);
    } else {
    short_name_ = display_name_;
    }
    Solomon Kinard . unresolved
    Thoughts on a catch all so that `display_name_` can get the same sanitization, for consistency?
    ```suggestion
    base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
    short_name_ = base::UTF16ToUTF8(localized_short_name);
    } else {
    short_name_ = display_name_;
    }
      // Now that short_name_ is populated from either branch, sanitize it.
    std::u16string sanitized_short_name = base::UTF8ToUTF16(short_name_);
    sanitized_short_name = base::CollapseWhitespace(sanitized_short_name, true);
    base::i18n::SanitizeUserSuppliedString(&sanitized_short_name);
    base::i18n::AdjustStringForLocaleDirection(&sanitized_short_name);
    short_name_ = base::UTF16ToUTF8(sanitized_short_name);

    ```

    Andrea Orru

    I don't think that's necessary. `display_name_` is already sanitized by `LoadName`, so the else branch is safe as-is.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Solomon Kinard
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ibf1d62da2456d1d96512da90818b1e54f363aa49
    Gerrit-Change-Number: 7885964
    Gerrit-PatchSet: 2
    Gerrit-Owner: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
    Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Attention: Solomon Kinard <solomo...@chromium.org>
    Gerrit-Comment-Date: Mon, 01 Jun 2026 17:35:12 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Solomon Kinard <solomo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Solomon Kinard (Gerrit)

    unread,
    1:53 PM (3 hours ago) 1:53 PM
    to Andrea Orru, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org
    Attention needed from Andrea Orru

    Solomon Kinard voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrea Orru
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ibf1d62da2456d1d96512da90818b1e54f363aa49
      Gerrit-Change-Number: 7885964
      Gerrit-PatchSet: 2
      Gerrit-Owner: Andrea Orru <andre...@chromium.org>
      Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
      Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
      Gerrit-Attention: Andrea Orru <andre...@chromium.org>
      Gerrit-Comment-Date: Mon, 01 Jun 2026 17:53:43 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrea Orru (Gerrit)

      unread,
      3:53 PM (1 hour ago) 3:53 PM
      to Solomon Kinard, Chromium LUCI CQ, chromium...@chromium.org, chromium-a...@chromium.org, extension...@chromium.org

      Andrea Orru voted and added 1 comment

      Votes added by Andrea Orru

      Commit-Queue+2

      1 comment

      File extensions/common/extension.cc
      Line 777, Patchset 2 (Latest): localized_short_name = base::CollapseWhitespace(localized_short_name, true);
      base::i18n::SanitizeUserSuppliedString(&localized_short_name);
      base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
      short_name_ = base::UTF16ToUTF8(localized_short_name);
      } else {
      short_name_ = display_name_;
      }
      Solomon Kinard . resolved
      Thoughts on a catch all so that `display_name_` can get the same sanitization, for consistency?
      ```suggestion
      base::i18n::AdjustStringForLocaleDirection(&localized_short_name);
      short_name_ = base::UTF16ToUTF8(localized_short_name);
      } else {
      short_name_ = display_name_;
      }
        // Now that short_name_ is populated from either branch, sanitize it.
      std::u16string sanitized_short_name = base::UTF8ToUTF16(short_name_);
      sanitized_short_name = base::CollapseWhitespace(sanitized_short_name, true);
      base::i18n::SanitizeUserSuppliedString(&sanitized_short_name);
      base::i18n::AdjustStringForLocaleDirection(&sanitized_short_name);
      short_name_ = base::UTF16ToUTF8(sanitized_short_name);

      ```

      Andrea Orru

      I don't think that's necessary. `display_name_` is already sanitized by `LoadName`, so the else branch is safe as-is.

      Andrea Orru

      Done

      Open in Gerrit

      Related details

      Attention set is empty
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ibf1d62da2456d1d96512da90818b1e54f363aa49
        Gerrit-Change-Number: 7885964
        Gerrit-PatchSet: 2
        Gerrit-Owner: Andrea Orru <andre...@chromium.org>
        Gerrit-Reviewer: Andrea Orru <andre...@chromium.org>
        Gerrit-Reviewer: Solomon Kinard <solomo...@chromium.org>
        Gerrit-Comment-Date: Mon, 01 Jun 2026 19:52:54 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        Comment-In-Reply-To: Solomon Kinard <solomo...@chromium.org>
        Comment-In-Reply-To: Andrea Orru <andre...@chromium.org>
        satisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages