{"id":24343098,"url":"https://github.com/integer-net/magento2-sansec-watch","last_synced_at":"2025-12-30T00:28:23.586Z","repository":{"id":260060218,"uuid":"880168688","full_name":"integer-net/magento2-sansec-watch","owner":"integer-net","description":"Sansec Watch integration for Magento 2","archived":false,"fork":false,"pushed_at":"2024-12-09T09:08:07.000Z","size":938,"stargazers_count":27,"open_issues_count":2,"forks_count":1,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-01-11T00:59:22.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/integer-net.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-29T08:45:04.000Z","updated_at":"2024-12-09T09:08:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"920aa2b4-29c5-4e19-8284-23be509d78c0","html_url":"https://github.com/integer-net/magento2-sansec-watch","commit_stats":null,"previous_names":["integer-net/magento2-sansec-watch"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integer-net%2Fmagento2-sansec-watch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integer-net%2Fmagento2-sansec-watch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integer-net%2Fmagento2-sansec-watch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/integer-net%2Fmagento2-sansec-watch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/integer-net","download_url":"https://codeload.github.com/integer-net/magento2-sansec-watch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234481267,"owners_count":18840206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-18T08:02:24.463Z","updated_at":"2025-12-30T00:28:23.580Z","avatar_url":"https://github.com/integer-net.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# IntegerNet_SansecWatch Module\n\nThis module allows the integration CSP rules from Sansec Watch (https://sansec.watch/) into Magento without the need for file manipulations and a re-deployment\n\n## Setup\n\n```shell\ncomposer require integer-net/magento2-sansec-watch\nbin/magento module:enable IntegerNet_SansecWatch\nbin/magento setup:upgrade\n```\n\n## Configuration\n\nThe configuration can be found under `Stores \u003e Configuration \u003e IntegerNet \u003e Sansec Watch`\nOnly the sansec watch project ID is needed, which can be found in the URL, if you navigate to https://sansec.watch/d/account/list and select a project\n(e.g. `685769a2-38a4-4d06-a19a-67a528197f51`)\n\n## How it works\n\nThe policies are fetched from the Sansec Watch API and saved into a database table (`integernet_sansecwatch_policies`)\nWhen Magento collects the CSP rules, it uses the `Magento\\Csp\\Model\\CompositePolicyCollector` class and this module adds\na collector to this class, which will read the policies from the database table and add them to the existing policies.\n\nOnce policies are fetched from Sansec Watch, the result will be hashed and further updates are only executed, if the\nnewly fetched policies differ from the existing ones. (This is handled via the entry `integernet_sansecwatch` in the `flag` table)\n\n### Full Page Cache (FPC)\n\nAfter policies are updated (either by an updated list from sansec watch or by force), the FPC will be, depending on the configuration either cleared, invalidated or ignored.\n\n## Usage\n\n### Backend\n\nDirectly below the configuration is a button, `Update Policies Now`, which will fetch and update the policies on demand.\nThis will do a forced update, where rules are updated, even if the hashes of the old and new policies match.\n\n### Command Line\n\nAn update can be triggered via `bin/magento integer-net:sansec-watch:update`\nThis will by default only update the policies if the hashes of the old and new policies doesn't match.\n\nA dry-run is possible by adding the `--dry-run` flag, which will only fetch and output the policies, but not update the \ndatabase table.\n\nIf an update should be force (regardless of the hashes), the `--force` flag can be added.\n\n### Cronjob\n\nThe policies are also fetched via the cronjob `integernet_sansecwatch_update`, which will run every hour (cron expression: `0 * * * *`)\nThis will also only update the database, if the hashes of the old and new policies do not match \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteger-net%2Fmagento2-sansec-watch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteger-net%2Fmagento2-sansec-watch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteger-net%2Fmagento2-sansec-watch/lists"}