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

91 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
b01635bc45 Silence php notice.
- cast curl handle to integer prior to using it as an array key.
2016-06-08 13:51: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
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
7503d42699 Refactor.
- get rid of log_format() function.

- was only used in one place and it just complicates things.
2015-09-10 20:02:07 +02:00
Jean Paul Galea
4b79e45683 Documentation. 2015-09-10 19:59:11 +02:00
Jean Paul Galea
bc660a1f34 Cosmetic. 2015-09-10 19:55:14 +02:00
Jean Paul Galea
4a8eeacf7a Refactor.
- $urls is already checked prior to invoking function.
2015-09-10 19:54:45 +02:00
Jean Paul Galea
1e4da5dac6 Rewrite ykval-munin-vallatency plugin.
- avoid having to use the same internal and label name,
	as it's problematic.

- internal name has a lot of restrictions:
	s/^[^A-Za-z_]/_/
	s/[^A-Za-z0-9_]/_/g

- which doesn't allow us to show proper label names,
	the names that users will see.

- label displays :80 or :443 depending on scheme.

- avoid ugliness with shortname() and instead use endpoints().
2015-09-08 16:41:15 +02:00
Jean Paul Galea
446d1c58ee Use underscore instead of colon for host/port.
- munin plugin only supports a-zA-Z0-9_ so colon will probably give us problems.
2015-09-08 14:56:02 +02:00
Jean Paul Galea
21b795b852 Rename function 2015-09-08 14:42:11 +02:00
Jean Paul Galea
f2604e751a Modify ykval-munin-vallatency plugin.
- use hostname (+ port if any) for graph name.

	i.e. if we have a sync URL:
		https://api.yubico.com:8080/wsapi/2.0/sync

	instead of having "api" as name,
		we have "api.yubico.com:8080".

- also avoid using regex and use parse_url() from php core instead.
2015-09-08 14:18:41 +02:00
Jean Paul Galea
58ba93d35f Drop half baked functionality in ykval-munin-vallatency.
- plugin assumed URL uses a hostname (no static ips)
	and that hostname resolves to both ipv4 and ipv6.

- if we want to differentiate stats between ipv4 and ipv6,
	we need to re-think this and do it in a smart way.

- for now we prefer to allow cURL to pick whatever IP it resolves,
	and run the latency test on that.

- signed off by Klas Lindfors.
2015-09-08 12:32:27 +02:00
Jean Paul Galea
99613cd5f4 Move function into ykval-common.php 2015-09-08 09:17:34 +02:00
Jean Paul Galea
17378733af Refactor.
- rename $curlopts -> $opts.
2015-07-22 19:48:43 +00:00
Jean Paul Galea
5fc6c1c37d Refactor. 2015-07-22 19:44:35 +00:00
Jean Paul Galea
6246aa5ab4 Refactor.
- rename $handle -> $ch.
2015-07-22 19:43:06 +00:00
Jean Paul Galea
9dfb9b9302 Refactor. 2015-07-22 19:41:25 +00:00
Jean Paul Galea
4c2d4414a0 Cosmetic changes. 2015-07-22 19:38:32 +00:00
Jean Paul Galea
bef2c0cd4a Cosmetic changes. 2015-07-22 19:21:45 +00:00
Jean Paul Galea
ca5e787452 Refactor. 2015-07-21 21:38:37 +00:00
Jean Paul Galea
2aa06ec0a3 Refactor sign function.
- this commit might affect LOG_DEBUG message,
    since now we log utf8_encode($qs) not $qs.

- this is probably what we want though,
    since we run hash_hmac on the latter.
2015-07-21 20:36:56 +00:00
Jean Paul Galea
b417759932 Update copyright year. 2015-07-20 20:01:16 +00:00
Jean Paul Galea
db0f55b818 Fix.
- fix bug introduced in a28ad6df69.
2015-07-18 00:07:22 +02:00
Jean Paul Galea
9e81b1fd72 Refactor.
- minor improvements.

