Remove onion service descriptor-related errorkinds.

These have been subsumed by other errorkinds, mostly
OnionServiceProtocolViolation and TorProtocolViolation.

In particular please review the change in tor-hsclient closely;
I am not sure about the new errorkinds for the error there.
This commit is contained in:
Nick Mathewson 2023-06-22 13:11:06 -04:00
parent dbd2552178
commit 33bfa7c7a8
3 changed files with 2 additions and 52 deletions

View File

@ -482,10 +482,6 @@ where
#[cfg(feature = "onion-service-client")]
EK::OnionServiceNotFound => S::HS_DESC_NOT_FOUND,
#[cfg(feature = "onion-service-client")]
EK::OnionServiceDescriptorParsingFailed | EK::OnionServiceDescriptorValidationFailed => {
S::HS_DESC_INVALID
}
#[cfg(feature = "onion-service-client")]
EK::OnionServiceAddressInvalid => S::HS_BAD_ADDRESS,
#[cfg(feature = "onion-service-client")]
EK::OnionServiceMissingClientAuth => S::HS_MISSING_CLIENT_AUTH,

View File

@ -479,52 +479,6 @@ pub enum ErrorKind {
#[display(fmt = "Onion Service not running")]
OnionServiceNotRunning,
// TODO hs: We need this error type to also indicate the reason the error might've occurred:
// * If the outer layers of the descriptor are broken (i.e. the parts that are visible even
// without client authorization), then we'd expect any hsdir to reject hidden service's
// upload of the descriptor. If a number of hsdirs are serving broken descriptors for a
// service, we can assume some (or all) of them are being hostile (and intentionally serving
// mangled descriptors to DoS the service)
// * If the parsing error occurred in the inner layer, the problem is due to the hidden
// service rather than the hsdir that served the descriptor
//
// OnionServiceDescriptorParsingFailed will need to be split into 2 subtypes (one for errors
// that are potentially caused by malicious hsdirs, and another for errors caused by the
// service itself). We'll also need to add some additional information to `tor_netoc::Error`
// to be able to create this distinction.
//
/// Failed to obtain a valid descriptor for the target hidden service (`.onion` service).
///
/// None of the hidden service descriptors we found for this service could be parsed.
///
/// This error has several possible causes:
/// * We are running a version of the protocol that is incompatible with the version used
/// by the hidden service for advertising itself.
/// * All the directories we spoke to are malfunctioning and accepted the descriptor despite
/// it being broken in a way they can see. This could indicate that some or all of the
/// directories are hostile (i.e. conducting an attack)
#[cfg(feature = "experimental-api")]
#[display(fmt = "Onion Service descriptor parsing failed")]
OnionServiceDescriptorParsingFailed,
/// Failed to obtain a valid descriptor for the target hidden service (`.onion` service).
///
/// None of the hidden service descriptors we found for this service were valid (because
/// of an invalid signature, an untimely certificate,
/// or connection instructions we could not handle).
///
/// This error has several possible causes:
/// * Our clock is set incorrectly
/// * The clock of the hidden service is set incorrectly
/// * The service's Tor version is not compatible with ours
/// * The service is malfunctioning
/// * All the directories we spoke to are malfunctioning and accepted the descriptor despite
/// it being broken in a way they can see. This could indicate that some or all of the
/// directories are hostile (i.e. conducting an attack)
#[cfg(feature = "experimental-api")]
#[display(fmt = "Onion Service descriptor validation failed")]
OnionServiceDescriptorValidationFailed,
/// Protocol trouble involving the target hidden service (`.onion` service)
///
/// Something unexpected happened when trying to connect to the selected hidden service.

View File

@ -316,7 +316,7 @@ impl HasKind for ConnError {
match self {
CE::InvalidHsId => EK::InvalidStreamTarget,
CE::NoHsDirs => EK::TorDirectoryUnusable,
CE::NoUsableIntroPoints => EK::OnionServiceDescriptorValidationFailed,
CE::NoUsableIntroPoints => EK::OnionServiceProtocolViolation,
CE::Spawn { cause, .. } => cause.kind(),
CE::Bug(e) => e.kind(),
@ -393,7 +393,7 @@ impl HasKind for FailedAttemptError {
use ErrorKind as EK;
use FailedAttemptError as FAE;
match self {
FAE::UnusableIntro { .. } => EK::OnionServiceDescriptorValidationFailed,
FAE::UnusableIntro { .. } => EK::OnionServiceProtocolViolation,
FAE::RendezvousCircuitObtain { error, .. } => error.kind(),
FAE::RendezvousEstablish { error, .. } => error.kind(),
FAE::RendezvousCompletion { error, .. } => error.kind(),