Commit Graph

47 Commits

Author SHA1 Message Date
Aravinth Manivannan
2cf5e48d8e feat: log pow performance stats while pow verification 2023-06-30 03:19:38 +05:30
realaravinth
21825582e5 feat: fallabck to localhost when running tests 2022-08-09 16:29:24 +05:30
realaravinth
c377cf431e feat & fix: ip queues 2022-08-09 02:52:17 +05:30
Kian-Meng Ang
bb42841a66 Fix typos 2022-08-04 23:06:54 +08:00
realaravinth
249b6461ee chore: migrate tests to also run with mariadb 2022-07-23 11:59:42 +05:30
realaravinth
7d0e4c6be4 fix: prevent sitekey abuse with account secret authentication for access token validation
SUMMARY
    At present, sitekey can be abused by installing it on a third-party
    site as verifying the access token returned from CAPTCHA validation
    doesn't require any authentication.

    This fix uses account secret authentication to verify access tokens

credits: by @gusted
2022-07-22 19:44:35 +05:30
realaravinth
5daeffd6fb chore: tests to verify mCaptcha counter 2022-05-31 12:46:09 +05:30
realaravinth
629c841e2d chore: cleanup and addressing clippy lints 2022-05-27 18:37:59 +05:30
realaravinth
d7fd23f565 chore: get rid of direct DB init and use db_* 2022-05-27 18:25:27 +05:30
realaravinth
098d0cfc24 feat: migrate fetching stats to use db_* 2022-05-27 17:11:15 +05:30
realaravinth
bbc8873762 feat: migrate record_stats to use db_* 2022-05-27 16:23:33 +05:30
realaravinth
4cd4605266 chore: use local app ctx 2022-05-27 15:25:10 +05:30
realaravinth
d061824660 feat: migrate get captcha cooldown period to use db_* 2022-05-14 16:27:44 +05:30
realaravinth
a971d4209d fix and chore: refactor tests to minimize initializing DB connections
SUMMARY
    The test suite was spinning up way too many database connections that what's
    strictly needed and so the test suite was failing with[0]:
	code: "53300", message: "sorry, too many clients already"

EXPERIMENTS
    Tried sharing database connection pool across all tests with
    async_once[0] but faced:
	- IO errors
	    The connections were probably getting dropped in between tests
	- actix Actor errors
	    The actor was probably not getting initialized before a
	    a reference to the async_once initialized app
	    context(crate::data::Data) is retrieved and used

FIX
    crate::tests was spinning up an App context
    instance(crate::data::Data) for most utility functions, which was
    unnecessarily excessive.

    Each test now creates an instance of the application context at the
    beginning and shared a reference with all test utility functions. So
    number of database connections/app context instance = number of unit
    tests.

[0]: permanently fixes #22
[1]: https://docs.rs/async_once/latest/async_once/
2022-05-14 12:55:56 +05:30
realaravinth
176df3c7a7 feat: migrate get captcha levels to use db_* 2022-05-13 19:09:29 +05:30
realaravinth
81ad030338 feat: migrate captcha exists to use db_* interface 2022-05-12 19:32:08 +05:30
realaravinth
fc8a1670d2 update copyright notice 2022-01-08 22:16:05 +05:30
realaravinth
73ce2d1cb1 refactor captcha.rs and levels.rs and rm duration routes 2021-12-16 20:46:50 +05:30
realaravinth
b5af9ee259 it appears actix-web's scope behaviour has changed in the latest beta
release:

Routes 404'd when scope contained trailing slash like so:
let scope = "/api/v1/pow/";
web::scope(scope)//

So had to rm trailing slash in scope
2021-11-29 17:33:08 +05:30
realaravinth
a8c3eaa617 clean up systemgroup interface 2021-08-20 19:17:40 +05:30
realaravinth
147f563ec8 demo user task 2021-08-09 11:56:25 +05:30
realaravinth
1d759fcb25 captcha stats 2021-07-27 15:28:21 +05:30
realaravinth
f7c9217667 update and rename captcha plumbing 2021-07-19 17:12:56 +05:30
realaravinth
ea8264054a edit sitekey, router pattern matching, sitekey update optimization, rm level delete and level err handling 2021-07-16 17:40:52 +05:30
realaravinth
b7ec1bca22 duplicate email check and address clippy warnings 2021-07-11 21:46:50 +05:30
realaravinth
c05888d648 cargo fmt 2021-06-30 20:14:15 +05:30
realaravinth
9f940c317a upgrading to actix-v4-beta 2021-06-30 20:13:12 +05:30
realaravinth
dcfba60c86 addressing clippy lints 2021-06-11 23:39:38 +05:30
realaravinth
dc53cd76d4 CI: launch redis early 2021-06-11 19:47:49 +05:30
realaravinth
f5624947b9 redis storage for captcha mech 2021-06-11 19:31:03 +05:30
realaravinth
9e70f8f756 rename guard -> mcaptcha 2021-06-01 17:33:47 +05:30
realaravinth
fcdbe66b26 captcha stats 2021-05-27 14:47:29 +05:30
realaravinth
72667bd2e1 using custom version of actix-codegen and cors for pow routes 2021-05-25 14:34:24 +05:30
realaravinth
6b740a980b show password component 2021-05-14 16:33:18 +05:30
realaravinth
a4b409e914 sqlx offline compilation 2021-05-12 17:37:11 +05:30
realaravinth
91ca00ea79 get notifications 2021-05-10 15:38:09 +05:30
realaravinth
527724ecda pow stats for solution and verification 2021-05-09 19:33:28 +05:30
realaravinth
0829ee1c74 pow uses const routes 2021-05-02 17:13:04 +05:30
realaravinth
a82d61ed27 api endpoints migrated to use auth middleware 2021-05-01 23:39:52 +05:30
realaravinth
343c37ae1c changed login route 2021-04-30 18:06:28 +05:30
realaravinth
a5cfa3b305 pow stats 2021-04-30 11:14:29 +05:30
realaravinth
1b0dfd8082 routes updated 2021-04-12 10:45:53 +05:30
realaravinth
c776092023 scoped cors 2021-04-12 10:25:52 +05:30
realaravinth
bbf182a918 changes to test suite to use new routes 2021-04-11 23:50:53 +05:30
realaravinth
8851b1f7b7 cors for pow routes 2021-04-11 23:40:36 +05:30
realaravinth
0d1ba0d150 url prefix processing 2021-04-11 23:23:14 +05:30
realaravinth
a3f060350c moved pow to independent module 2021-04-11 22:57:56 +05:30