186 Commits

Author SHA1 Message Date
Avgustin Marinov
e6c8215d05 Sonar Fixes (#2229)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-24 10:08:31 +02:00
Avgustin Marinov
fbaa352f7f Sonar Fixes (10) (#2222)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-23 16:48:24 +02:00
Avgustin Marinov
a0d149cc1d Sonar Fixes (9) (#2221)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-23 15:02:03 +02:00
Avgustin Marinov
bb9c9bfad8 Remove some of the field injections (Sonar recomendtion) (#2218)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-23 09:52:29 +02:00
Avgustin Marinov
567e8b38f1 Sonar Fixes (5) (#2211)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-21 11:20:50 +02:00
Avgustin Marinov
5dabe9117a Fix SonarQube issues (2) (#2205)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-20 16:29:45 +02:00
Avgustin Marinov
626d4cc537 Add getting tenant with details (#2195)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-14 09:32:16 +02:00
Avgustin Marinov
b294798ae5 SystemManagement getTenantMetadata - fetch details, added method getTenantMetadataWithoutDetails (#2194)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2025-01-10 15:37:57 +02:00
Avgustin Marinov
af50e8c938 Fix portable event on setting confirmation status (#2146)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-12 12:37:03 +02:00
Avgustin Marinov
1450115061 Ensure different group schedule and start event on rollout start (#2144)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-12 09:50:05 +02:00
Avgustin Marinov
39861e7790 Refactor action repository (#2118)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-05 11:41:41 +02:00
Vasil Ilchev
b4215a9d76 Add timestamp to Actions (#2113)
* Add timestamp to Actions

Signed-off-by: Vasil Ilchev <Vasil.Ilchev@bosch.com>

* Add Timestamp to All Actions Feedback DDI/DMF

* After review

* Removed Action timestamp as we have timestamp in each ActionStatus so use that instead

* Unify to use everywhere System.currentTimeMillis()

* Add constructor w/o timestamp to DmfActionUpdateStatus

---------

Signed-off-by: Vasil Ilchev <Vasil.Ilchev@bosch.com>
Co-authored-by: vasilchev <vasil.ilchev@bosch.com>
2024-12-04 09:53:10 +02:00
Avgustin Marinov
a9f3d1491a JPA Refactoring (3) (#2109)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-02 13:50:06 +02:00
Avgustin Marinov
794f26bea2 JPA Refactoring (2) (#2108)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-02 11:52:30 +02:00
Avgustin Marinov
016bada08b Fix unused tenant param in AmqpMessageDispatcherService (#2101)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-23 11:15:56 +02:00
Avgustin Marinov
37dea970d2 Fix EventPublisherAuthConfiguration to run as system (#2099)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 17:59:25 +02:00
Avgustin Marinov
4de34eacc3 Fix AmqpMessageDispatcherServiceTest.testSendCancelRequest - set action tenant (#2098)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 17:36:07 +02:00
Avgustin Marinov
9df68e2d97 Fix DMF context (as system) (#2097)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-22 15:32:00 +02:00
Avgustin Marinov
c3bcc4371d Code formating and removing unused imports (#2072)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-18 09:13:58 +02:00
Avgustin Marinov
ca2c50ffa5 Code refactoring of hawkbit-dmf-amqp (#2054)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-16 20:17:13 +02:00
Avgustin Marinov
5182217745 Rename hawkbit-security-intenal -> hawkbit-security-controller (#2015)
as it is controller only related

* DmfTenantSecurityToken renamed to ControllerSecurityToken - as it is such
* hawkbit.security classes from http-security-internal moved to hawkbit.security.controller - as they are such and it is bad practice to have same package in multiple modules

_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 12:45:09 +02:00
Avgustin Marinov
25c09a7d39 Move all DMF artifacts in hawkbit-dmf (#2000)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-11 14:22:11 +02:00
Avgustin Marinov
56ff8168f9 Rename org.eclipse.hawkbit.api -> org.eclipse.hawkbit.artifact.repository.urlhandler (#1980)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:40:27 +02:00
Avgustin Marinov
bafbc46881 Remove unnecessary slf4j dependency (#1975)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:42:42 +02:00
Avgustin Marinov
3975c887ec Remote test dependencies dupplications (#1974)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:28:24 +02:00
Avgustin Marinov
3effa996dd Refactor tenancy classes (#1972)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:12:18 +02:00
Avgustin Marinov
7a0735c17e Remove AUTHENTICATION_EXCHANGE as unused (#1953)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-06 11:38:52 +02:00
Avgustin Marinov
8d3cc6d59f Fix sonar findings (#1951)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 16:19:29 +02:00
Avgustin Marinov
ec5b797d41 Code format hawkbit-dmf-amqp (#1936)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 11:24:04 +02:00
Avgustin Marinov
8d78cea9d2 Web env none in tests where not needed (#1871)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-10-04 16:51:10 +03:00
Avgustin Marinov
d958d8e82c Remove download by downloadId functionality (#1820)
This functionallity seems to get via AMQP (after some authentication)
a private (wihtout need of authentication) url to an artifact assigned
to the controller.

By default, DDI or DMF shall provide proper urls (for direct download)
to devices and if they have to be without authentication this shall be
solved in different ways - for instance separate download server providing
dedicated private / signed urls.

This functinallity is not a real hawkBit part but more like something
intended to solve some edge cases.
Since it is complicated, heeds support, doesn't solve wide spread use
cases, and could be achieved with other means - better to be removed.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-08-14 17:28:46 +03:00
Avgustin Marinov
9e76223a91 [#1580] Software Module & Distribution Set lock: implicit (#1649)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-18 23:01:55 +02:00
Avgustin Marinov
da3a6470ec Refactoring/Improving source: dmf (#1611)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-04 11:05:38 +02:00
Avgustin Marinov
791b87b27b Reduce dependency on Guava 2 (#1590)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 00:43:10 +02:00
Avgustin Marinov
ee5e12a300 Test lombok on AmqpProperties (#1585)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 00:15:15 +02:00
Avgustin Marinov
bce69676d2 Reduce dependency on Guava (#1589)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-02 22:21:46 +02:00
Avgustin Marinov
537a942021 Made implicit tenant meta data creation configurable (#1575)
In hawkBit up to 0.4.1 it was true - getTenantMetadate created implicitly a tenant metadata.  It was disable in latest commits - but now it is made optional - disabled by default

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-01-30 15:46:39 +02:00
Stanislav Trailov
cbc2185561 Make Amqp Handler service conditional in order to add possibility to be overriden (#1567)
Signed-off-by: TRS1SF3 <Stanislav.Trailov@bosch.io>
2024-01-26 17:41:32 +02:00
charvadzo
49a5509e89 Enable specifying target type when created using DMF API (#1472)
Extension of DMF API with possibility of setting target
type name when creating target. If a target type with the
provided name is found (was created beforehand) then it
is associated with the new target.

Signed-off-by: Ondrej Charvat <ondrej.charvat@proton.me>
2024-01-22 15:01:00 +02:00
charvadzo
af56b71d53 Provide artifact last modified timestamp on DMF API (#1470)
Sets lastModified filed of DmfArtifact DTO according to artifact's last modification timestamp so it is server over DMF.

Signed-off-by: Ondrej Charvat <ondrej.charvat@proton.me>
2024-01-22 10:33:26 +02:00
Avgustin Marinov
7440d90f59 [#1383] Spring Boot 3 migration Step 2 (#1559)
* [#1383] Spring Boot 3 migration Step 2

Some of the steps:

1. Change spring version parent and versions in root pom.xml
2. update eclipselink versions
3. javax.annotation -> jakarta.annotation (*.java)
4. javax.persistence -> jakarta.persistence (*.java)
5. javax.servlet -> jakarta.servlet (*.java, pom.xml)
6. javax.validation:validation-api -> jakarta.validation:jakarta.validation-api (pom.xml)
7. javax.validation -> jakarta.validation (*.java)
8. javax.transaction -> jakarta.transaction (*.java)
9. replace spring-cloud-stream-binder-test (hawkbit-repository-test) with
```
<dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-stream-test-binder</artifactId>
</dependency>
```
, TestSupportBinderAutoConfiguration.class }) -> })
@Import(TestChannelBinderConfiguration.class)
10. Set to Simple UI standard parent
11. requestMatchers to securityMatcher
12. @SpringBootApplication(scanBasePackages = "org.eclipse.hawkbit") (otherwise for instance flyway doesn't work - suffix is default ".sql", not H2.sql and don't differentiate dbs? strange is there a change?)
13. @NonEmpty for Long leads to validation exception - replaced with @NotNull
14. RSQLUtilityTest.correctRsqlBuildsPredicate - fixed - mock query builder add method
15. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#spring-mvc-and-webflux-url-matching-changes - aliases as targers/ return 404 - remove trailing slash
16. firewall tests (allowedHostNameWithNotAllowedHost) doesn't throw 'rejected exception' but return 400 instead (as probably is expected anyway)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com

* Fix tenant listing to do not mix with multitenancy

Tenant metadata is not multitenancy aware while depend on distribution set type
which is. Thus querying all tenant metadata (in non tenant context) sometimes leads to
resolution of distribution set type which is tenant scoped and leads to problems.

So, now listing tenant lists just their ids - not fill entities.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-01-20 15:57:17 +02:00
Avgustin Marinov
1ae72d4ead Remove WithSpringContextRule (#1505)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-12-07 23:52:23 +02:00
Avgustin Marinov
0021b03c9a CI friendly maven poms - use $revision for version (#1477)
https://maven.apache.org/maven-ci-friendly.html

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-11-16 17:23:01 +02:00
Avgustin Marinov
b982039a74 Feature/ctx aware and access controller2 (#1456)
* Introduce the AccessControlManager and use if for the TargetManagement and TargetTypeManagement.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Extend the access control manager by an API to serialize the current active context and persist it for scheduled background operations like auto-assignment.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Verify modification is permitted before performing automatic assignment

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Start with controlling distribution set type access. Perform some refactoring.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Support distribution set access control. Increase character limit to 512 chars for access control context. Refactor default implementations.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce ContextRunner and define admin execution to check for duplicates before creating/updating entities.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce Software Module, Module Type and Artifact control management. Fix tests.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce access controlling test base. Add first test verifying the read operations for target types.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Finalize target type access controlling test.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce ContextRunnerTest and TargetAccessControllingTest.
Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Introduce DistributionSetAccessControllingTest and fix missing access control specifications.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Extend test cases. Include only updatable targets into rollout.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Fix action visibility.

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>

* Modifiable->Updatable & UPDATE check where needed

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* ContextRunner superseded by ContextAware

+ ContextRunner remaned to ContextAware (move as a cenral entry/concept).
  It now extends (and replace) TenantAware
+ SecurityContextTenantAware becomes ContextAware
+ Pluggable serialization mechanism
  (default Java serialization of contexts) for SecurityContextTenantAware
  (using SecurityContextSerializer)
+ AccessControl methods are added to ensure no entities fill be retrieved
  just to call access control - so, if all permitted - no additional db
  queries will be made
+ &lt;repo type&gt;AccessControl classes removed and replaced with
  AccessControl &lt;repo type&gt; generics
+ AccessControlService removed - every AccessControl is registered and
  overiden independently
+ access_control_context in DB increased to 4k (in order to support java
  security context serialization)
+ needed adaptaion of implemtation and tests done

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Refactor SoftModules & DistSets

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Refactoring of the Repositories

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Repostiotory level permissions

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Improvements

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Simplification of AccessControl interface

* Simplifications & management package

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

* Implementation improvements

+ Artifact management & repo reviewed and tuned
+ Action(Status) management & repo reviewed and tuned
+ SoftwareModule(Type/Meta) management & repo reviewed and tuned
+ DistributionSet(Type/Tag/Meta) management(+Invalidation) & repo reviewed and tuned
+ Target(Tag/Type/Meta) management & repo reviewed and tuned
+ TargetQueryFilter management & repo reviewed and tuned

* Apply suggestions from code review

Suggestions accepted. Thanks @herdt-michael

Co-authored-by: Michael Herdt <michael.herdt@bosch.com>

* Apply suggestions from code review 2

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>

---------

Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
Co-authored-by: Michael Herdt <Michael.Herdt@bosch.com>
2023-11-16 11:07:06 +02:00
Avgustin Marinov
9c86729a68 [#1393,#1008] Switch to Eclipse v2.0 license (#1427)
Switching license from EPL v1 to v2. Following
https://www.eclipse.org/legal/epl-2.0/faq.php#h.tci84nlsqpgw

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-09-14 11:03:20 +03:00
Avgustin Marinov
acff82f60f Small security improvements (#1412)
Typos fixed

Disables empty string gateway token for sure. Test if the gateway token is not empty string ecplicitly.
Empty string is the default value and if accepted could be a security vulnerability (e.g. enabling gateway token
authentication and using empty string as token). According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4
the header value shall not have trailing spaces and the http server shall already have trimmed them. So if execution passes
start with "GatewayToken " then token shall not be empty. But but let's check anyway

In UI first set key then enable the gateway token authentication. Otherwise the key might be left empty (default). This however
shall not be really problem since (because of token trimming) the empty token will be rejected anyway.

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-08-16 14:25:17 +03:00
Melchior Moos
bcc2616e73 Do not retry AMQP messages which violates a quota (#1392) 2023-07-13 14:00:21 +03:00
Stanislav Trailov
1b342001a2 Fix CANCEL_REJECTED dmf behaviour (#1346)
* Fix CANCEL_REJECTED dmf behaviour
* Proper formatting
* Remove unused imports

Signed-off-by: Stanislav Trailov <stanislav.trailov@bosch.io>
2023-04-13 11:13:33 +02:00
Michael Herdt
fbda9764b1 Fix circular rollout dependencies (#1337)
* Do some refactoring to fix dependencies between rollout management, executor and evaluator beans.
* Move rollout retrieving in same transaction as execution.
* Do some refactoring. Extend logging and exception handling.
* Remove unnecessary transactional and validation annotations.
* remove catching never thrown bean
* Fix new rollout handling API
2023-04-03 09:13:00 +02:00
Stefan Behl
4a3a79aa6b Migration to Spring Boot 2.7.10 (#1320)
* Initial commit
* Fix compile breaks
* Fix hibernate config
* Fix hibernate config
* Fix failing tests
* Improve logging
* Improve logging
* Fix Sonar issues
* Remove BusProperties
* Add BusProperties bean back in
* Fix JPA workaround
* Fix CVE-2021-22044
* Fix test failures
* Fix PR review findings
* Fix CVEs
* Remove H2 version downgrade, fix schema migration, enable legacy mode
* Downgrade Vaadin back to 8.14.3
* Fix EventPublisherHolder
* Fix RemoteTenantAwareEvent
* Fixed EventPublisherAutoConfiguration
* New version of spring-hateoas requires links to be expanded (Mgmt API)
* New version of spring-hateoas requires links to be expanded (Mgmt API)
* Fix PR review findings
* Fix PR review findings
* Fix PR review findings
* Update README.md
* MariaDB Java Client downgrade to maintain compatibility with AWS Aurora
* Temporarily disable RSQL test that depends on DB collation type
* Upgrade to boot 2.7.10
* Upgrade snakeyaml to 1.33
* Upgrade Spring Security OAuth2 to version 5.7.7
* Remove obsolete exclusion of junit-vintage-engine
* Upgrade jackson-bom to 2.14.2
2023-03-28 07:16:25 +02:00