1
0
mirror of https://github.com/Yubico/yubikey-val.git synced 2024-11-29 00:24:13 +01:00
Commit Graph

133 Commits

Author SHA1 Message Date
Nigel Williams
2c133de5f3
Re-indent everything according to PEAR standard 2020-03-03 11:07:04 +11:00
James Alseth
d0e4db3245
Enhanced data validation to address YSA-2020-01
Co-authored-by: Marissa Nishimoto <marissa.nishimoto@yubico.com>
Co-authored-by: Gabriel Kihlman <g.kihlman@yubico.com>
Co-authored-by: Benno Rice <benno.rice@yubico.com>
Co-authored-by: Nigel Williams <nigel.williams@yubico.com>
2020-03-03 11:07:00 +11:00
Jean Paul Galea
24fb8be4c5 Refactor. 2016-05-17 11:08:34 +02:00
Jean Paul Galea
c6cbf17d7b Refactor.
- unset temporary variable.
2016-05-17 11:05:47 +02:00
Jean Paul Galea
4c1b58986d Fix.
- $request was never set if both $_POST and $_GET are empty!
2016-05-17 10:57:12 +02:00
Klas Lindfors
aaef07083a make getHttpVal() take the array to extract from
refactor so verify early finds out which of $_GET and $_POST to use and
then stick to using only that for the entire flow.

sync only works with GET anyways so use $_GET directly.
2016-04-29 15:42:37 +02:00
Jean Paul Galea
be784b8aaa Fix issue with $baseParam value.
- introduced recently in these log format changes.

- require_once 'ykval-config.php in logformat()
	did not import, because it takes place in ykval-verify.php.

- hence logformat() did not have $baseParams in scope,
	so we never write the log line.

- refactor and set format outside the class itself.
2016-04-18 16:38:39 +02:00
Jean Paul Galea
0838ecf56f Add sl and timeout to request log variables. 2016-04-18 16:33:00 +02:00
Jean Paul Galea
3edc7f077b Make it clear that default will be a string digit.
- since getHttpVal casts to string anyway.
2016-04-18 16:15:11 +02:00
Jean Paul Galea
714d6c9117 Avoid ambiguity with client id.
- getHttpVal always returns a string,
	so always treat $client as a string in other checks.
2016-04-18 16:10:42 +02:00
Jean Paul Galea
28c64e64fb Add tls and protocol variables to request log. 2016-04-18 15:40:04 +02:00
Jean Paul Galea
8a18cfea68 Rename variable. 2016-04-18 14:50:39 +02:00
Jean Paul Galea
c01c19c860 Add a verify request log line.
- Traditionally we wrote two lines for each ykval-verify.php call,
	'Request:' and 'Response:'.

- This commit allows us to log both request/response values in a single line.

- For backward compatibility, the old logging is kept in place.

- To write this line to syslog, __YKVAL_VERIFY_LOGFORMAT__ needs to be set.
2016-04-18 14:42:57 +02:00
Jean Paul Galea
cf3b089fcc Drop some comments.
- not really helpful, better to just depend on what the code does.
2015-09-15 19:54:23 +00:00
Jean Paul Galea
d0a8657e84 Avoid variable aliases. 2015-09-15 18:41:51 +00:00
Jean Paul Galea
c46d13da17 Refactor.
- simplify and avoid using different arrays with same values.

- build $otpParams from $otpinfo as soon as we have ksm result,
	then unset $otpinfo.

- futher down, only use $otpParams and $localParams.
2015-09-15 18:29:55 +00:00
Jean Paul Galea
8f8b8b8e8c Refactor and modify LOG_INFO message.
- as a result of this commit,
	key=val are separated with two spaces instead of one.
2015-09-15 17:37:49 +00:00
Jean Paul Galea
a577d0eb0c Avoid variable aliases. 2015-09-15 17:25:53 +00:00
Jean Paul Galea
28ec07af7f Avoid variable aliases. 2015-09-15 17:24:45 +00:00
Jean Paul Galea
8d6520964f Avoid variable aliases. 2015-09-15 17:24:04 +00:00
Jean Paul Galea
99e6d8586d Avoid variable aliases. 2015-09-15 16:34:34 +00:00
Jean Paul Galea
fbbc03dcee Avoid variable aliases. 2015-09-15 16:33:30 +00:00
Jean Paul Galea
6443bbc01c Avoid variable aliases. 2015-09-15 16:31:54 +00:00
Jean Paul Galea
ba29b63be1 Avoid variable aliases. 2015-09-15 16:29:07 +00:00
Jean Paul Galea
ad167cd38a Modified log messages.
- avoid doing what is already handled by the Log class.

