-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: Honeypot field appears when CSP is enabled #7029
Conversation
|
||
$config = new App(); | ||
$config->CSPEnabled = true; | ||
Factories::injectMock('config', 'App', $config); |
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.
Because CodeIgniter\HTTP\ContentSecurityPolicy
depends on config('App')
(and Response
pulls Services::csp()
), we must inject Config\App
into the Factories.
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.
Thanks for the explanation! We can also just use the factory version here:
config('App')->CSPEnabled = true;
But nothing wrong with the explicit version.
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.
Factories are reset each time during tests, so there is probably no problem with that way.
However, I do not think it is healthy that most framework classes depend on Factories (config()
).
It's not easy to get rid of this dependency now, but I would like to reduce it if possible.
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.
Looks good! One typo.
You sent this to 4.3 - is that your vote that we release 4.3 next? I believe we're ready.
|
||
$config = new App(); | ||
$config->CSPEnabled = true; | ||
Factories::injectMock('config', 'App', $config); |
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.
Thanks for the explanation! We can also just use the factory version here:
config('App')->CSPEnabled = true;
But nothing wrong with the explicit version.
Co-authored-by: MGatner <[email protected]>
I sent to 4.3 because this needs a new Config item. We merged two bug fixes into develop, so I would like to release v4.2.12 before v4.3.0. |
Description
From https://forum.codeigniter.com/showthread.php?tid=85960
Config\Honeypot::$containerId
How to Test
You will see
Fill This Field
before this PR.Checklist: