Commit Graph

4098 Commits

Author SHA1 Message Date
GMDSantana 03a3777129
Create temporary files in a temporary directory
But keep it if tests fail.

Closes #1061
2024-04-12 11:06:30 +02:00
James Lu 3e5291f6d2 ircdb.checkIgnored: return False for messages from servers
These do not pass the `ircutils.isUserHostmask` check despite being a valid msg.prefix. We should probably return gracefully here instead of forcing plugins to deal with such a case themselves.

Closes GH-1548
2024-02-06 16:49:56 +01:00
James Lu 1fb0bbd1c0 Fix recursive loop in limnoria_reset_password
Closes GH-1565
2023-10-24 20:05:18 -07:00
Valentin Lorentz 18699b0cf2 Fix breakage of supybot.directories.data.web when it's a relative directory (the default) 2023-10-17 20:13:56 +02:00
Valentin Lorentz 15009caeff Remove requirement for supybot.directories.data.web to be a subdir of supybot.directories.data 2023-10-17 20:04:42 +02:00
Valentin Lorentz edb13f65df httpserver: Fix incorrect path joining 2023-10-17 19:00:54 +02:00
Matias Wilkman ec9e731fa5
Ignore trailing whitespace when addressing the bot by nick at end (#1563) 2023-10-08 19:07:08 +02:00
Valentin Lorentz 58287207d7 Socket: Fix hanging while TLS socket buffer is non-empty 2023-09-29 15:25:41 +02:00
Eric Mertens 9e82e3f16c Add command to manually initiate SASL 2023-09-05 20:13:21 +02:00
Valentin Lorentz f8dd8d7642 supybot-test: Add --clean-after option 2023-09-04 20:07:42 +02:00
Valentin Lorentz 6b778598bb --clean removes files before running tests, not after 2023-09-04 18:24:16 +02:00
Valentin Lorentz 8029e2b390 supybot-test: Ensure --clean doesn't leave 'backup' and 'test-logs' directories 2023-09-04 17:36:22 +02:00
Valentin Lorentz 2b4c5eb78f Fix crash when calling .reply(..., action=True) on ReplyIrcProxy
instead of on NestedCommandIrcProxy.

ReplyIrcProxy._sendReply expects action=True to imply noLengthCheck=True, but only
NestedCommandIrcProxy.reply() enforces the latter, not ReplyIrcProxy.reply().

This crash was introduced in 3c1c4a69e9 by
moving NestedCommandIrcProxy's .reply() to ReplyIrcProxy.
2023-07-18 07:46:51 +02:00
Valentin Lorentz 054ee6e410 Disable generic error reply when supybot.replies.error is empty 2023-07-11 21:34:49 +02:00
Valentin Lorentz eb002a31e9 wizard: Check language is supported
Otherwise it may raise InvalidRegistryValue on first start
2023-07-08 16:46:13 +02:00
Valentin Lorentz 8d1d4b84eb Fix error message on invalid 'supybot.language' value 2023-07-08 16:42:26 +02:00
James Lu b374418c81 irclib: fix mismatched arguments when logging IRCv3 cap responses 2023-06-30 20:07:45 -07:00
Val Lorentz 2902a85dbd
Fix STS parsing and handling of unchecked-TLS connections (#1524)
* ircutils: Fix incorrect log message on invalid STS policy

* STS: fix confusion over what a secure connection is

irclib computed 'secure_connection' when TLS is enabled and TLS certs
are checked; but ircutils used the value to parse STS policies, which
should only care about being TLS or not.

This commit fixes the incorrect parsing on unchecked-TLS, and triggers
a reconnect when a STS policy is encountered in this case, to force
TLS certs to be checked before storing the policy.

* Accept STS policies when reconnecting after getting it over cleartext

ircutils.parseStsPolicy() was passed self.driver.ssl which is the configured
value, even though the connection was forced to be TLS temporarily

* ci: Lower timeout

* Fix typo in test name

Co-authored-by: James Lu <james@overdrivenetworks.com>

---------

Co-authored-by: James Lu <james@overdrivenetworks.com>
2023-06-10 08:28:08 +02:00
James Lu 416a05e326
Route commands from Network.command back to the original network (#1540)
Add a replyIrc parameter to ReplyIrcProxy to run a command on one network, but route the replies to another.
This fixes a long standing issue where replies for remote commands are often lost to the void, as the nick of the caller may not exist on the target network (or worse, it could belong to a completely unrelated person).

Closes GH-556.

Co-authored-by: Val Lorentz <progval+git@progval.net>
2023-06-04 12:39:56 -07:00
James Lu 654937ecfc botchk: move imports to top-level 2023-05-26 20:27:39 -07:00
James Lu 3be1804553 botchk: fix syntax error 2023-04-27 18:36:50 -07:00
Valentin Lorentz 6f663e4140 Merge branch 'testing' into entrypoints 2023-04-26 18:04:21 +02:00
Valentin Lorentz add9306d30 Socket: Clear buffers on reconnect 2023-03-24 20:23:32 +01:00
Valentin Lorentz f518579c77 Request standard-replies capability
Arbitrary standard-replies are already supported, this signals to servers
that we do.
2023-02-21 19:10:11 +01:00
Valentin Lorentz efed7d8081 Move the 'ignore=False' trick from callbacks to Scheduler
I fear putting it in callbacks would be overzealous and reset it
within the processing of the same message, eg. when using conditional
to set the 'ignore' tag before other nested commands run.
2023-01-19 10:31:13 +01:00
Valentin Lorentz f409111872 callbacks: Fix interference between Scheduler.repeat, Anonymous, and nested commands
Specifically, the issue is with Anonymous using irc.noReply() in
the first call, preventing nested commands' result from being used.

Before this commit, the second and third responses in the test would be
only "1" and "2" instead of "1 ['foo']" and "2 ['foo']".
2023-01-19 10:19:01 +01:00
Valentin Lorentz 985ca23f71 Add tests for nicksToHostmasks 2022-11-23 19:25:12 +01:00
James Lu 73a23e220f IrcState: fix typo in attribute docs
capabilities_acq -> capabilities_ack
2022-11-06 18:38:24 -08:00
Valentin Lorentz 4da1291876 URL: Lazily deserialize records from the end in @last
Before this commit, the plugin first fetched a list of all
(deserialized) records in a list, then reversed the list, and iterated
on the reverse list.
This proved to be slow, with most of the time being spent in
`dbi.DB._newRecord` (which essentially deserializes one list of CSV).

After this commit, the list is reversed first, then the plugin iterates
on its generator, which calls `_newRecord` on records as they are
requested.

This means that when there are many URLs in the database, `@last` does
not need to waste time deserializing most records, when the result is
near the end (and if the result is the first record, then it does
exactly as much work as before).
2022-10-30 20:46:35 +01:00
Valentin Lorentz 77805ff36e irclib: Abort authentication when server fails SCRAM challenge
Will be tested by irctest:
https://github.com/progval/irctest/pull/179
2022-10-28 15:00:58 +02:00
Valentin Lorentz e9a29e9159 irclib: Fix crashes on ecdsa/scram signature failures 2022-10-28 14:57:57 +02:00
Valentin Lorentz b0525bcf42 Double default peekSize
We bumped it to 8kB in 2015, but it is starting to be an issue again.
2022-10-28 14:22:44 +02:00
Valentin Lorentz 009b900100 Make TimeoutQueue.iter() actually expire items
It is functionally fine not to, but causes objects to never be freed
if iter() is the only method called on the queue (ie. no
enqueue/dequeue, len(), ...)
2022-10-24 23:43:52 +02:00
Valentin Lorentz d0a484c11c Sort remaining nondeterministc sets of values
Closes GH-1516
2022-10-20 18:35:58 +02:00
Valentin Lorentz dc94f8dc68 registry: Default to sorting sets of values
Not sorting them causes the config file to change when the bot writes
it, because order is nondeterministic.

This is usually fine, but can be annoying when configs are deployed
with Ansible.

Closes GH-1516
2022-10-14 23:15:11 +02:00
Valentin Lorentz a6aa5530dd Ensure files written with AtomicFile are read in UTF8
With some locale configurations (not that uncommon on CentOS), open() may
default to non-UTF8 encodings (eg. ANSI_X3.4-1968).

This is usually not an issue, because we use open() both for writing and
reading. However, AtomicFile implicitly enforces UTF8; which needs to be
mirrored when reading.
2022-10-06 09:49:42 +02:00
Valentin Lorentz 35bf599856 utils/web: Add <br/> to the list of block elements
It should always be replaced with a space.
2022-09-20 07:51:46 +02:00
Valentin Lorentz 200acdfa93 registry: Normalize values before checking they are valid
Otherwise, normalization is useless, and gives a surprising error message,
such as:

```
<user> config plugins.rss.sortfeeditems oldestfirst
<bot> Error: Valid values include 'asInFeed', 'oldestFirst', 'newestFirst', 'outdatedFirst', and 'updatedFirst', not 'oldestFirst'.
```
2022-09-07 12:31:22 +02:00
Valentin Lorentz ef081746b1 commands: Silence noisy logging of command evaluation 2022-07-29 10:29:48 +02:00
Valentin Lorentz ee60431396 Add debug logging when skipping SASL mechanisms
It is useful to figure out what you forgot to configure
2022-07-29 10:03:39 +02:00
Valentin Lorentz f549ec12c6 Add debug logging of SASL mechanisms 2022-07-29 09:45:09 +02:00
Valentin Lorentz 96b7f51e71 callbacks: Ignore chathistory batches in PluginRegexp
This is consistent with what we already do with commands; and generally
makes sense, as we don't want to re-send titles and others when cycling
on UnrealIRCd (which includes a chathistory batch when joining when
chmode +H is set, despite umode +B)
2022-07-06 22:07:37 +02:00
Valentin Lorentz b3443a5a4c setup: Fix install of subpackages when pip-installed from git repositories
It seems setuptools needs to be explicitly told to include subpackages
in this case.
2022-06-22 20:31:59 +02:00
Valentin Lorentz 0572d49988 Use setuptools 'entry_points' instead of distutils-style 'scripts'
A future commit will add aliases for these scripts, and using entry_points
will make them easier to set up.
2022-06-17 11:45:31 +02:00
Valentin Lorentz fd04fccaec i18n: Validate value of supybot.language 2022-06-17 00:29:38 +02:00
Valentin Lorentz 93370b6f0e utils: Rewrite i18n initialization
The previous implementation was messy and needlessly complicated

This simplifies the logic and removes hackiness by making utils/str.py
handle internationalization logic itself, instead of bending over
backwards to load logic from the parent package at import time.
2022-06-17 00:05:51 +02:00
Valentin Lorentz 4a620bf7f0 Socket: Use the right variable to initialize the reconnect delay 2022-06-16 22:35:08 +02:00
Valentin Lorentz 94d669ebec Make the minimum reconnect delay configurable 2022-05-28 13:53:05 +02:00
Valentin Lorentz 32198d42c2 i18n: Skip fuzzy strings
The German translation currently has at least one fuzzy string
with a missing %s; and several translations are completely wrong.
2022-04-27 22:15:43 +02:00
Valentin Lorentz 109f938b0c Implement +draft/channel-context 2022-04-22 18:30:31 +02:00