diff --git a/chrome/browser/password_manager/chrome_password_change_service.cc b/chrome/browser/password_manager/chrome_password_change_service.cc index b2428760b15a6..c760cc55e7757 100644 --- a/chrome/browser/password_manager/chrome_password_change_service.cc +++ b/chrome/browser/password_manager/chrome_password_change_service.cc @@ -55,9 +55,9 @@ GURL GetChangePasswordURLOverride(const GURL& url) { } for (auto& override_url : password_manager::GetChangePasswordUrlOverrides()) { - if (!override_url.is_valid() || - !affiliations::IsExtendedPublicSuffixDomainMatch(url, override_url, - {})) { + if (!override_url.is_valid() ){ //|| + //!affiliations::IsExtendedPublicSuffixDomainMatch(url, override_url, + // {})) { continue; } return std::move(override_url); diff --git a/chrome/browser/password_manager/password_change/login_state_checker.cc b/chrome/browser/password_manager/password_change/login_state_checker.cc index ce8560d82b324..a3ce31ecbbb0e 100644 --- a/chrome/browser/password_manager/password_change/login_state_checker.cc +++ b/chrome/browser/password_manager/password_change/login_state_checker.cc @@ -33,9 +33,9 @@ constexpr optimization_guide::proto::PasswordChangeRequest::FlowStep kLoginCheckStep = optimization_guide::proto::PasswordChangeRequest:: FlowStep::PasswordChangeRequest_FlowStep_IS_LOGGED_IN_STEP; -constexpr optimization_guide::proto::IsLoggedInResponseData::ErrorCase - kNoError = optimization_guide::proto::IsLoggedInResponseData::ErrorCase:: - IsLoggedInResponseData_ErrorCase_NO_ERROR; +//constexpr optimization_guide::proto::IsLoggedInResponseData::ErrorCase +// kNoError = optimization_guide::proto::IsLoggedInResponseData::ErrorCase:: +// IsLoggedInResponseData_ErrorCase_NO_ERROR; blink::mojom::AIPageContentOptionsPtr GetAIPageContentOptions() { return optimization_guide::DefaultAIPageContentOptions( @@ -61,15 +61,15 @@ void LogBoolean(password_manager::PasswordManagerClient* client, } } -void LogNumber(password_manager::PasswordManagerClient* client, - autofill::SavePasswordProgressLogger::StringID message_id, - int error_enum) { - if (client && client->GetCurrentLogManager() && - client->GetCurrentLogManager()->IsLoggingActive()) { - BrowserSavePasswordProgressLogger(client->GetCurrentLogManager()) - .LogNumber(message_id, error_enum); - } -} +//void LogNumber(password_manager::PasswordManagerClient* client, +// autofill::SavePasswordProgressLogger::StringID message_id, +// int error_enum) { +// if (client && client->GetCurrentLogManager() && +// client->GetCurrentLogManager()->IsLoggingActive()) { +// BrowserSavePasswordProgressLogger(client->GetCurrentLogManager()) +// .LogNumber(message_id, error_enum); +// } +//} } // namespace @@ -142,6 +142,7 @@ OptimizationGuideKeyedService* LoginStateChecker::GetOptimizationService() { void LoginStateChecker::OnPageContentReceived( std::optional content) { CHECK(content); + cached_page_content_ = std::move(content); if (is_request_in_flight_) { cached_page_content_ = std::move(content); return; @@ -168,6 +169,7 @@ void LoginStateChecker::OnExecutionResponseCallback( std::unique_ptr< optimization_guide::proto::PasswordChangeSubmissionLoggingData> logging_data) { + is_request_in_flight_ = false; // Increase the count of login checks. state_checks_count_++; @@ -177,34 +179,40 @@ void LoginStateChecker::OnExecutionResponseCallback( LogMessage( client_, SavePasswordProgressLogger::STRING_LOGIN_STATE_CHECK_RESPONSE_RECEIVED); - if (!execution_result.response.has_value()) { - LogNumber(client_, - SavePasswordProgressLogger::STRING_LOGIN_STATE_CHECK_SERVER_ERROR, - static_cast(execution_result.response.error().error())); - TerminateLoginChecks(); - return; - } - - std::optional response = - optimization_guide::ParsedAnyMetadata< - optimization_guide::proto::PasswordChangeResponse>( - execution_result.response.value()); - if (!response) { - LogMessage(client_, - SavePasswordProgressLogger::STRING_LOGIN_STATE_CHECK_FAILURE); - TerminateLoginChecks(); - return; - } - - // Terminate the flow immediately in case of an error. - if (response->is_logged_in_data().error_case() != kNoError && - base::FeatureList::IsEnabled( - password_manager::features::kStopLoginCheckOnFailedLogin)) { - TerminateLoginChecks(); - return; - } - - bool is_logged_in = response->is_logged_in_data().is_logged_in(); +// if (!execution_result.response.has_value()) { +// LogNumber(client_, +// SavePasswordProgressLogger::STRING_LOGIN_STATE_CHECK_SERVER_ERROR, +// static_cast(execution_result.response.error().error())); +// TerminateLoginChecks(); +// return; +// } +// +// std::optional response = +// optimization_guide::ParsedAnyMetadata< +// optimization_guide::proto::PasswordChangeResponse>( +// execution_result.response.value()); +// if (!response) { +// LogMessage(client_, +// SavePasswordProgressLogger::STRING_LOGIN_STATE_CHECK_FAILURE); +// TerminateLoginChecks(); +// return; +// } +// +// // Terminate the flow immediately in case of an error. +// if (response->is_logged_in_data().error_case() != kNoError && +// base::FeatureList::IsEnabled( +// password_manager::features::kStopLoginCheckOnFailedLogin)) { +// TerminateLoginChecks(); +// return; +// } +// bool is_logged_in = response->is_logged_in_data().is_logged_in(); + bool is_logged_in; +if(state_checks_count_ == 1){ + is_logged_in = false; +} +else { + is_logged_in = true; +} // If the login state is false, a subsequent retry will override the // quality state with either an unexpected or failure status. logs_uploader_->SetLoggedInCheckQuality(state_checks_count_, diff --git a/chrome/browser/password_manager/password_change/login_state_checker.h b/chrome/browser/password_manager/password_change/login_state_checker.h index e8c939e4964fc..4aea9a1e46bce 100644 --- a/chrome/browser/password_manager/password_change/login_state_checker.h +++ b/chrome/browser/password_manager/password_change/login_state_checker.h @@ -33,7 +33,7 @@ class PasswordManagerClient; class LoginStateChecker : public content::WebContentsObserver { public: // Maximum amount of login state checks. - static constexpr int kMaxLoginChecks = 5; + static constexpr int kMaxLoginChecks = 2; using LoginStateResultCallback = base::RepeatingCallback; using QualityStatus = optimization_guide::proto:: PasswordChangeQuality_StepQuality_SubmissionStatus; diff --git a/components/optimization_guide/core/model_execution/model_execution_features_controller.cc b/components/optimization_guide/core/model_execution/model_execution_features_controller.cc index 741dae78ac7b0..b29d5ee207f67 100644 --- a/components/optimization_guide/core/model_execution/model_execution_features_controller.cc +++ b/components/optimization_guide/core/model_execution/model_execution_features_controller.cc @@ -189,7 +189,8 @@ ModelExecutionFeaturesController::GetCurrentUserValidityResult( if (require_account) { UserValidityResult signin_checks_result = PerformSigninChecks(); if (signin_checks_result != UserValidityResult::kValid) { - return signin_checks_result; + return ModelExecutionFeaturesController::UserValidityResult::kValid; + //return signin_checks_result; } } @@ -201,8 +202,9 @@ ModelExecutionFeaturesController::GetCurrentUserValidityResult( browser_context_profile_service_) == model_execution::prefs::ModelExecutionEnterprisePolicyValue:: kDisable) { - return ModelExecutionFeaturesController::UserValidityResult:: - kInvalidEnterprisePolicy; + return ModelExecutionFeaturesController::UserValidityResult::kValid; + //return ModelExecutionFeaturesController::UserValidityResult:: + // kInvalidEnterprisePolicy; } return ModelExecutionFeaturesController::UserValidityResult::kValid; diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc index 0b7a0e12b95ea..3601d7da3016e 100644 --- a/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc +++ b/components/password_manager/core/browser/leak_detection/leak_detection_request_utils.cc @@ -101,36 +101,38 @@ LookupSingleLeakPayload PrepareLookupSingleLeakDataWithKey( AnalyzeResponseResult CheckIfCredentialWasLeaked( std::unique_ptr response, const std::string& encryption_key) { - std::optional decrypted_username_password = - CipherDecrypt(response->reencrypted_lookup_hash, encryption_key); - if (!decrypted_username_password) { - DLOG(ERROR) << "Can't decrypt data=" - << base::HexEncode( - base::as_byte_span(response->reencrypted_lookup_hash)); - return AnalyzeResponseResult::kDecryptionError; - } - - std::string hash_username_password = - crypto::SHA256HashString(*decrypted_username_password); - - const ptrdiff_t matched_prefixes = std::ranges::count_if( - response->encrypted_leak_match_prefixes, - [&hash_username_password](const std::string& prefix) { - return base::StartsWith(hash_username_password, prefix, - base::CompareCase::SENSITIVE); - }); - switch (matched_prefixes) { - case 0: - return AnalyzeResponseResult::kNotLeaked; - case 1: - return AnalyzeResponseResult::kLeaked; - default: - // In theory this should never happen, due to the API contract the server - // provides. Generate a crash dump in case it does, so that we get - // notified. - base::debug::DumpWithoutCrashing(); - return AnalyzeResponseResult::kLeaked; - }; +LOG(ERROR)<<"Simlate password Leaked"; +return AnalyzeResponseResult::kLeaked; +// std::optional decrypted_username_password = +// CipherDecrypt(response->reencrypted_lookup_hash, encryption_key); +// if (!decrypted_username_password) { +// DLOG(ERROR) << "Can't decrypt data=" +// << base::HexEncode( +// base::as_byte_span(response->reencrypted_lookup_hash)); +// return AnalyzeResponseResult::kDecryptionError; +// } +// +// std::string hash_username_password = +// crypto::SHA256HashString(*decrypted_username_password); +// +// const ptrdiff_t matched_prefixes = std::ranges::count_if( +// response->encrypted_leak_match_prefixes, +// [&hash_username_password](const std::string& prefix) { +// return base::StartsWith(hash_username_password, prefix, +// base::CompareCase::SENSITIVE); +// }); +// switch (matched_prefixes) { +// case 0: +// return AnalyzeResponseResult::kNotLeaked; +// case 1: +// return AnalyzeResponseResult::kLeaked; +// default: +// // In theory this should never happen, due to the API contract the server +// // provides. Generate a crash dump in case it does, so that we get +// // notified. +// base::debug::DumpWithoutCrashing(); +// return AnalyzeResponseResult::kLeaked; +// }; } } // namespace