829 Commits

Author SHA1 Message Date
Andrew Ruthven
af458f9d90 Remove default expiry times, make 0 disabled. 2024-05-03 23:35:26 +12:00
Andrew Ruthven
3c475a283c Switch to using hash_hmac, SHA256 and bcrypt for caching credentials
We also use a locally set password (aka a pepper) to ensure that the contents
of memcached isn't sufficient to perform dictionary attacks on the cached
credentials.
2024-05-03 23:35:26 +12:00
Andrew Ruthven
55feb03139 Include the username in the log messages. 2024-05-03 23:35:26 +12:00
Andrew Ruthven
521594bc3f Add testing for LDAP with memcache 2024-05-03 23:35:25 +12:00
Andrew Ruthven
bd6a47bee6 Add tests for memcache 2024-05-03 23:34:43 +12:00
Andrew Ruthven
a02fffa4ca Ensure that request_id has no \r or \n characters. 2024-05-03 23:33:25 +12:00
Andrew Ruthven
87c3df891b Fix typo, remove sleep 60!! 2024-05-01 22:32:33 +12:00
Andrew Ruthven
c273b38234 Test adding non-existant LDAP user to a group
This is to tickle my suspicion of the bug as reported by Thorsten Marquardt
in https://sourceforge.net/p/davical/mailman/message/58766531/ with this
error message reported:

Exception [0] ldap_get_attributes(): Argument #2 ($entry) must be of
type LDAP\ResultEntry, false given
At line 718 of /usr/share/davical-master/inc/drivers_ldap.php

You need to look in 3da860e5d5e732c2dedb62a73c76608a2b7098a4 for that line
number as I've just made some improvements to the code.

