89 Commits

Author SHA1 Message Date
SXN31
f2971a1a35
Support usernames containing brackets (#3365)
* wrapped $user in preg_quote function
* updated auth test for special character in username

Co-authored-by: Léo Colombaro <git@colombaro.fr>
Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
2023-02-11 17:26:37 +01:00
Léo Colombaro
520dae65c1
Support PHP 8.2 (#3474) 2022-12-11 22:25:22 +01:00
྅༻ Ǭɀħ ༄༆ཉ
6da30dfab0
Add missing inline documentation (#3325) 2022-05-05 21:36:13 +02:00
྅༻ Ǭɀħ ༄༆ཉ
9def41dba8
Remove warnings on PHP 8.1 (#3317)
Also, minor code styles doc & typo
* Refactor yourls_filter_unique_id() to remove useless vars
* Comply with phpstan level 4
* add some tests to cover newly discovered potential issues
2022-05-02 08:09:18 +02:00
྅༻ Ǭɀħ ༄༆ཉ
ead7397c76
Promote docs.yourls.org (#3291) 2022-04-19 17:51:57 +02:00
྅༻ Ǭɀħ ༄༆ཉ
6c1fbd4325
Do not use md5() in yourls_salt() (#3278)
* Do not use md5() in yourls_salt()
* More tests while we're here

Fixes #3277
2022-04-09 19:32:04 +02:00
྅༻ Ǭɀħ ༄༆ཉ
1de256d869
Add nonce to the logout link (#3264)
* Add nonce to the logout link
* Add tests for cookies being set or reset
* More tests: check nonces are different for different actions & users

Fixes #3170
2022-04-02 13:49:37 +02:00
྅༻ Ǭɀħ ༄༆ཉ
402dfd0f6a
Explicitely exit after redirection where needed (#3257)
Fixes #3217
Would fix #2688 if it weren't already fixed
2022-03-20 20:54:03 +01:00
྅༻ Ǭɀħ ༄༆ཉ
b4131010bd
Remove ozh/phpass and use on password_* functions (#3232)
Fixes #3231
2022-02-25 18:23:41 +01:00
྅༻ Ǭɀħ ༄༆ཉ
385876ab37
Allow prefix n shortening without being logged in
Fixes #3189

- Allow prefix n shortening without being logged in
- Test checking for redirection on successful auth

Props @dan-r for the initial digging on this issue !
2022-01-09 18:27:55 +01:00
྅༻ Ǭɀħ ༄༆ཉ
1a7a60760d
Revert 3090 & fix tests (#3188) 2022-01-09 17:46:21 +01:00
Dan Raper
a52df700e3
Fix incorrect "prefix and shorten" notice while logged out
Fixes #2688

Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
2021-10-30 16:38:35 +02:00
྅༻ Ǭɀħ ༄༆ཉ
99ca70a9ef
Filterable user defined constants, and more tests (#3048) 2021-09-05 19:53:09 +02:00
Bryan Joshua Pedini
98697c3401
Prevent encryption warning when password provided via env (#3040)
Fixes #3038 

* added check for user provided from environment variables
* Add unit tests

Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
2021-09-01 19:30:19 +02:00
྅༻ Ǭɀħ ༄༆ཉ
0a70acdcfb
Minor security improvements (#3034)
* Prevent iframe jacking
* Enforce nonce on admin login screen
2021-08-24 18:10:08 +02:00
྅༻ Ǭɀħ ༄༆ཉ
fd4b927808
Split functions.php in smaller files
New function files for:
* debug
* options
* links
* geo
* shorturls
Fixes #2654

* Regroup and always load auth functions
Fixes #2662
Fixes #2661 

Co-authored-by: paulgoodchild <paulgoodchild@users.noreply.github.com>
2020-05-01 12:05:15 +02:00
྅༻ Ǭɀħ ༄༆ཉ
602e7dfe6f
Always return trimmed (and filtered) YOURLS_SITE (#2653)
Closes #2651
2020-04-19 12:38:27 +02:00
྅༻ Ǭɀħ ༄༆ཉ
7c0a750b1a
Accept timestamped signature with arbitrary hash (#2644)
* Allow arbitrary hashed signatures
* Force timestamps to int
* Improve comment
* Test new feature and add more tests
2020-04-12 18:52:35 +02:00
྅༻ Ǭɀħ ༄༆ཉ
0c66320a67
Enhance cookie functions (#2638)
* Add filters to auth and cookie functions

- move auth/nonce functions to functions-auth.php
- add filters, especially for auth cookie values

* Move debug function back to wrapper function

Makes more sense & easier to find.

* Support for SameSite attribute in cookies
2020-04-05 13:37:42 +02:00
྅༻ Ǭɀħ ༄༆ཉ
916377ddc5
Attempt at fixing #2603 and superseding #2545 (#2625)
* Attempt at fixing #2603 and superseding #2545

This all boils down to redirecting to $_SERVER['REQUEST_URI'] after successful login
Thanks @hangxingliu and @pcolmer for insightful feedbacks which has led to this PR

* Refactor slightly the redirect function

- no dying
- no output if we're on cli

* Update tests/includes/utils.php

Co-Authored-By: Léo Colombaro <git@colombaro.fr>

* Update includes/functions.php

Co-Authored-By: Léo Colombaro <git@colombaro.fr>

* Rewrite yourls_get_request()

Do not rely on HOSTNAME, HTTP_HOST or whatever, just use YOURLS_SITE

* Remove leftover comment

[skip ci] [skip scrutinizer]

Co-authored-by: Léo Colombaro <git@colombaro.fr>
2020-03-25 14:41:20 +01:00
Wocanilo
9e36c67b01 Fix Type Juggling Bypass in Auth Functions 2019-08-07 02:25:11 +02:00
ozh
a755711a7e Move 3rd party stuff in vendor 2017-05-18 19:46:09 +02:00
ozh
0571793c0b Update phpass
Use more modern package from hautelook/phpass, but keep 5.3-5.5 compat
Also, remove that test file. This should never have been included in the first place.
2017-04-20 11:12:05 +02:00
ozh
8eb48f3b0f Some phpdoc while we're here
[skip ci]
2017-04-19 23:34:10 +02:00
ozh
18c104854d No more PHP 5.2 checks 2017-04-19 23:30:13 +02:00
ozh
eb18020ef0 Remove password verification 2017-04-19 23:27:19 +02:00
ozh
5a95b54ebc More readable argument. 2017-03-25 19:59:44 +01:00
ozh
c6de7fa270 Fix redirection after logging
Fixes #2213. Fixes #2206.
2017-03-25 19:35:20 +01:00
ozh
6748ce8a94 Introduce yourls_sanitize_url_safe()
Remove anti CRLF checks from yourls_sanitize_url() and yourls_esc_url() because some legit URLs have %0A or %0D
We're just stripping those, using new function yourls_sanitize_url_safe(), for internal redirection when target location isn't hardcoded.
2017-02-05 16:04:50 +01:00
Bernd Blume
b1ae1ab707 fixed preg_quote to make password auto encryption work even when password contains forward slashes 2015-11-26 17:35:50 -08:00
ozh
b5be1a92e9 Avoid notices during unit tests 2015-05-21 23:15:55 +02:00
ozh
fc69856230 Remove static var
- this makes testing impossible once a value has been set
- this prevents the function to be actually shuntable after the value has been set
2015-05-18 21:42:24 +02:00
ozh
e87ec0b194 Oopsie, EOF newline 2014-10-28 21:28:59 +01:00
ozh
76c993789f Delegate cookie name to its own function 2014-10-28 21:23:04 +01:00
ozh
8060984374 Unique cookie name per install 2014-10-28 21:06:28 +01:00
ozh
29aa4631d4 Add debug info if auth cookie cannot be stored
See #1754 https://github.com/YOURLS/YOURLS/issues/1754#issuecomment-54304363
2014-09-04 13:15:55 +02:00
ozh
3b03a3ea79 Introduce function yourls_debug_log() 2013-12-26 15:40:47 +01:00
LeoColomb
e16834c46d Fix unstored cookie on localhost
Fix #1562
2013-12-10 19:24:16 +01:00
ozh
0545dd4291 Make yourls_hash_passwords_now() independent from globals
This will allow to unit test that function on an arbitrary file
2013-09-06 11:45:34 +02:00
ozh
5d2b954518 Pass parameter to yourls_hash_passwords_now(). Will make tests easier. 2013-09-05 23:34:45 +02:00
LeoColomb
10e00cb0f5 Be sure to have REQUEST_URI before trying redirection 2013-09-02 19:05:32 +02:00
ozh
ee8e4a52c6 Further improvements
- offload phpass functions to their own reusable functions
- clean option table after config has been hashed
2013-06-12 21:12:12 +02:00
ozh
834691fa1d More checks, a few comments, and the phpass test file 2013-06-12 18:56:07 +02:00
ozh
06013f047c Fixing and improving stuff on @nicwaller's patch
- works with "login" => "pass" and 'login' => 'pass'
- works with malformed arrays
- works with any password & special chars
- better error reporting
- l10n instead of hardcoded strings
- less var declared
2013-06-12 16:51:49 +02:00
Nic Waller
0181509b1a Minor typographical fixes 2013-06-05 04:58:13 +00:00
Nic Waller
931c4f306b Gently notify the user when config.php is unwritable 2013-06-05 04:53:34 +00:00
Nic Waller
9b6b9f70f3 Sessions are independent of passwords 2013-06-04 04:44:12 +00:00
Nic Waller
bd1d64a1b9 Rewrite config.php with password hashes 2013-06-02 22:13:34 -07:00
Nic Waller
3739a094be More secure password hashes with PHPASS 2013-06-03 01:49:27 +00:00
ozh
445b32a0f5 Handle custom notice upon login 2013-05-07 18:15:12 +02:00