- the log name is appended automatically,
	so don't append it again in the invocation.

	i.e. "ykval-verify"

- the log level name is also appended automatically,
	so don't append it manually, especially when it doesn't match the log priority!

	i.e. LOG_WARNING -> ":notice:"

- fix whitespace in some messages.
2015-09-10 20:53:56 +02:00
Jean Paul Galea
eec70dad47 Fix bug.
- argument to sprintf, not concat to first argument!
2015-09-09 15:11:08 +02:00
Jean Paul Galea
02f2e056b1 FIXME marker. 2015-08-12 11:02:40 +02:00
Jean Paul Galea
b106789217 Fix.
- fix bug introduced in 6181abee14.

- essentially, strftime() uses different format than date()
2015-07-24 14:50:02 +02:00
Jean Paul Galea
9704cf7ae1 Refactor.
- avoid unnecessary strtotime() call.

- instead of:
		strtotime(date('Y-m-d H:i:s', $timestamp))

	use:
		$timestamp

	since:
		$timestamp === strtotime(date('Y-m-d H:i:s', $timestamp))
2015-07-24 14:45:41 +02:00
Jean Paul Galea
6181abee14 Refactor.
- strftime -> date.

- strftime is same as date, but with locales.

- date format doesn't output names (January, March, etc.),
	so locale doesn't matter.

- also, would we really want locale in logs?
2015-07-24 14:35:30 +02:00
Jean Paul Galea
342ceac544 Modify log write.
- Log::log() internally support array implode,
	so no need to duplicate functionality.

- however, the internal implode uses two consecutive spaces as separator,
	so this will change the log format slightly.

	e.g. "delta=x now=y" becomes "delta=x  now=y"
2015-07-24 14:01:22 +02:00
Jean Paul Galea
c05a505b9c Refactor. 2015-07-24 13:54:49 +02:00
Jean Paul Galea
a6ad2e7d4b Cosmetic changes. 2015-07-24 10:55:34 +02:00
Jean Paul Galea
231c1ad0c5 Refactor. 2015-07-24 10:54:21 +02:00
Jean Paul Galea
1341227342 Refactor. 2015-07-24 10:50:21 +02:00
Jean Paul Galea
424fbdf962 FIXME markers. 2015-07-21 21:45:07 +00:00
Jean Paul Galea
da689f7de4 Cosmetic changes. 2015-07-21 21:38:46 +00:00
Jean Paul Galea
3572410b30 Better grouping.
- same as 1e799aa6e5.

- group $timeout filtering and validation.

- this commit might change replies sent to clients,
	since the validation check is done eaerlier now,
	and we might return S_MISSING_PARAM before S_BAD_OTP for example.

- this should really not cause any issues though,
	the order of which error is raised first should not matter to clients.
2015-07-21 21:27:33 +00:00
Jean Paul Galea
1e799aa6e5 Better grouping.
- group $sl filtering and validation.

- this commit might change replies sent to clients,
	since the validation check is done eaerlier now,
	and we might return S_MISSING_PARAM before S_BAD_OTP for example.

- this should really not cause any issues though,
	the order of which error is raised first should not matter to clients.
2015-07-21 21:17:59 +00:00
Jean Paul Galea
1e4453ccdf Refactor and unset after use. 2015-07-21 21:12:21 +00:00
Jean Paul Galea
82d5796245 Refactor. 2015-07-21 21:09:17 +00:00
Jean Paul Galea
262671f50b Refactor.
- single quotes.

- unset after use.

- don't wrap.
2015-07-21 21:05:16 +00:00
Jean Paul Galea
847f288cf5 Refactor. 2015-07-21 21:03:03 +00:00
Jean Paul Galea
11c160b05c Cosmetic changes. 2015-07-21 21:02:50 +00:00
Jean Paul Galea
e5238b8f54 Refactor.
- only add nonce to $extra array after check.
2015-07-21 20:56:02 +00:00
Jean Paul Galea
e24b02a7dc Refactor.
- $new_otp not used afterwards,
	clean up to avoid reuse by mistake.
2015-07-21 20:54:49 +00:00
Jean Paul Galea
84e867a6eb Better grouping.
- no functional affect whatsoever.
2015-07-21 20:53:13 +00:00
Jean Paul Galea
0749db6e8f More robust https check. 2015-07-21 20:49:17 +00:00
Jean Paul Galea
c5983f13eb Refactor. 2015-07-21 20:45:57 +00:00
Jean Paul Galea
06d037ef09 Refactor. 2015-07-21 20:44:53 +00:00