I have also improved the SQL to check if the users have been added, and
discovered that the result file *did not* have them. This test was failing
due to the test config file looking for memberUid, not member. Also, fix
that.
2024-05-01 22:32:33 +12:00
Andrew Ruthven
569b20d92f Allow tests to provide configuration over rides
Written to provide scope for Apache2 config overrides as well (I
think I'll need these to add Kerberos testing...)
2024-05-01 22:32:33 +12:00
Andrew Ruthven
e900dff28e If a URL test fails, display the Apache Request ID to aid debugging
This helps with #311.
2024-04-02 00:11:30 +13:00
Andrew Ruthven
7c47658bee Make the curl and SQL requests when we see them
This allows us to have more complex test files where an action is taken, then
we test something, then another action is taken, etc.

Changes to test files are required so that URL is defined after all the
required settings are set.

Changes to the result files are either whitespace changes due to above logic
changes, or printing out a SQL Result header before each result. I figured it
was useful.
2024-04-01 22:57:10 +13:00
Andrew Ruthven
452b9fa2ef regression-suite/2701-generate-date-tests.pl needs Perl modules
f
2024-04-01 20:29:20 +13:00
Andrew Ruthven
d67c43790a Fix Free/Busy tests for iSchedule
We need to have some events in the time period being checked.

Note in the tests what they're trying to check.
2024-04-01 18:53:12 +13:00
Andrew Ruthven
c97a0719ff Slight wrapping change to lines in a test result, and now have ^M returned 2024-04-01 18:34:33 +13:00
Andrew Ruthven
7459a68b76 We need the sample data for tests for the test files to run 2024-04-01 18:34:33 +13:00
Andrew Ruthven
aaf89bed66 Trust the DKIM key used for ischedule tests 2024-03-30 20:10:41 +13:00
Andrew Ruthven
b26d48fced Put a trailing newline on error messages 2024-03-30 19:03:39 +13:00
Andrew Ruthven
4e03cb1343 Include the request ID used in logging in the Fatal Error message. 2024-03-11 00:41:37 +13:00
Andrew Ruthven
658bd4e786 Use request ID 2024-03-11 00:41:37 +13:00
Andrew Ruthven
f69480ce77 Test that deletion of a principal's items are secure
Test that other users can't delete:
 - collections
 - tickets
 - bindings

No significant change, just return an error message rather than assume that
things worked.
2024-03-10 00:37:11 +13:00
Andrew Ruthven
c5b3e385b3 Allow changing directory when running a script
This also involves changing scripts to be run at the time they're mentioned,
not accruing them to run at the end.
2024-03-03 21:30:22 +13:00
Andrew Ruthven
0c9e0d6a87 Test more dates in the past and future
There is now a Perl script that'll generate tests and result files to a
wide variety of dates. From this we currently don't support < 1 AD or >
9999 AD.

run_regressions is modified to remove the UNTIL option as I want to use a
character after the test number to allow "subtests".
2024-03-03 21:30:22 +13:00
Andrew Ruthven
9c10ef5eb2 Support start or end missing from free-busy-query REPORT
Previously if either start or end were missing then the current time was
used. This would almost never be the expected behaviour.
2024-03-03 21:30:21 +13:00
Andrew Ruthven
014ee35372 Rename the ICS file to match the test name 2024-03-01 23:42:56 +13:00
Andrew Ruthven
dd1e75d23d Eh, etag changed.
It is tempting to exclude etag from test result checks.
2024-03-01 23:42:55 +13:00
Andrew Ruthven
9421dbd7e3 Add an event in the year 500. 2024-03-01 23:42:53 +13:00
Andrew Ruthven
3defc7b266 Add test for an event in the far future 2024-03-01 23:42:50 +13:00
Benedikt Spranger
ce67c2c839 Add events starting before 1900 test
postgresql is fussy about dates before 1900. Add a test with a recuring
event startting before 1900.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2024-03-01 23:26:26 +13:00
Andrew Ruthven
cb2e4523f3 Add test for invalidating the CSRF token 2024-02-29 00:43:50 +13:00
Andrew Ruthven
0c28a4ffe6 Make CLI usage easier 2024-02-29 00:43:49 +13:00
Andrew Ruthven
974d7d3924 Check that all UI pages load without PHP warnings or deprecation messages 2024-02-29 00:43:49 +13:00
Andrew Ruthven
a102105f27 Hide many sections unless the user can modify the principal
There is potential to leak information when viewing the principal
page for another principal. I think it makes more sense to just
not include all of this information unles the user can change the
principal.
2024-02-29 00:43:49 +13:00
Andrew Ruthven
15e9231ae3 Unescape URLs passed in as external bindings.
Previously PHP was escaping things like ampersands, which then caused
us to have broken URLs.

These aren't displayed anywhere in the UI, so no need to encode them anywhere.

Closes #314.
2024-02-29 00:43:49 +13:00
Andrew Ruthven
59e4f2c929 If a test fails, bail out, the state will be indeterminate 2024-02-29 00:43:49 +13:00
Andrew Ruthven
8c378387c8 For consistency allow BEGIN for the SQL commands 2024-02-29 00:43:49 +13:00
Andrew Ruthven
c2a054d28e Add initial tests for the web UI
Use Test::WWW::Mechanize to test the UI.

Closes #310
2024-02-29 00:43:47 +13:00
Andrew Ruthven
5bd6d70383 Support using this script to test AWL as well 2024-02-25 23:04:17 +13:00
Andrew Ruthven
d7d7dd2ade Move the CI prep from repeated lines in the YML to a shell script
Oh, this is much easier to work with.

We can now detect the version of PostgreSQL installed and shouldn't
need to update CI just because PostgreSQL has been updated in Debian
Unstable.
2024-02-18 22:30:52 +13:00
Andrew Ruthven
28d9105810 Update database result results in tests. 2024-02-18 01:51:56 +13:00
Andrew Ruthven
e989e1cf97 Fix PROPFIND with Depth 1 if external bind is included
Previously something like this would be logged if debugging is enabled:

davical: LOG: Principal: Query: DBGQ: SELECT * FROM collection WHERE user_no= :user_no
davical: LOG: Principal: Query: DBGQ:  ":user_no" => ""
davical: BUG: :DAViCal Fatal Error: [42883] SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: integer = boolean\nLINE 1: SELECT * FROM collection WHERE user_no= FALSE\n                                              ^\nHINT:  No operator matches the given name and argument types. You might need to add explicit type casts. at /home/puck/work/Calendar/awl/inc/AwlDatabase.php:94

And this would be returned as a response:

DAViCal Fatal Error

user_no doesn't get set when construction the Collection for the external
bind, so, just handle that instead of sending the empty string to the
database as a user_no.

Modify the tests from ccc7e182ba4cbfba66a4fe96e1c0620e46390b95 to tickle the
bug.

Closes #175.
2024-02-18 01:51:56 +13:00
Andrew Ruthven
a065435a99 Create tests for 'external' calendars 2024-02-18 00:04:29 +13:00
Andrew Ruthven
eb4d120bbf Honour do_not_sync_from_ldap when sync'ing group members
This had been working as a side effect of the way the SQL insert
statement was working, but better to be explict about skipping them.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
9494256f03 Extend LDAP sync tests, test for DNs in member fields. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
146ab4d068 Update test results for database creation.
I've rebased onto master which has a new DB version.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
56d7d22d86 Rename mapping_field to user_mapping_field
This is to be consistent with group_mapping_field. The code is backwards
compatible with mapping_field.

In sync_LDAP_groups assign user_mapping once, not for every group.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
13083b07e8 Rename username to name in group mappings, drop unused fullname from example
Usinger "username" for the group name is confusing and misleading. Just
use name, but support our users who still have username.

We don't use fullname, drop it from the example.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
995fe296c4 All debug output goes to STDERR so not combined with test results 2024-02-17 02:25:25 +00:00
Andrew Ruthven
86cb62f404 is_head_request is only used once, simplify 2024-02-17 02:25:25 +00:00
Andrew Ruthven
b15c99fe1b Add tests for LDAP sync of users and groups. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
30b05549d0 Remove tests related to memcache, add BPS to copyright
I re-used some of the test LDAP logic from the test suite of Request
Tracker by BPS.
2024-02-17 02:25:25 +00:00