Giter VIP home page Giter VIP logo

mosparo / mosparo Goto Github PK

View Code? Open in Web Editor NEW
175.0 4.0 12.0 4.08 MB

The modern spam protection. Protects your forms from spam by simply checking the content. Open source, Free to use, Accessible, and Self-Hosted.

Home Page: https://mosparo.io

License: MIT License

Shell 0.06% JavaScript 3.99% SCSS 2.72% PHP 58.23% Twig 34.39% CSS 0.46% Dockerfile 0.15%
mosparo spam-detection spam-protection

mosparo's Introduction

 

mosparo logo contains a bird with the name Mo and the mosparo text

The modern spam protection tool.
It replaces other captcha methods with a simple and easy to use spam protection solution.
FYI: The bird is called Mo (the sparrow).


Description

mosparo is the modern solution to protect your online forms from spam. The protection method is simple: mosparo blocks spam based on rules matching the form's data. The detection method is comparable to an email spam filter. The user does not have to prove it is a real human by solving a puzzle. Instead, the tool scans the entered form data for words or other information which are not allowed. You can add different kinds of rules to catch all possible spam.

How it works

Spam filters are standard on email servers. There they scan a whole message to detect a possible spam message. Additionally, many settings can prevent spam mail (or at least make them better visible), like SPF, DKIM, etc. But the hard part is that the email is one message, and the spam filter must check the entire message. Since everything is together in one message, it can lead to false detection.

In web forms, the solution is more straightforward: since all fields are separated, we can check all fields separately. In one of the fields, the spam bot has to write, for example, the URL to the website or the message. Because of that, we can execute our checks for the field and detect spam very quickly - if there is a rule to detect spam.

Our target

We don't guarantee that mosparo will catch all your spam messages since the detection is mainly based on your rules. If you set up enough rules, we estimate that mosparo will block more than 80% of the spam messages.

Our main objective is a different one. Firstly, we wanted to create a solution that you can host on your server or web hosting that does not collect as much data as possible.

When we looked for ways to do that, we found that there wasn't a real solution for everyone. Many existing solutions require a puzzle that the user must resolve. For people with disabilities, solving puzzles is maybe not a good way to prove that they are real people.

We have therefore defined our main objective: to collect only data that is necessary, self-hosted, and accessible.

Key features

  • mosparo only uses the data which the user has entered in the form, the IP address of the user, and the user agent of the browser but does not collect other data
    • All user data are encrypted by default
    • All collected data are deleted in a fixed time interval. All data will be deleted after 14 days (maybe 15 days because of cronjob execution and so on)
  • Usable for everybody: the mosparo spam protection method does not use puzzles or obscured images to protect the form.
  • Open-source and self-hosted
  • The checkbox is customizable in size and the color

Requirements

  • PHP 8.1.10 or newer
  • PHP extensions
    • ctype
    • curl
    • dom
    • filter
    • gd
    • iconv
    • intl
    • json
    • libxml
    • openssl
    • pcre
    • pdo
    • pdo_mysql or pdo_pgsql
    • simplexml
    • tokenizer
    • xml
    • zip
    • posix (optional)
    • sodium (optional)
    • Zend OPcache (optional)
  • A MySQL (MySQL or MariaDB) or PostgreSQL database
  • Less than 100 MB of disk space
  • A domain or subdomain

Installation

Archived package

The installation is straightforward. There are different installation methods, but the primary method is to use the zip archive:

  1. Download the latest release from our website or the releases page on GitHub.
  2. Extract the file
  3. Create a new web host in your hosting control panel (like a new subdomain)
    1. If possible, point the document root of the web host to the subdirectory 'public'
  4. Upload all the files in the extracted directory to this new virtual host
  5. Open your browser and access the virtual host (for example, by accessing the subdomain in your browser)
  6. Follow the installation wizard to install mosparo

From source

To install mosparo from the source, clone the repository and execute Composer and Yarn to install the dependencies.

Requirements

  • git
  • Composer
  • Yarn
  • Node.js (18)

Installation

  1. Clone the repository
git clone [email protected]:mosparo/mosparo.git
  1. Switch to the repository directory
