Comments (3)
I'd start by saying, if you want to get rid of the inline JS and CSS, then you don't need to call Securimage::getCaptchaHtml()
and instead, write custom HTML and JS for the captcha. This was just added to make it easier for default use cases and beginner level programmers to add a fully functional captcha to the form with little effort.
Can you provide an example of your CSP header and what you might envision for separating these options different from how they are now?
from securimage.
Thanks for the answer. My current CSP headers are
X-Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
X-WebKit-CSP: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'
and I'd like to get rid of 'unsafe-inline' by replacing all the inline stuff. Since there are the securimage.css and securimage.js files anyway, I think that outsourcing scripting/styling to them completely would be the best approach.
But yes, for now it looks like I'll have to use custom HTML and JS. I'll have a closer look at the Securimage code in the next few days and try to write an implementation without inline JS and CSS.
from securimage.
If your form and elements don't change, you can just take a rough copy of what getCaptchaHtml() gives you with the proper settings and then externalize the JS and CSS to a more permanent location.
The only reason it's dynamic now is for those with multiple captchas on a single page, or forms that might appear on numerous pages dynamically, and to save someone from having to write a bunch of custom HTML that is confusing for beginners just trying to add it to their form.
If you're not using audio, it's just a matter of moving the refresh code and any custom CSS to a static file. Audio will just need to know the name of the elements.
Let me know if you run into anything or have questions when you go forward.
from securimage.
Related Issues (20)
- Typo in PDO::purgeOldCodesFromDatabase() in master HOT 2
- Difference in captcha image reload functionally in the two branches HOT 1
- When using case sensitive captcha, the audio version just says the letter and not capital or lowercase letter
- Composer install post cmd error HOT 7
- [Bug reporting] multiple XSS in securimage
- secureimage.php – curley braces are deprecated HOT 1
- Redis setTimeout is deprecated consider changing to expire HOT 1
- php8 float conversion HOT 1
- Compatibility with PHP 8.2 HOT 1
- www.phpcaptcha.org domain for sale HOT 2
- dynamic property Securimage.... is deprecated in php 8.2 HOT 1
- New release? HOT 1
- Deprecated with php v8.2 HOT 1
- can't install via composer HOT 2
- captcha Audio with Captcha IDs
- Erreur: Undefined class constant 'SI_DRIVER_SQLITE3' in StorageAdapter/PDO.php file HOT 1
- Illegal string offset 'code' in securimage.php:1403 HOT 3
- Curly brace syntax
- Composer version HOT 3
- Project status HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from securimage.