Commit Graph

3616 Commits

Author SHA1 Message Date
Alex Xu (Hello71) bc6b02045e fs-mistrust: Improve BadPermission string
To me, "Incorrect permissions on file or directory /path: g=w o=w"
implies that the current permissions on /path are 022.

Change the message to "Incorrect permissions: /path is
u=rwx,g=rwx,o=rwx; need g-w,o-w", which is closer to chmod syntax and is
more useful in non-interactive environments such as CI and support.
2022-05-31 14:23:01 -04:00
Ian Jackson 2730bed5bd maint/add_warning: Convert remaining asserts 2022-05-31 19:16:09 +01:00
Alex Xu (Hello71) 201107906c fs-mistrust: BadPermission(_, _) -> BadPermission(..)
Next commit adds another parameter to Error::BadPermission.
2022-05-31 14:15:03 -04:00
Ian Jackson 6c52fa675b maint/add_warning: Introduce ImproperFile and convert one assert 2022-05-31 19:14:19 +01:00
Ian Jackson 7e96664140 maint/add_warning: Use python3 argparse 2022-05-31 19:03:38 +01:00
Nick Mathewson c8997b652a Add check_licenses to CI.
The artifact-caching logic is taken from other examples in the
.gitlab-ci.yml.
2022-05-31 14:01:21 -04:00
Nick Mathewson 842e6a697d check_licenses: list new crates with manual license verification
Closes #462.

Note that the license on `ring` is slightly problematic for some
users, including as it does old the openssl license[^1], with
advertising clause and all.  That's not a blocker for us now, since
`ring` is not a required dependency.  But we wouldn't want `ring` to
become a mandatory dependency because of this.

[^1]: To make the situation even more complicated, modern openssl
      has relicensed under apache-2.0, but that doesn't necessarily
      help us, since ring took its code from boringssll, which
      forked from an older version of openssl.
2022-05-31 13:58:40 -04:00
Ian Jackson 47a10fa84c maint/add_warning: Add "how to fix" to error message
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/557#note_2808879
2022-05-31 18:54:08 +01:00
Ian Jackson 3c3cdbcf9a maint/add_warning: Run with --check in CI 2022-05-31 18:54:08 +01:00
Ian Jackson 89b4a59048 maint/add_warning: Provide --check mode 2022-05-31 18:54:08 +01:00
Ian Jackson c2939b5f74 maint/add_warning: Change shebang to python3
"python" sometimes means Python 2.
2022-05-31 18:53:49 +01:00
Ian Jackson 00f82a7f4d maint/add_warning: Use .tmp~ for temp filename, not .bak
"bak" ought to be a backup file, with the old contents, which this
most definitely isn't.
2022-05-31 18:53:47 +01:00
Nick Mathewson a53b3d67d8 Merge branch 'data-stream-err' into 'main'
proto: Only ready a DataStream if CONNECTED was succesfully received

See merge request tpo/core/arti!556
2022-05-31 17:05:39 +00:00
Ian Jackson 9aec60871c Merge branch 'config-test' into 'main'
arti config: Check that example config is exhaustive

See merge request tpo/core/arti!546
2022-05-31 16:33:27 +00:00
trinity-1686a 1d41ae92c7 use the right feature name for llcrypto openssl 2022-05-31 18:27:51 +02:00
Ian Jackson 558ae0673d Merge branch 'self_digests_error_if_0' into 'main'
tor-dirclient: Require that self.digests is nonempty

See merge request tpo/core/arti!553
2022-05-31 16:21:28 +00:00
David Goulet 710709313b proto: Only ready a DataStream if CONNECTED was succesfully received
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-05-31 12:20:18 -04:00
Ian Jackson 89c4f76b6c tor-config: Suppress unwrap lint in tests
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/546#note_2808892
2022-05-31 16:58:14 +01:00
Nick Mathewson d707f6215e Merge branch 'config-desc' into 'main'
arti-config: Change description of tombstone crate

See merge request tpo/core/arti!558
2022-05-31 15:25:44 +00:00
Ian Jackson 5b684020ed tor-config: resolve_option tests: disable rsutfmt 2022-05-31 16:06:32 +01:00
Ian Jackson c2fa37c56a tor-config: Add comprehensive tests for resolve_option 2022-05-31 16:06:32 +01:00
Ian Jackson 32e4baa4c4 arti: Demote itertools back to dev-dependency 2022-05-31 15:45:07 +01:00
Ian Jackson c938eeb386 arti-config: Change description of tombstone crate
I was looking to see if we could delete this altogether but I
discovered that on lib.rs the description does not say it's a removed
crate, in the summaries.

Fix this.
2022-05-31 15:26:41 +01:00
Ian Jackson fec706c2f3 lints: Make lint blocks consistent
The remaining consequences of running add_warning
2022-05-31 15:24:11 +01:00
Ian Jackson 91b341de34 lints: arti-testing: Move some allows outside the auto block 2022-05-31 15:24:01 +01:00
Ian Jackson de92a295fb lints: tor-protover: Move two allows outside the auto block
These need to survive.
2022-05-31 15:24:01 +01:00
Ian Jackson 4f42101554 lints: Add let_unit_value allow to all crates
From running add_warning, with manual picking of the right
hunks/lines.
2022-05-31 15:23:52 +01:00
Nick Mathewson f67c0eaf50 Merge branch 'tor-config-tests' into 'main'
Add a few coverage-based tests to tor-config.