cd mosparo
  1. Execute composer
composer install
  1. Install the yarn dependencies
yarn install
  1. Build the frontend resources
yarn encore dev
  1. Open your browser and access the virtual host (for example, by accessing the subdomain in your browser)
  2. Follow the installation wizard to install mosparo

Documentation

You can find our documentation here: https://documentation.mosparo.io

License

mosparo is open-sourced software licensed under the MIT License. Please see the LICENSE file for the full license.

Contributing

See CONTRIBUTING

Translate mosparo

We're using Weblate to translate mosparo. If you want to help translate mosparo, please head over to our Weblate project: https://hosted.weblate.org/projects/mosparo/

Thank you for helping to make mosparo better.

mosparo's People

Contributors

0mal avatar albanobattistella avatar andrej730 avatar bittin avatar clxf12 avatar cnababaie avatar css31 avatar dependabot[bot] avatar digi92 avatar dinhitcom avatar encryptex avatar fim9 avatar haqbany avatar maronghappy avatar milotype avatar mpaglia0 avatar nathanbnm avatar oricat101 avatar pbrambi avatar ratingthomas avatar rezaalmanda avatar senya01 avatar somebaudy avatar stavpup avatar supermyskin avatar theonesu avatar user0020 avatar weblate avatar xqzhuang avatar zepich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mosparo's Issues

Replacement for ReCaptcha?

First up, thank you so much for the work that you've put into this project!

Now the question;

Is there a way to configure the operation to work like ReCaptchaV3?

My website form is set up (using Mautic* as the back-end) with ReCaptcha in 'silent mode'? There's no checkbox or button to click or puzzle to complete. For the form submitter, the experience is invisible.

*Mautic! Another open-source project!

Add export and import functionality

Discussed in #108

Originally posted by Digi92 June 26, 2023
Hi,
i think a function to copy an existing project would be nice.
A user might want to copy an existing project with all settings, rules and rule sets to use this as a basis for a new project.

To consider would be of course how the rights should look like.

What is your opinion about this?

Idea

Export functionality

  • Add an option to export a project's settings into a file. This includes all project settings (Name, Description, Hosts, Spam rating factor, security settings, design settings, all rules with all items, and all rulesets). It does not include submissions, project members, and the API keys as well as the project UUID.
  • The user can choose which parts should be included in the export. For example, general project data (Name, Description, Hosts, Spam rating factor), security settings, design settings, rules, or rulesets.
  • The user will download a JSON file with the selected data.

Import functionality

  • Add an option to import a project's settings from a file.
  • The user can choose which parts should be imported from the provided file. For example, the user can only import rules, not other things in the file.
  • The user can choose what the import process should do with existing rules. The user can either override the existing rules (remove additionally available items), append the not existing items to the existing rule, or add the rule as a new rule. All other data will be replaced if selected for import (project settings and rulesets).

Changes

  • Add the schema for the configuration file to the mosparo Specifications
  • Add the export functionality in the tools area
  • Add the import functionality in the tools area
  • Add a button (to go to the import functionality) in the project wizard to import directly (without going through all the wizard steps)
  • Add two commands to export and import the settings via CLI

Suggested by

Add filters to submission list

When a project receives a lot of submissions, the submission list is not very useful right now. If you see in the dashboard that you received a spam submission some days ago, you must scroll through the list to find this message.

To solve this problem, we should add filters with which you can filter the list and show only the filtered results.

Filters (at least):

  • Origin
  • Is Spam
  • Is Verified

For other fields (like IP address), we must check if it is possible (because some columns are encrypted in the database).

Add Brute Force Protection to the mosparo login

Discussed in #52

Originally posted by zepich April 26, 2023
To enhance the security of mosparo, adding brute force protection to the login functionality is an idea. After a specified number of unsuccessful logins, mosparo would block a user for a specific time. The count of these unsuccessful logins would be done by IP address.

Changes

  • Add a configuration interface in the Security Settings in the Administration interface.
  • Add the RateLimiter configuration in the Symfony config

Suggested by

  • @mosparo/core-developers

Return character in ip allow list field generating an error

