summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/err.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-netdoc: impl From<std::convert::Infallible> for ErrorIan Jackson2026-06-111-0/+6
| | | | | | | This would let us use `.parse_arg::<String>()` in old parsing code. I wanted this for recommended versions, and then didn't use it, but it seems useful anyway.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+2
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* tor-netdoc: Rename FixedString to ConstantStringIan Jackson2026-05-271-3/+3
| | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3985#note_3413182 I left the word "fixed" in some of the docs and error messages, where it seemed to make sense.
* tor-netdoc: Provide FixedString and defined_fixed_stringIan Jackson2026-05-271-0/+14
| | | | We're going to want quite a lot of this for eg network-status-version.
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* Merge branch 'prop360-combined' into 'main'Nick Mathewson2025-07-101-0/+3
|\ | | | | | | | | | | | | Implement proposal 360 (limit HsDesc inflation opportunities) Closes #2046 See merge request tpo/core/arti!3070
| * netdoc: disallow extraneous space within final signature itemNick Mathewson2025-07-101-0/+3
| | | | | | | | Part of proposal 360.
* | Typo fixes (automatic and hand-verified)Nick Mathewson2025-07-091-1/+1
|/ | | | Made with https://crates.io/crates/typos-cli
* netdoc: Reject BOMs and NULs.Nick Mathewson2025-03-171-0/+6
| | | | | | | | | | | | Per <https://spec.torproject.org/dir-spec/netdoc.html>, our netdocs never have a BOM, and never have internal NULs. This makes Arti reject such documents. For arguments on why it's okay to increase parser strictness, see the (forthcoming) proposal 356 at torspec!342, and see older discussion at torspec#296. Closes #1739.
* Upgrade to derive_more version 1.0.0Nick Mathewson2024-09-251-34/+34
| | | | | | The `derive_more` crate broke backward compatibility with this version, so this change involved quite a few manual fixups. With luck, they'll keep compatibility for some while in the future.
* Resolve warnings about ambiguous/redundant doc linksNick Mathewson2023-08-221-1/+1
| | | | | Nightly rustdoc now warns if you have a link that isn't necessary, and if you have a link that might refer to two different things.
* Fix typosDimitris Apostolou2023-07-221-1/+1
|
* tor-netdoc: Test hsdescs inners with a variety of IPT countsIan Jackson2023-06-281-1/+1
|
* tor-netdoc: Reject hsdescs with no intro pointsIan Jackson2023-06-281-0/+3
| | | | None of the existing NetdocErrorKinds seemed right.
* netdoc: Introduce HsDescErrorNick Mathewson2023-06-221-8/+0
| | | | | | | | | | For higher-level HsDesc-related functions, this type indicates where exactly an error occurred. It lets us distinguish decryption errors from parsing errors, and attribute responsibility to the hsdir, the onion service, or the user's lack of encryption. This lets us remove some just-introduced complexity in tor-hsclient.
* Generate correct ErrorKinds for hsdesc decryption failures.Nick Mathewson2023-06-211-0/+8
| | | | Part of #736
* netdoc: Rename parse_error_kind() to netdoc_error_kind().Gabriela Moldovan2023-05-111-1/+1
| | | | | | | `ParseErrorKind` was renamed to `NetdocErrorKind`, so we need to rename this acccessor too. Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Remove experimental-api gate from parse_decrypt_validate.Gabriela Moldovan2023-05-101-3/+0
| | | | | | | | | | | | `parse_decrypt_validate` was marked as experimental because it was unclear if the newly added `BadTimeBound` error kind belongs in `ParseErrorKind`. However, we have since renamed `ParseErrorKind` to `NetdocErrorKind` and decided to keep the new variant, so this API doesn't need to be experimental anymore. Closes arti #852 Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`.Gabriela Moldovan2023-05-101-15/+13
| | | | | | | | | | | `ParseErrorSource` was originally meant to represent a parsing error, this enum has since gained some variants that aren't really parsing related (`Signature`, `CertSignature`, `UntimelyDescriptor`). Since this error type is now used for general-purpose netdoc errors, let's rename `ParseError{Kind, Source}` to `NetdocError{Kind, Source}`. Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Mark parse_decrypt_validate as experimental.Gabriela Moldovan2023-05-021-0/+5
| | | | Signed-off-by: Gabriela Moldovan <[email protected]>
* netdoc: Add a convenience method for HS descriptor parsing.Gabriela Moldovan2023-04-251-0/+7
| | | | | | | | | This adds the `HsDesc::parse_decrypt_validate` method, which parses, decrypts, and validates HS descriptors. Closes #809 Signed-off-by: Gabriela Moldovan <[email protected]>
* Replace `Option<Pos>` with `Pos` in `ParseError`.Nick Mathewson2022-11-151-20/+12
| | | | | | | | | | | | | | | We already have `Pos::Unknown` for an error at an unknown location and `Pos::None` for an error where no location is sensible. There's no reason to have an additional `Option` here. Additionally, the use of `Option` gave us a bug where our old `ParseError::at_pos()` method didn't actually set the position unless the position was already set. That's not what we want! Fixes #640. Finally, we have to fix a test that was a bit broken because it was working around #640.
* tor-netdoc: Add a new ErrorKind for EmptyLine.Nick Mathewson2022-11-151-0/+3
| | | | | Empty lines were previously reported as BadKeyword, which is confusing.
* tor-proto: split and elaborate tor_bytes::Error instancesNick Mathewson2022-06-231-0/+3
| | | | | | | | | Some of these were for decoding particular objects (we now say what kind of objects), and some were unrelated tor_cert errors that for some reason we had shoved into a tor_bytes::Error. There is now a separate tor_cert::CertError type, independent from tor_cert's use of `tor_bytes::Error` for parsing errors.
* Netdoc: add accessor to error for ParseErrorKindNick Mathewson2022-06-071-0/+5
| | | | | The kind type was already public, but we didn't give the user any way to get it.
* Resolve the new `derive_partial_eq_without_eq` lint.Nick Mathewson2022-05-231-1/+1
| | | | It's a little overzealous sometimes, but it's mostly to the good.
* Replace a match with some as_ref and asIan Jackson2022-03-161-4/+1
| | | | | | | The match was doing a deref coercion. Found by current nightly's needless_match (whose suggestion doesn't compile, https://github.com/rust-lang/rust-clippy/issues/8551 )
* Fix a rustdoc error.Nick Mathewson2022-02-151-1/+1
|
* Refactor tor-netdoc a bit more, to use Bug right.Nick Mathewson2022-02-151-4/+23
|
* Minimal compilation fix: InternalError=>BugNick Mathewson2022-02-151-2/+2
| | | | This is a followup for !314 and !310 to fix compilation on main.
* Refactor tor_netdoc::ErrorNick Mathewson2022-02-141-152/+199
| | | | | | | | | | | | | | | This error type doesn't impement HasKind, since the kind will depend on context. However, the existing implementation was pretty messy and inconsistent: Some errors had positions, some didn't. Some took messages as str, some as String. Some had internal errors that were somewhat orthogonal to their actual types. This commit refactors tor_netdoc::Error to use a ParseErrorKind, and adds a set of convenience functions to add positions and messages to the errors that need them.
* netdoc: Make doc-build errors a separate typeNick Mathewson2022-02-141-5/+14
| | | | | Every other case of tor_netdoc::Error means a parse failure. This one, though, means a failure to construct a document.
* netdoc: remove Error::Untimely.Nick Mathewson2022-02-141-11/+0
| | | | Nothing creates this.
* address clippy's latest lintDaniel Eades2021-12-201-0/+4
|
* Resolve roughly half of the XXXXs.Nick Mathewson2021-12-061-5/+5
| | | | | | | | We want to only use TODO in the codebase for non-blockers, and open tickets for anything that is a bigger blocker than a TODO. These XXXXs seem like definite non-blockers to me. Part of arti#231.
* Document every macro.Nick Mathewson2021-09-071-0/+2
| | | | | (The nightly version of clippy now includes macros for its missing_docs_in_private_items lint.)
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+423
This will cause some pain for now, but now is really the best time to do this kind of thing.