- move $ret init right before it's used.

- use string substitution rather than concatenation.
2015-07-17 22:51:11 +02:00
Jean Paul Galea
c5b6b3c567 Refactor.
- retrieveURLasync() always returns FALSE on failure now,
	before it might have returned a string.

- use array_shift($a) to pop first element,
	safer than $a[0];

- this commit might affect what is written to LOG_DEBUG,
	since now we only write the YK-KSM message when we
	are certain to have a valid response.
2015-07-17 22:25:42 +02:00
Jean Paul Galea
107995fc24 Refactor.
- remove counter and use count($array) instead.
2015-07-17 22:06:13 +02:00
Jean Paul Galea
90b6511301 Cosmetic changes. 2015-07-17 22:04:09 +02:00
Jean Paul Galea
175dca8755 Refactor.
- $id never used.
2015-07-17 22:03:49 +02:00
Jean Paul Galea
4080adef81 Refactor.
- use string substitution rather than concatenation.
2015-07-17 22:00:11 +02:00
Jean Paul Galea
0bbb2e2a5e Cosmetic changes. 2015-07-17 21:57:16 +02:00
Jean Paul Galea
890a446063 Refactor.
- $mrc never used.
2015-07-17 21:55:46 +02:00
Jean Paul Galea
73943ba807 Cosmetic changes. 2015-07-17 21:54:51 +02:00
Jean Paul Galea
a28ad6df69 Refactor.
- enable strict comparison for sscanf result.

- use single quotes where possible.

- styling.
2015-07-17 21:50:28 +02:00
Jean Paul Galea
45ea62445c Cosmetic changes. 2015-07-17 21:38:00 +02:00
Jean Paul Galea
f3fc957431 Fix.
- introduced bug in 0d03c2be29.
2015-07-17 10:11:43 +02:00
Jean Paul Galea
069660e4ef Refactor.
- gmdate(, $x) already defaults to time()
2015-07-17 00:43:11 +02:00
Jean Paul Galea
b1df4deaf1 Refactor.
- unwrap getUTCTimeStamp()

- use gmdate() instead of
	date_default_timezone_set('UTC') + date()
2015-07-17 00:42:42 +02:00
Jean Paul Galea
ba82acf79b Refactor.
- $status is always set in invocation, and never to null.
2015-07-17 00:34:14 +02:00
Jean Paul Galea
c258997f51 Cosmetic changes.
- readability.
2015-07-17 00:33:53 +02:00
Jean Paul Galea
d502b644c0 Refactor.
- improve readability.
2015-07-17 00:29:22 +02:00
Jean Paul Galea
291bd32bae Refactor.
- after each sendResp() we had an exit;

- move exit; inside sendResp() function instead.
2015-07-16 22:47:16 +02:00
Jean Paul Galea
adb7a49608 Prettify. 2015-07-16 22:26:10 +02:00
Jean Paul Galea
6c0b62f77e Prettify hash_equals. 2015-07-16 22:19:47 +02:00
Jean Paul Galea
0d03c2be29 Unwrap, only used here. 2015-07-16 22:14:36 +02:00
Jean Paul Galea
057eb0b563 Removed dead code, second try.
- grep with -i switch.

- left UnixToDbTime...
	will refactor later and unwrap to plain date()

- left timestamp* methods in ykval-db,
	not used but might be useful while refactoring other code.
2015-07-16 22:07:39 +02:00
Jean Paul Galea
b4f9bd4939 Revert "Removed dead code."
This reverts commit 29deb6007d.

PHP functions are __not__ case-sensitive!
2015-07-16 15:44:35 +02:00
Jean Paul Galea
29deb6007d Removed dead code. 2015-07-16 14:26:14 +02:00
Jean Paul Galea
e76c5002f2 Drop php closing tags. 2015-07-15 15:14:25 +02:00