Hello,
while testing the option "IP allow list".
I noticed that if there are one or more "return character (\r)" in the string, it comes to errors in "SecurityHelper->isIpOnAllowList".
This leads to the fact that Captcha cannot be loaded in the form.
In order to fix this I have replaced explode(PHP_EOL, $ipAllowList) with preg_split('/\r\n|\r|\n/', $ipAllowList)
replaced.
See explanation why: https://stackoverflow.com/a/29471912

Additionally it was not considered that Factory::parseAddressString and Subnet::parseString can return a "null" value.

My initial error:

Uncaught Error: Call to a member function getAddressType() on null {"exception":"[object] (Error(code: 0): Call to a member function getAddressType() on null at /var/www/htdocs/src/Helper/SecurityHelper.php:71)"} []

For this reason I have created a pull request that contains all the necessary changes: #55

Add a role to allow users to create projects

Explanation

Right now, every user can create new projects, but only the owner of a project can edit or delete one.

Since it's possible to have users with only read access, it should be impossible for them to create new projects.

A user can be configured to create new projects with this new role.

Administrators can always create projects, and the new field will be disabled for administrators.

Changes

  • Add role to the user management
  • Adjust the security settings
  • Adjust the project list page and remove the Create Project button if needed

Suggested by

  • @mosparo/core-developers

Invisible protection

Discussed in #53

Originally posted by zepich April 26, 2023
Sometimes, it would fit the design of a website better when the mosparo box is invisible. Technically, it would be possible to hide the mosparo checkbox. The protection in such a scenario would work as the following:

Setup process:

  1. The project owner chooses Invisible protection as the design type of the project in the mosparo design settings.
  2. Instead of designing the box, the user has to select the colors for the loading screen
  3. The user integrates mosparo into the form in the same way as right now

Frontend process:

  1. When the form gets loaded, mosparo initializes itself as right now, but without creating a visible checkbox.
  2. As soon as the user submits the form, mosparo starts the verification. Since the verification can take a moment, mosparo will show a full-screen overlay with a loading text. The design of this full-screen overlay will be configurable in the design settings and is completely adjustable by custom CSS on the website itself.
  3. After the verification is complete, the form will be submitted as normally

Suggested by @quadcom in #25

Changes

  • Add the additional design mode in the design settings.
  • Add the required options in the design settings.
  • Adjust the frontend styles to handle the invisible mode.
  • Adjust the frontend JavaScript to handle the invisible mode.
  • Adjust the hint in the wizard regarding advanced mode with the invisible mode.

Suggested by

Fix the CSP header on the design settings page

We've added the Content Security Policy header with v0.3.15. But on the design settings page, we must use the flag unsafe-inline for style-src and the data: flag for the img-src option.

These two things are unsafe and should be removed.

Since the color picker uses both of them (images via url(data:...) and style="...") we have to replace the color picker.

  • Replace the color picker
  • Replace the inline styles from mosparo directly
  • Remove the onKernelResponse event subscriber in the ProjectListener

Spam submissions get deleted too early

Because of a bug in the CleanupHelper, the spam submissions get deleted after 24 hours instead of 14 days.

https://github.com/mosparo/mosparo/blob/master/src/Helper/CleanupHelper.php#L69

The SQL statement must be adjusted to check if s.spam is 0 for the limitDay part. This part of the query is to delete valid but not submitted submissions because these user data are not required anymore (they did not submit, and the submission does not contain any spam, which means we have no reason to store the data any longer).

Ability to change flavor text in the advanced editor

I really love all the customization provided, but one thing that would be nice is the ability to change the flavor text for the captcha. "I accept that the form entries are checked for spam and stored encrypted for 14 days" is a bit too verbose IMO, and I'd personally like to change it to something simple like "Are you a robot?"

Timeout on getSubmissionDataForChart - to much data in query response

Hi,

we run a mosparo instance 0.4.3 and run into the following error after selecting the project and displaying the chart in the backend.
Error: Maximum execution time of 30 seconds exceeded at vendor/paragonie/sodium_compat/src/Core/Util.php:583)"}
We do have ~4000 submissions in the database.

