-
-
Notifications
You must be signed in to change notification settings - Fork 21
data protection #615
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
data protection #615
Changes from all commits
3bbef3b
b18aaea
5d0bd45
2c72e37
0356036
f02870a
06bb11e
12d51bb
2e8aaf3
647a732
510c25f
cad5aed
01be177
8c1bd67
0b3c1e4
c38ef7e
393429f
9d60798
c044c67
b55df03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,3 @@ | ||
| version: "3.8" | ||
|
|
||
| services: | ||
| app: | ||
| image: simplycodedsoftware/php:8.4.7 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| tests/ export-ignore | ||
| .coveralls.yml export-ignore | ||
| .gitattributes export-ignore | ||
| .gitignore export-ignore | ||
| behat.yaml export-ignore | ||
| phpstan.neon export-ignore | ||
| phpunit.xml export-ignore |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # These are supported funding model platforms | ||
|
|
||
| github: [dgafka] | ||
| patreon: # Replace with a single Open Collective username | ||
| open_collective: # Replace with a single Open Collective username | ||
| ko_fi: # Replace with a single Ko-fi username | ||
| tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
| community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
| liberapay: # Replace with a single Liberapay username | ||
| issuehunt: # Replace with a single IssueHunt username | ||
| otechie: # Replace with a single Otechie username | ||
| custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| name: This is Read-Only repository | ||
| about: Report at ecotoneframework/ecotone-dev | ||
| title: '' | ||
| labels: '' | ||
| assignees: '' | ||
|
|
||
| --- | ||
|
|
||
| Report issue at [ecotone-dev](ecotoneframework/ecotone-dev) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| .idea/ | ||
| vendor/ | ||
| bin/ | ||
| tests/coverage | ||
| !tests/coverage/.gitkeep | ||
| file | ||
| .phpunit.result.cache | ||
| composer.lock | ||
| phpunit.xml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| Copyright (c) 2025 Dariusz Gafka <support@simplycodedsoftware.com> | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
|
|
||
| **Scope of the License** | ||
|
|
||
| Apache-2.0 Licence applies to non Enterprise Functionalities of the Ecotone Framework. | ||
| Functionalities of the Ecotone Framework referred to as Enterprise functionalities, are not covered under the Apache-2.0 license. These functionalities are provided under a separate Enterprise License. | ||
| For details on the Enterprise License, please refer to the [LICENSE-ENTERPRISE](./LICENSE-ENTERPRISE) file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Copyright (c) 2025 Dariusz Gafka <support@simplycodedsoftware.com> | ||
|
|
||
| Licence is available at [ecotone.tech/documents/ecotone_enterprise_licence.pdf](https://ecotone.tech/documents/ecotone_enterprise_licence.pdf) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # This is Read Only Repository | ||
| To contribute make use of [Ecotone-Dev repository](https://github.com/ecotoneframework/ecotone-dev). | ||
|
|
||
| <p align="left"><a href="https://ecotone.tech" target="_blank"> | ||
| <img src="https://github.com/ecotoneframework/ecotone-dev/blob/main/ecotone_small.png?raw=true"> | ||
| </a></p> | ||
|
|
||
|  | ||
| [](https://packagist.org/packages/ecotone/ecotone) | ||
| [](https://packagist.org/packages/ecotone/ecotone) | ||
| [](https://packagist.org/packages/ecotone/ecotone) | ||
| [](https://packagist.org/packages/ecotone/ecotone) | ||
|
|
||
| The roots of Object Oriented Programming (OOP) were mainly about communication using Messages and logic encapsulation. | ||
| `Ecotone` aims to return to the origins of OOP, by providing tools which allows us to fully move the focus from Objects to Flows, from Data storage to Application Design, from Technicalities to Business logic. | ||
| Ecotone does that by making Messages first class-citizen in our Applications. | ||
|
|
||
| Thanks to being Message-Driven at the foundation level, Ecotone provides architecture which is resilient and scalable by default, making it possible for Developers to focus on business problems instead of technical concerns. | ||
| Together with declarative configuration and higher level building blocks, it makes the system design explicit, easy to follow and change no matter of Developers experience. | ||
|
|
||
| Visit main page [ecotone.tech](https://ecotone.tech) to learn more. | ||
|
|
||
| > Ecotone can be used with [Symfony](https://docs.ecotone.tech/modules/symfony-ddd-cqrs-event-sourcing) and [Laravel](https://docs.ecotone.tech/modules/laravel-ddd-cqrs-event-sourcing) frameworks, or any other framework using [Ecotone Lite](https://docs.ecotone.tech/install-php-service-bus#install-ecotone-lite-no-framework). | ||
| > | ||
| ## Getting started | ||
|
|
||
| The quickstart [page](https://docs.ecotone.tech/quick-start) of the | ||
| [reference guide](https://docs.ecotone.tech) provides a starting point for using Ecotone. | ||
| Read more on the [Ecotone's Blog](https://blog.ecotone.tech). | ||
|
|
||
| ## AI-Friendly Documentation | ||
|
|
||
| Ecotone provides AI-optimized documentation for use with AI assistants and code editors: | ||
|
|
||
| - **MCP Server**: `https://docs.ecotone.tech/~gitbook/mcp` - [Install in VSCode](vscode:mcp/install?%7B%22name%22%3A%22Ecotone%22%2C%22url%22%3A%22https%3A%2F%2Fdocs.ecotone.tech%2F~gitbook%2Fmcp%22%7D) | ||
| - **LLMs.txt**: [ecotone.tech/llms.txt](https://ecotone.tech/llms.txt) | ||
| - **Context7**: Available via [@upstash/context7-mcp](https://github.com/upstash/context7) | ||
|
|
||
| Learn more: [AI Integration Guide](https://docs.ecotone.tech/other/ai-integration) | ||
|
|
||
| ## Feature requests and issue reporting | ||
|
|
||
| Use [issue tracking system](https://github.com/ecotoneframework/ecotone-dev/issues) for new feature request and bugs. | ||
| Please verify that it's not already reported by someone else. | ||
|
|
||
| ## Contact | ||
|
|
||
| If you want to talk or ask questions about Ecotone | ||
|
|
||
| - [**Twitter**](https://twitter.com/EcotonePHP) | ||
| - **support@simplycodedsoftware.com** | ||
| - [**Community Channel**](https://discord.gg/GwM2BSuXeg) | ||
|
|
||
| ## Support Ecotone | ||
|
|
||
| If you want to help building and improving Ecotone consider becoming a sponsor: | ||
|
|
||
| - [Sponsor Ecotone](https://github.com/sponsors/dgafka) | ||
| - [Contribute to Ecotone](https://github.com/ecotoneframework/ecotone-dev). | ||
|
|
||
| ## Tags | ||
|
|
||
| PHP, DDD, CQRS, Event Sourcing, Symfony, Laravel, Service Bus, Event Driven Architecture, SOA, Events, Commands |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| { | ||
| "name": "ecotone/data-protection", | ||
| "license": [ | ||
| "Apache-2.0", | ||
| "proprietary" | ||
| ], | ||
| "homepage": "https://docs.ecotone.tech/", | ||
| "forum": "https://discord.gg/GwM2BSuXeg", | ||
| "type": "library", | ||
| "minimum-stability": "dev", | ||
| "prefer-stable": true, | ||
| "authors": [ | ||
| { | ||
| "name": "Dariusz Gafka", | ||
| "email": "support@simplycodedsoftware.com" | ||
| } | ||
| ], | ||
| "keywords": ["ecotone", "Encryption", "OpenSSL", "Data Protection", "Data Obfuscation"], | ||
| "description": "Extends Ecotone with Data Protection features allowing to obfuscate messages with sensitive data.", | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Ecotone\\DataProtection\\": "src" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "Test\\Ecotone\\DataProtection\\": [ | ||
| "tests" | ||
| ] | ||
| } | ||
| }, | ||
| "require": { | ||
| "ext-openssl": "*", | ||
| "ecotone/ecotone": "~1.298.0", | ||
| "ecotone/jms-converter": "~1.298.0", | ||
| "defuse/php-encryption": "^2.4" | ||
| }, | ||
| "require-dev": { | ||
| "phpunit/phpunit": "^9.5|^10.5|^11.0", | ||
| "phpstan/phpstan": "^1.8", | ||
| "psr/container": "^2.0", | ||
| "wikimedia/composer-merge-plugin": "^2.1" | ||
| }, | ||
| "scripts": { | ||
| "tests:phpstan": "vendor/bin/phpstan", | ||
| "tests:phpunit": "vendor/bin/phpunit --no-coverage --testdox", | ||
| "tests:ci": [ | ||
| "@tests:phpstan", | ||
| "@tests:phpunit" | ||
| ] | ||
| }, | ||
| "extra": { | ||
| "branch-alias": { | ||
| "dev-main": "1.298.0-dev" | ||
| }, | ||
| "ecotone": { | ||
| "repository": "data-protection" | ||
| }, | ||
| "merge-plugin": { | ||
| "include": [ | ||
| "../local_packages.json" | ||
| ] | ||
| }, | ||
| "license-info": { | ||
| "Apache-2.0": { | ||
| "name": "Apache License 2.0", | ||
| "url": "https://github.com/ecotoneframework/ecotone-dev/blob/main/LICENSE", | ||
| "description": "Allows to use non Enterprise features of Ecotone. For more information please write to support@simplycodedsoftware.com" | ||
| }, | ||
| "proprietary": { | ||
| "name": "Enterprise License", | ||
| "description": "Allows to use Enterprise features of Ecotone. For more information please write to support@simplycodedsoftware.com" | ||
| } | ||
| } | ||
| }, | ||
| "config": { | ||
| "allow-plugins": { | ||
| "wikimedia/composer-merge-plugin": true | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| parameters: | ||
| level: 1 | ||
| paths: | ||
| - src |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <phpunit | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" | ||
| backupGlobals="true" | ||
| > | ||
| <coverage processUncoveredFiles="true"> | ||
| <include> | ||
| <directory suffix=".php">./src</directory> | ||
| </include> | ||
| <report> | ||
| <text outputFile="php://stdout" showOnlySummary="true" /> | ||
| </report> | ||
| </coverage> | ||
| <testsuites> | ||
| <testsuite name="Unit Tests"> | ||
| <directory>tests</directory> | ||
| </testsuite> | ||
| </testsuites> | ||
| </phpunit> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * licence Enterprise | ||
| */ | ||
| namespace Ecotone\DataProtection\Attribute; | ||
|
|
||
| use Attribute; | ||
|
|
||
| #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS | Attribute::TARGET_PARAMETER)] | ||
unixslayer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| class Sensitive | ||
| { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * licence Enterprise | ||
| */ | ||
| declare(strict_types=1); | ||
|
|
||
| namespace Ecotone\DataProtection\Attribute; | ||
|
|
||
| use Attribute; | ||
|
|
||
| #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS | Attribute::TARGET_PARAMETER)] | ||
| class WithEncryptionKey | ||
| { | ||
| public function __construct(private ?string $encryptionKey = null) | ||
| { | ||
| } | ||
|
|
||
| public function encryptionKey(): ?string | ||
| { | ||
| return $this->encryptionKey; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,16 @@ | ||||||
| <?php | ||||||
|
|
||||||
| /** | ||||||
| * licence Enterprise | ||||||
| */ | ||||||
| namespace Ecotone\DataProtection\Attribute; | ||||||
|
|
||||||
| use Attribute; | ||||||
|
|
||||||
| #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)] | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
same suggestion as for Sensitive, to keep it on the param level. There is also no point in decoding metadata, if we are not using that in param, which with current design would be possible.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would keep this one as it is. just because header is not used in method parameters it can still be sent and if considered as sensitive, it should be obfuscated in queue.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think we should define the use case for those, because now they feel lacking intention, therefore being too generic,
If that's for inbound only, then it make to sense to keep it only for param, as we don't really care about the other ones.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dgafka I think right now it makes no sense to differentiate whether message would come from other system or it was sent by the same application. Whether this attribute should be omitted for TARGET_METHOD is a case for combining configuration from all sources - message, channel and endpoint - which would be trickier to understand why something was encrypted or not. Right now, if Message is annotated, any other configuration will be skipped as Message will always have a priority - I'm thinking about future converter integration. Lets keep it as it is. We can check how it is mostly used and adapt. |
||||||
| class WithSensitiveHeader | ||||||
| { | ||||||
| public function __construct(public string $header) | ||||||
| { | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
|
|
||
| namespace Ecotone\DataProtection\Configuration; | ||
|
|
||
| /** | ||
| * licence Enterprise | ||
| */ | ||
| class ChannelProtectionConfiguration | ||
| { | ||
| private function __construct( | ||
| private string $channelName, | ||
| private ?string $encryptionKey, | ||
| private bool $isPayloadSensitive, | ||
| private array $sensitiveHeaders, | ||
| ) { | ||
| } | ||
|
|
||
| public static function create(string $channelName, ?string $encryptionKey = null, $isPayloadSensitive = true, array $sensitiveHeaders = []): self | ||
| { | ||
| return new self($channelName, $encryptionKey, $isPayloadSensitive, $sensitiveHeaders); | ||
| } | ||
|
|
||
| public function channelName(): string | ||
| { | ||
| return $this->channelName; | ||
| } | ||
|
|
||
| public function obfuscatorConfig(): ObfuscatorConfig | ||
| { | ||
| return new ObfuscatorConfig($this->encryptionKey, $this->isPayloadSensitive, $this->sensitiveHeaders); | ||
| } | ||
|
|
||
| public function withSensitivePayload(bool $isPayloadSensitive): self | ||
| { | ||
| $config = clone $this; | ||
| $config->isPayloadSensitive = $isPayloadSensitive; | ||
|
|
||
| return $config; | ||
| } | ||
|
|
||
| public function withSensitiveHeader(string $sensitiveHeader): self | ||
| { | ||
| $config = clone $this; | ||
| $config->sensitiveHeaders[] = $sensitiveHeader; | ||
|
|
||
| return $config; | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.