See merge request tpo/core/arti!540
2022-05-31 14:08:51 +00:00
Ian Jackson 2814fd99c1 lints: Add let_unit_value allow to add_warning
add_warning can now add allows.  This one was agreed in some other MR
for one crate.  Allow it everywhere.
2022-05-31 14:52:09 +01:00
Ian Jackson a8f3423107 lints: Add two missing ones to add_warning
These were in some crates, but not all.  Put them in add_warning
where they will propagate everywhere.
2022-05-31 14:52:09 +01:00
Ian Jackson 4634c1712b lints: arti: Move some allows outside the auto block
These need to survive.
2022-05-31 14:39:17 +01:00
Nick Mathewson ca94ec72ef Add a few coverage-based tests to tor-config.
There's nothing major here, but it does fill in a few gaps.
2022-05-31 08:59:30 -04:00
Nick Mathewson 9fed0b39fa Merge branch 'dbg' into 'main'
Revert "Remove dbg!()s in tor-config"

See merge request tpo/core/arti!552
2022-05-31 12:38:59 +00:00
Ian Jackson 47a209fb31 lints: maint/add_warning: New marker-based mode
We don't process the in-script lint block, just paste it in, now.
This is less complicated.

This reverts/replaces
  "maint/add_warnings: Make it add the markers for its future self"
2022-05-31 13:00:31 +01:00
Ian Jackson ba0843da4a lints: Add lint block delimiters to every crate
This was the result of:
  maint/add_warning crates/*/src/{lib,main}.rs
and then manually curating the results.
2022-05-31 13:00:31 +01:00
Ian Jackson 3ae7244f91 maint/add_warnings: Make it add the markers for its future self
We'll run this in a moment.  Then we'll revert it.
2022-05-31 13:00:31 +01:00
Ian Jackson 1351945d87 lints: arti-config: Re-add standard lint list
We are going to make lints the same for every crate.
2022-05-31 13:00:31 +01:00
Ian Jackson ea5caf9ac2 lints: maint/add_warning: Improve ordering
The crates we have aren't consistent.  But changing this means the
deltas resulting from the script are smaller.
2022-05-31 13:00:31 +01:00
Ian Jackson a8331c588e maint/add_warnings: Tidy up, and add some commentary
This puts the actually-used lint list at the top.

No functional change.
2022-05-31 13:00:31 +01:00
Ian Jackson eb49bc7f46 lints: Suppress unknown lints in a way that works on nightly too
This is ridiculous.
2022-05-31 13:00:21 +01:00
Neel Chauhan 04579c0328 tor-dirclient: Require that self.digests is nonempty 2022-05-30 11:46:54 -07:00
trinity-1686a 0f290da005 add support for openssl backend in llcrypto 2022-05-30 17:22:31 +02:00
Ian Jackson fe9fb6b6ee arti config: Check that example config is exhaustive
This is the final piece of #457.
2022-05-30 16:03:01 +01:00
Ian Jackson 0a324f843f mistrust: Canonicalise prefix from Some("") to None
This allows us to add the proper default example to the arti example
config file.
2022-05-30 16:00:45 +01:00
Ian Jackson ca60859dff arti: config: Canonicalise ports, and provide example dns_port
Now the validated configuration will never be `Some(0)`, even if that
is what was written in the config file.  The arti CLI parser can still
produce this, so we don't touch the code that actually uses this.

(Without the canonicalisation the default builder produces `None` for
the `dns_port`, but the example would produce `Some(0)`, which is
semantically identical but fails the test.)

See https://gitlab.torproject.org/tpo/core/arti/-/issues/488 for some
background.
2022-05-30 16:00:45 +01:00
Ian Jackson fbfaecdf72 config: Provide tor_config::resolve_option and resolve journald
Canonicalise the `logging.journald` setting in the validated
configuration.  Now it will never be `Some("")`, even if that is what
was written in the config file.

This allows us to write `journald = ""` in the example configuration.
(Without the canonicalisation the default builder produces `None` and
the example would produce `Some("")`, which are semantically identical
but fail the test.)

See https://gitlab.torproject.org/tpo/core/arti/-/issues/488 for some
background.
2022-05-30 16:00:45 +01:00
Ian Jackson fb54b5b032 arti: config example: Add entries for tor_network fields
These weren't previously discussed.  It's not practical or useful to
show the actual default values here.
2022-05-30 16:00:45 +01:00
Ian Jackson 116b6c30e0 arti: config example: Add some missing defaults
Found by my forthcoming test.
2022-05-30 16:00:45 +01:00
Ian Jackson d365d73889 arti: example config: Arrange to uncomment logfiles
This makes the config default parser see just "[ ]", an empty list,
which is indeed the default.
2022-05-30 16:00:45 +01:00
Ian Jackson b88c1c1093 tor-config: Drop Serialize and Deserialize from a test type
These violate our rule that *built* structs ought not to be desr.
But this is just in a test.
2022-05-30 16:00:45 +01:00