The issue comes from Controller/ProjectRelated/DashboardController.php:getSubmissionDataForChart and selected the whole content from submissions.

This request took 8.6 seconds to fetch.

SELECT s0_.id AS id_0, s0_.validation_token AS validation_token_1, s0_.data AS data_2, s0_.signature AS signature_3, s0_.submitted_at AS submitted_at_4, s0_.verified_at AS verified_at_5, s0_.matched_rule_items AS matched_rule_items_6, s0_.ignored_fields AS ignored_fields_7, s0_.verified_fields AS verified_fields_8, s0_.general_verifications AS general_verifications_9, s0_.spam_rating AS spam_rating_10, s0_.spam AS spam_11, s0_.spam_detection_rating AS spam_detection_rating_12, s0_.valid AS valid_13, s0_.submit_token_id AS submit_token_id_14, s0_.project_id AS project_id_15 
FROM submission s0_ 
WHERE (s0_.spam = 1 OR s0_.valid IS NOT NULL) 
AND (s0_.project_id = 1)

If we limit the select to the necessary fields we could speed up the request because we only need 3 fields to display the chart (submittedAt, valid, spam).

SELECT s0_.submitted_at AS submitted_at_4, s0_.valid AS valid_13, s0_.spam AS spam_11
FROM submission s0_ 
WHERE (s0_.spam = 1 OR s0_.valid IS NOT NULL) 
AND (s0_.project_id = 1)

0.028 Sec

protected function getSubmissionDataForChart($entityManager): array
    {
        $noSpamSubmissionsData = $spamSubmissionsData = $this->createEmptyDateArray();

        $builder = $entityManager->createQueryBuilder();
        $builder
            ->select('s.submittedAt, s.valid, s.spam')
            ->from(Submission::class, 's')
            ->where('s.spam = 1')
            ->orWhere('s.valid IS NOT NULL');

        foreach ($builder->getQuery()->getResult() as $submission) {
            $dateKey = $submission['submittedAt']->format('Y-m-d');
            if ($submission['spam'] || !$submission['valid']) {
                if (!isset($spamSubmissionsData[$dateKey])) {
                    continue;
                }

                $spamSubmissionsData[$dateKey]++;
            } else if ($submission['valid']) {
                if (!isset($noSpamSubmissionsData[$dateKey])) {
                    continue;
                }

                $noSpamSubmissionsData[$dateKey]++;
            }
        }

        return [
            $this->convertIntoChartArray($noSpamSubmissionsData),
            $this->convertIntoChartArray($spamSubmissionsData),
            array_sum($noSpamSubmissionsData),
            array_sum($spamSubmissionsData)
        ];
    }

A different approach could be to cache all data in the past and only fetch the current day from the database.

What do you think how should we address this issue?

Add filter to rules list

Similar to the filter on the submission list page or in the ruleset detail view, adding a filter to the rules list page would help to make the list page more usable compared to right now, especially with a lot of rules.

Changes

  • Add the filter dropdown with the different rule types on the list page.
  • Filter the list for the selected rule type.

Suggested by

  • @mosparo/core-developers

Missing Content-Security-Policy header

Hi,
i noticed that Mosparo currently does not set Content-Security-Policy (CSP) headers, which are important security headers.

Therefore I have created a first draft with which these are set via the ".htaccess" file, but in my draft "script-src" and "style-src" are set with "unsafe-inline".

Pull request: #44

Cannot install on Plesk.

When I try to is install mosparo on Plesk. I get a internal server error.

In the logs I get the following error

[2023-05-09T06:48:52.533099+00:00] request.CRITICAL: Uncaught PHP Exception RuntimeException: "Session Storage was not able to create directory "/var/lib/php/sessions"." at /var/www/vhosts/DOMAIN/example.DOMAIN/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php line 49 {"exception":"[object] (RuntimeException(code: 0): Session Storage was not able to create directory \"/var/lib/php/sessions\". at /var/www/vhosts/DOMAIN/example.DOMAIN/vendor/symfony/http-foundation/Session/Storage/Handler/NativeFileSessionHandler.php:49)"} []

