-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(login-flow-v2): Restrict allowed apps by user agent check #50650
base: master
Are you sure you want to change the base?
feat(login-flow-v2): Restrict allowed apps by user agent check #50650
Conversation
} catch (DoesNotExistException $e) { | ||
throw new LoginFlowV2NotFoundException('Login token invalid'); | ||
} | ||
|
||
$allowedAgents = $this->config->getSystemValue('core.login_flow_v2.allowed_user_agents', []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this should be an app or system config value.
But if this should be, as it is now, a system config value then please add it with documentation to config/config.sample.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would say system config is good once documented 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure either, but apart from that code looks fine.
Enable via: ./occ config:system:set core.login_flow_v2.allowed_user_agents 0 --value '/Custom Foo Client/i' ./occ config:system:set core.login_flow_v2.allowed_user_agents 1 --value '/Custom Bar Client/i' if user agent string is unknown the template with "Access forbidden"-"Please use original client" will be displayed Signed-off-by: Misha M.-Kupriyanov <[email protected]>
b467dcc
to
1ce7ca2
Compare
add config value to
config.php
:or via occ
./occ config:system:set core.login_flow_v2.allowed_user_agents 0 --value '/Custom Foo/i'
Test Allowed client
click on generated
login
url.Test Forbidden client
click on generated
![Selection_20250204-003](https://private-user-images.githubusercontent.com/145785698/409967751-93a0a111-abc7-423e-8db2-4dbc4fc6a205.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODA0NTcsIm5iZiI6MTczOTA4MDE1NywicGF0aCI6Ii8xNDU3ODU2OTgvNDA5OTY3NzUxLTkzYTBhMTExLWFiYzctNDIzZS04ZGIyLTRkYmM0ZmM2YTIwNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwNTQ5MTdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iNGQ1YzNmNTZkM2MyNTBhMTJjMDM1Njk3ZWM1OTY0OWRiNGI3ZWE0NmYzMDVlOTM0M2Q3YzZkNDkzYTdmOGY5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.GVSv1qf1ouRIp6C61zsiYJxWjZBNCwvVpEtIWGoMQcQ)
login
url.observe
Unitests
phpunit-autotest-core.xml
filephpunit-autotest-core.xml
Checklist