feat: mask client ip in audit log
This commit is contained in:
@@ -8,7 +8,7 @@ test('plugin metadata and packaging docs match project rules', function (): void
|
||||
assert_contains('name=mail-login', $conf);
|
||||
assert_contains('id=mail-login', $conf);
|
||||
assert_contains('type=user', $conf);
|
||||
assert_contains('version=1.0.7', $conf);
|
||||
assert_contains('version=1.0.8', $conf);
|
||||
assert_contains('user_run_as=root', $conf);
|
||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/src', $packing);
|
||||
assert_contains('/Users/marek/GPT/ChatGPT/da_plugins/mail-login/archives/X.Y.Z/mail-login.tar.gz', $packing);
|
||||
|
||||
@@ -8,6 +8,8 @@ test('settings expose secure defaults from plugin-settings.conf', function (): v
|
||||
|
||||
assert_same(30, $settings->loginKeyTtl());
|
||||
assert_true($settings->userIpBound());
|
||||
assert_true($settings->ipMask());
|
||||
assert_same('MASLED', $settings->auditClientIp('198.51.100.10'));
|
||||
assert_true($settings->defaultEnable());
|
||||
assert_same('login_url', $settings->method());
|
||||
assert_same(1, $settings->mxLoginMode());
|
||||
@@ -34,14 +36,28 @@ test('settings accept explicit ttl and user ip binding toggle', function (): voi
|
||||
$settings = Settings::fromArray([
|
||||
'LOGIN_KEY_TTL' => '5',
|
||||
'USER_IP_BOUND' => '0',
|
||||
'IP_MASK' => '0',
|
||||
'MX_LOGIN_MODE' => '2',
|
||||
]);
|
||||
|
||||
assert_same(5, $settings->loginKeyTtl());
|
||||
assert_false($settings->userIpBound());
|
||||
assert_false($settings->ipMask());
|
||||
assert_same('198.51.100.10', $settings->auditClientIp('198.51.100.10'));
|
||||
assert_same(2, $settings->mxLoginMode());
|
||||
});
|
||||
|
||||
test('settings reject unsupported ip mask values', function (): void {
|
||||
foreach (['yes', '2', ''] as $mask) {
|
||||
try {
|
||||
Settings::fromArray(['IP_MASK' => $mask]);
|
||||
throw new RuntimeException('Expected invalid IP_MASK to fail: ' . $mask);
|
||||
} catch (InvalidArgumentException $e) {
|
||||
assert_contains('IP_MASK', $e->getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('settings reject unsupported mx login mode values', function (): void {
|
||||
foreach (['0', '3', 'helper', ''] as $mode) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user