Refactor ruleset details page

Discussed in #101

Originally posted by Digi92 June 23, 2023
If a user includes larger rulesets in his project, it can quickly become cluttered in the detailed view.
Rulesets can contain many individual rules and the rules themselves can contain many items.
I think there should be some kind of pagination for both cases to keep it more clear.
I could also imagine that particularly large rulesets could generate a memory limit error while rendering the list view.

What is your opinion about this?

Changes

  • Replace the list of rules and items in the ruleset details view with a table. The table has to be sortable and needs a pagination. In the table, all rules in the ruleset are listed with a button on the right side to see the content of the rules.
  • When the user clicks on the button in the table, the user will see a new view with the details of the rule. This new view will also have a sortable table with pagination and lists all rule items in a rule.
  • The rules table should be filterable by choosing the rule types that should be visible in the table.

Suggested by

Error 500 with two-factor

Hello,
Another error 500 on QRCODE generation I think :
[2023-05-25T18:30:09.005183+00:00] request.CRITICAL: Uncaught PHP Exception Endroid\QrCode\Exception\GenerateImageException: "Unable to generate image: check your GD installation"
Thanks

Change lockout security feature

Right now, the lockout security feature counts every request. This can be a problem if the mosparo box, for example, is visible in the footer of a website. Every page will increase the counter; if the maximum is reached, the user sees the lockout message.

The better solution is to change the behavior of the lockout security feature.

With the new behavior, only the form data validation will count and increase the counter. After the user tries to validate the form data too often within the defined time frame, the subsequent request will be blocked.

The delay security feature will not be changed.

With this change, the delay feature can be used to add a delay if the user tries to load a contact form too many times, while the lockout feature can be used to block the user from validating the form if the user tried it too many times (brute force protection).

FK_DB055AF32B4057C1: Integrity constraint violation: 1451 Cannot delete or update a parent row

Hello,
i have mosparo version 0.3.20 on a small site in testing.
Now it has come to a database error, whereby the captach has displayed an error message.
I could also trigger the error with the command "mosparo:cleanup-database".

I fixed the error message by changing the "ON DELETE" of the foreign key "FK_DB055AF32B4057C1" of the "submission" table from "RESTRICT" to "CASCADE".
So the DELETE statement could be executed but i am not sure if this was the correct solution?

Error message from log:

[2023-06-21T13:21:32.072463+02:00] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: "An exception occurred while executing 'DELETE FROM submit_token WHERE (created_at < ? AND submission_id IS NULL) AND (submit_token.project_id = 2)' with params ["2023-06-20 13:21:32"]:  SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`captcha_api`.`submission`, CONSTRAINT `FK_DB055AF32B4057C1` FOREIGN KEY (`submit_token_id`) REFERENCES `submit_token` (`id`))" at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 68 {"exception":"[object] (Doctrine\\DBAL\\Exception\\ForeignKeyConstraintViolationException(code: 0): An exception occurred while executing 'DELETE FROM submit_token WHERE (created_at < ? AND submission_id IS NULL) AND (submit_token.project_id = 2)' with params [\"2023-06-20 13:21:32\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`captcha_api`.`submission`, CONSTRAINT `FK_DB055AF32B4057C1` FOREIGN KEY (`submit_token_id`) REFERENCES `submit_token` (`id`)) at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:68)\n[previous exception] [object] (Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`captcha_api`.`submission`, CONSTRAINT `FK_DB055AF32B4057C1` FOREIGN KEY (`submit_token_id`) REFERENCES `submit_token` (`id`)) at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18)\n[previous exception] [object] (PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`captcha_api`.`submission`, CONSTRAINT `FK_DB055AF32B4057C1` FOREIGN KEY (`submit_token_id`) REFERENCES `submit_token` (`id`)) at /vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)"} []

Project overview: Add List mode and filters

Discussed in #89

Originally posted by zepich June 13, 2023
The project overview can get messy if there are a lot of projects. For this situation, refactoring the project overview (and the dropdown) would be a good idea.

Add list mode
Instead of the boxes, a list mode with all the projects listed in a table form would be a good addition.

