common.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SERVICES_QUARANTINE_COMMON_H_
  5. #define COMPONENTS_SERVICES_QUARANTINE_COMMON_H_
  6. #include "url/gurl.h"
  7. namespace quarantine {
  8. // Return a sanitized URL to use as a source or referrer for the purpose of
  9. // annotating the source of a downloaded file.
  10. //
  11. // For privacy reasons, it's best to not URLs as-is when annotating or
  12. // informing third parties about the source of a download. Hence this function
  13. // is used to strip out any unnecessary or excessive parts from the URL.
  14. //
  15. // See https://crbug.com/917842 for justification for the types of sanitization
  16. // performed here. In particular, stripping fragments, query, and path from URLs
  17. // was discussed and rejected due to that information being pertinent to
  18. // evaluating whether the downloaded file is safe.
  19. GURL SanitizeUrlForQuarantine(const GURL& source_url);
  20. } // namespace quarantine
  21. #endif // COMPONENTS_SERVICES_QUARANTINE_COMMON_H_