Add filter option
Add a search field and (maybe) additional filter options (active/inactive projects, empty projects) to filter the list of projects.

Add search field to the dropdown
The dropdown in the header should get a search field to search the project by name.

Changes

  • Add table list mode to the project list page with pagination.
  • Add a filter option to filter the list of visible projects on the project list page (not in the dropdown).
  • Add a search field to the list page and the dropdown.

Suggested by

  • @mosparo/core-developers

Fix locales for translations with script

For translations, which we stored with the locale and the script name (for example, zh_Hans/zh_Hant), we have to make sure that the translation is also used with the country-based locale (for example, zh_CN/zh_TW).

We currently require the locale with the script (zh_Hans/zh_Hant), so a person with the locale zh_CN/zh_TW will not see the correct translation.

JS - ResetState callback

Hi,
if I create a form where I want the submit button to remain disabled as long as the Mosparo captcha is not valid.
To do this, I would need to be able to disable the submit button again when the resetState function is called.
Which is not possible without a callback for the function „resetState“.

For this reason I have created a pull request that contains the necessary changes: #30

Add an option to override the frontend box strings

We got multiple requests to adjust the translation for the frontend box for a project. We discussed adding an interface in the backend to adjust the translations. But since that is a lot of work, it has no priority for us.

Today, @pBrambi suggested a solution that is easy to do for us and solves the problem perfectly.

Instead of adding an interface, we extend the JavaScript options for the frontend box. These options are customizable in many integrations (for example, in the WordPress plugin).

As a website owner, you can define the translations you would like to adjust (for example, the main box sentence) in the code of your website (for example, with a filter with the WordPress plugin). mosparo will then use the translation you provided for a language.

If you didn't provide a translation for a language, mosparo would use the translation shipped with mosparo. If no translation is available, the English translation will be used.

Problems with performing custom verification

Hi

First of all, sorry for the many issues.

I am currently working on a backed client for Mosparo, written in ColdFusion, that will eventually be made into a plugin for MasaCMS. I am currently working on the verification of the Form data but I'm having some issues with the Auth header.

I am generating the auth header as described in the docs.

  /**
   * Generates the authorization header for the API call.
   *
   * @param formData The data struct to be used in generating the header.
   */
  private void function getAuthorizationHeader(
    required struct formData,
    string publicKey = variables.publicKey,
    string privateKey = variables.privateKey
  ) {
    local.apiEndpoint = "/api/v1/verification/verify";
    local.hash = lCase(hmac(local.apiEndpoint & serializeJSON(arguments.formData), getPrivateKey(), 'HmacSHA256'));

    variables.authHeader = "#getPublicKey()#:#local.hash#";
  }

If I plug the example values from the example page into this function I get the same header as the example:
QqfBxsmOfIMw0-uVNnRVdDlMUZdLpTG1xo0yyifyLrI:3bdd385caa53e3da76a8dcbfcaa0d9f4e04d8c189fab03ba41383deea236b2d3

Despite all of that I keep getting the following response:

{
	"error":true,
	"errorMessage":"Authorization header invalid."
}

I just don't know what to do since I have done everything that the dec asks from me and I have been on this issue since the last 4 days. In the screenshot below you will find all the values that could be useful for debugging.
All forms of help are welcome :3
image

Also, all my code is available in this repo.

Kind regards,
Ori

Add configuration interface for reverse proxies

If you use mosparo with CloudFlare or other such providers, the IP address of the original client needs to be corrected. To get the correct IP address, the administrator must define the TRUSTED_PROXIES environment variable with the IP addresses of the reverse proxies. Additionally, some providers use different headers to send the correct client IP address.

A configuration interface should be added to make it easier to configure mosparo with a reverse proxy, where the administrator can configure the trusted proxies. Additionally, it should be possible to choose the header in which the client IP address is transmitted.

It should also be possible to choose from predefined providers like CloudFlare without searching their IP addresses in the documentation.

Inspired by #20

Add update check

Since it is hard to keep track of the new versions of mosparo, we should add an automatic update check.

If a new update is available, a hint (a badge or something like that) should be visible in the header, notifying the user that an update is available.

The system will not automatically install the update.

The check should be done once daily and (most likely) in a cronjob.

Dark theme

Add the dark theme from Tabler for the mosparo user interface.

Missing validation response at the onCheckForm

Hi,
if I create a form where I want the submit button to remain disabled as long as the Mosparo captcha is not valid.
If the validation failed, the submit button should remain disabled, but at the "onFormCheck" callback I don't get any information whether the check failed or not.
To do this, the callback „onFormCheck“ should be give the validation result as parameter on the callback call.

For this reason I have created a pull request that contains all the necessary changes: #32

Add `gd` as required extension

The 2FA process needs the gd extension, but this extension is not on the list of required extensions.

Add the gd extension as a requirement in

  • Setup
  • System Overview
  • Documentation
  • README.md

And search for other places.

Missing attribute "autocomplete" on password field

Hi,
we have run a small security test against the Mosparo backend.
The only result was that no "autocomplete='off'" is set for password fields.

For this reason I have created a pull request that contains the attribute on the password fields: 58

Add a rule tester

Discussed in #39

Originally posted by zepich April 16, 2023
The idea is to add a rule tester in the backend UI. With this rule tester, it is possible to test how the rules perform depending on the content you enter. With that, it's easier to optimize rules without waiting for the next spam message.

Changes

  • Add a 'Tools' menu item
  • Add the Rule Tester form, which allows the user to enter a value and choose its type (Text, Email address, URL, IP address, User-Agent), and if rules and rule sets should be used for the test.
  • After submitting the form, the entered value will be tested with the available rules and rule sets, and the user will see the test result (which rule caught the value and the points for it).

Suggested by

  • @mosparo/core-developers

Mosparo breaks after restarting Docker container

HI
I am running Mosparo in a Docker container and have recently encountered an issue. After shutting down the container and starting it back up, the container seems to break. When trying to access Mosparo, I receive a 500 error and the console displays the following message when attempting to open the dashboard:

2023-07-24 09:57:25 {"message":"Matched route \"frontend_api_request_submit_token\".","context":{"route":"frontend_api_request_submit_token","route_parameters":{"_route":"frontend_api_request_submit_token","_controller":"Mosparo\\Controller\\Api\\V1\\Frontend\\FrontendApiController::request"},"request_uri":"http://localhost:8080/api/v1/frontend/request-submit-token","method":"POST"},"level":200,"level_name":"INFO","channel":"request","datetime":"2023-07-24T07:57:25.294188+00:00","extra":{}}
2023-07-24 09:57:25 {"message":"Uncaught PHP Exception Doctrine\\DBAL\\Exception\\ConnectionException: \"An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused\" at /mosparo/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 101","context":{"exception":{"class":"Doctrine\\DBAL\\Exception\\ConnectionException","message":"An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:101","previous":{"class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","message":"SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28","previous":{"class":"PDOException","message":"SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php:33"}}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2023-07-24T07:57:25.312000+00:00","extra":{}}
2023-07-24 09:57:25 127.0.0.1 -  24/Jul/2023:07:57:24 +0000 "POST /index.php" 500
2023-07-24 09:57:57 {"message":"Matched route \"dashboard\".","context":{"route":"dashboard","route_parameters":{"_route":"dashboard","_controller":"Mosparo\\Controller\\ProjectRelated\\DashboardController::dashboard"},"request_uri":"http://localhost:8080/","method":"GET"},"level":200,"level_name":"INFO","channel":"request","datetime":"2023-07-24T07:57:57.092032+00:00","extra":{}}
2023-07-24 09:57:57 {"message":"Uncaught PHP Exception Doctrine\\DBAL\\Exception\\ConnectionException: \"An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused\" at /mosparo/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php line 101","context":{"exception":{"class":"Doctrine\\DBAL\\Exception\\ConnectionException","message":"An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php:101","previous":{"class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","message":"SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/PDO/Exception.php:28","previous":{"class":"PDOException","message":"SQLSTATE[HY000] [2002] Connection refused","code":2002,"file":"/mosparo/vendor/doctrine/dbal/src/Driver/PDO/MySQL/Driver.php:33"}}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2023-07-24T07:57:57.096822+00:00","extra":{}}
2023-07-24 09:57:57 127.0.0.1 -  24/Jul/2023:07:57:57 +0000 "GET /index.php" 500

If I set up a new container using the same image and DB container, it works flawlessly until I restart it.
Any help would be appreciated.

Wizard configuration database error 500

Hello,
On Ubuntu 22.04 + LAMP with PHP 8.2 & Mosparo 0.3.18
On wizard's step database configuration, I have an error 500 after submit form.
In logs :
php.CRITICAL: Uncaught Error: Undefined constant "XML_PI_NODE" {"exception":"[object] (Error(code: 0): Undefined constant
Thanks...

Session handling for support multi-server setups

Hi,

i noticed that Mosparo uses the default Symfony sessions handling, which does not work when the application is served from multiple servers.

Symfony Session Dokumentation: Symfony stores sessions in files by default. If your application is served by multiple servers, you'll need to use a database instead to make sessions work across different servers.

For this reason I have created a pull request that contains all the necessary changes to switch to database session handling: #26

Fixed the automatic update check if the updates are disabled

The new automatic update check we introduced in v0.4 is not working when the update functionality is generally turned off.

The idea is to inform the user about the available update, even if the update functionality is disabled. The user then knows an update is available and can manually check how to update (for example, by pulling the latest Docker image).

If the automatic update check is disabled, the check will not be performed.

Project wizard

After a new project is created, the user should be redirected to a wizard in which the user can configure the most important things about the project.

First, we will show the user the design settings in easy mode, where the user chooses the three colors (text, background, accent) and the size. In the next step, all four security features will be described and can be enabled directly.

In the last step, the user sees the information about the project needed to integrate it (host, UUID, public and private key).

The user can skip every step of the wizard.

Refactor design settings

Refactor the design settings and add an easy mode, making it easier for the user.

In the easy mode, the user will see three color fields to choose the text, the background, and the accent color of the place where the form will be visible. mosparo will calculate the other colors depending on a predefined color schema. Additionally, the user can choose the size of the box.

In the expert mode, all fields will be visible as they are now.

Check for the correct setup of cURL/HTTP client

In the setup, mosparo should check if the cURL extension is enabled and the curl_exec and curl_multi_exec methods are allowed or if allow_url_fopen is set to true.

A warning message should be visible if both things are missing. The setup should still work since the update and the ruleset feature are not directly required for mosparo to work correctly - but it's recommended to have at least the update feature functional.

Additionally, both features should check if the connection is possible and fatal errors should not be visible.

Error 500 on check version

Hi,
Occasionally I get a timeout when we check the version:
[2023-05-25T18:45:36.326678+00:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\HttpClient\Exception\TransportException: "fopen(https://104.238.666.666/stable.json): Failed to open stream: Connection timed out"
And when I try to update :
[2023-05-25T18:49:52.884020+00:00] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Filesystem\Exception\IOException: "Failed to create "/var/www/mosparo.mysite.com/public/update-log": mkdir(): Permission denied"
Another write permission ? on public ?
Thanks

Mosparo Custom Integration: Stylesheet not loading

I’m trying to integrate Mosparo onto my webpage and I’m running into an issue with the custom integration.

I’m linking the stylesheet as described in the Mosparo documentation:

<link href="#local.mosparoConfig.host#/resources/#local.mosparoConfig.uuid#.css" rel="stylesheet" />
However, my custom designs won’t load and only the default design is displayed. While debugging, I noticed that the URL of the stylesheet redirects me when opened in the browser:

<link href="#local.mosparoConfig.host#/resources/#local.mosparoConfig.uuid#/b9edfc8717218c1772c734cd39918c0ac138c0e4f462b72e66c1fd11f81bfe89.css" rel="stylesheet" />
If I enter this URL directly into the link tag, then the stylesheet loads without any issues.

My main question is: what is the part that comes after the UUID and where do I get it from? I can’t just enter it statically because I have to generate the URL dynamically (that’s why there are variables in the tag).

Regards, Ori

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.