Commit Graph

228 Commits

Author SHA1 Message Date
Avgustin Marinov
ed93d3fc7b Introduce pluggable tenant resolver (#2151)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-18 15:17:35 +02:00
Avgustin Marinov
0ac0dc223e Make Action active field convertor JPA Vendor portable (#2132)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-12-09 17:59:14 +02:00
Avgustin Marinov
299d7091a2 Reomve a @Cacheable that might not work (#2102)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-23 16:52:06 +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
9b7606f68e Code refactoring of hawkbit-core and hawkbit-autoconfigure (#2051)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-16 17:56:23 +02:00
Avgustin Marinov
32acb44e31 Artifact modules moved in new hawkbit-artifact parent (#2012)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-12 09:40:44 +02:00
Avgustin Marinov
313abf330b Fix sonar findings: Fix artifact file repo tests (#1986)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-09 17:31:59 +02:00
Avgustin Marinov
ee7caa06c7 Fix sonar findings: Removed since added (#1984)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-09 15:22:59 +02:00
Avgustin Marinov
17fb7efe42 Fix createTempFile security (#1982)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-09 14:36:52 +02:00
Avgustin Marinov
fe8fb3a602 Move ControllerPollProperties -> org.eclipse.hawkbit.tenancy.configuration (#1981)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:52:48 +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
6dec398cb9 Remove unusied org.eclipse.hawkbit.HawkbitServerProperties (#1979)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:18:59 +02:00
Avgustin Marinov
56c548e474 Remove unused org.eclipse.hawkbit.api.HostnameResolver (#1978)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 17:05:14 +02:00
Avgustin Marinov
d9ee7541a4 Remove org.eclipse.hawkbit.api.ProtocolProperties (#1977)
_release_notes_

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:53:37 +02:00
Avgustin Marinov
ef49f4d074 Remove DistributedResourceBundleMessageSource (#1976)
[release_notes]

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:44:36 +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
6867b8eac0 Move spring-boot-starter-test and alure to root (#1973)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 16:25:19 +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
109854956b Remove commons-io dependency from hawkbit-core (#1968)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 13:40:06 +02:00
Avgustin Marinov
73253abce0 Refactor hawkbit-core (#1967)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
2024-11-08 13:11:59 +02:00
Avgustin Marinov
5bb6cc8cb3 Code format - hawkbit-core (#1924)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-11-05 09:12:32 +02:00
Avgustin Marinov
01af3a244e Fix sonar finding (#1908)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-10-18 09:36:58 +03:00
Avgustin Marinov
60ee383158 Extend ExceptionInfo with map info + EntityNotFound info (#1901)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-10-17 16:51:29 +03:00
Avgustin Marinov
dd500b4d53 Refactor RSQL searach fields related classes (3) (#1836)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-09-10 11:38:31 +03:00
Avgustin Marinov
072809be6c Refactor RSQL serach fields related classes (#1834)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-09-09 17:39:45 +03:00
Avgustin Marinov
a31028ee19 Slight improvements in RSQL to SQL logic (#1833)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-09-09 16:10:31 +03:00
Avgustin Marinov
55cc600114 Small serach fields refactoring (add lombok & style) (#1823)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-08-23 12:24:29 +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
c1de86b29e Remove target tag to target reference (#1772)
* Remove target tag to target reference

it is not used and could lead to extensive memory usage if JPA provider load targets while loading tags

Also, remove search field controller id as not meaningful

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

* Fix review findings

---------

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-07-19 13:56:30 +03:00
Avgustin Marinov
57450bf31b Add fine graned role and permission for user management (#1670)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-29 12:01:35 +02:00
Avgustin Marinov
783a5be2dd Fix ActionFields javadoc (#1665)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-21 15:49:33 +02:00
Avgustin Marinov
8ea3fdb5e7 SDK AutoConfig & improvements & fixes (#1663)
* SDK autoconfiguration added
* Option for custom error decoder and request interceptor added
* Fixed authentication for targets with security token

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-21 15:44:27 +02:00
Avgustin Marinov
ab61b168bd [#1650] Expose externalRef via search filters (#1657)
add option to filter actions using _externalref_ property

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-19 17:23:56 +02: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
94576bd6fe [#1580] Software Module & Distribution Set lock: apply (#1648)
forbid software modules / artifacts modification for locked distribution
sets / software modules respectively

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-15 15:56:01 +02:00
Avgustin Marinov
9bc0e74f47 [#1580] Software Module & Distribution Set lock: add lock at db level (#1643)
1. add _locked_ column in the tables
2. add _locked_ field to the JPA entities
3. add lock set/get at JPA level (with lock DS checking for complete)
4. along with that little reordering of code is made to make it more structured

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-14 20:59:34 +02:00
Avgustin Marinov
ba685ef429 Refactoring/Improving source: repository & fix log() (#1601) (#1602)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 17:25:30 +02:00
Avgustin Marinov
e4c70f3f34 Refactoring/Improving source: core (#1598)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 16:47:57 +02:00
Avgustin Marinov
f69d386613 Lombok/apply to security repo3 (#1594)
* Improve Security Core with lombok (#1592)

Add lombok to repository modules

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

* Improve Security Core with lombok 3

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

---------

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 04:46:24 +02:00
Avgustin Marinov
ea885d6f61 Improve Security Core with lombok (#1591)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-03 01:46:22 +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
853960621b Improve core with lombok (#1587)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2024-02-02 18:35:55 +02:00
Florian BEZANNIER
a5dda8cb47 fix: return url without port if default port protocol is used (#1511)
* fix: return url without port if default port protocol is used

* tests: set server port to 8080 and assert that all generated url use port 8080
2024-01-31 09:34:07 +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
4ac42c80d7 [#1509] Sync Target type with SW and DS types (targettype.key search) (#1515)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-12-13 16:29:56 +02:00
Avgustin Marinov
4b5a7d6e7d [#1509] Sync Target type with SW and DS types (Mgmt Layer) (#1513)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-12-13 11:48:51 +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
Stein.Codes
defa6c3b69 refactor: Java Security Ultimate Security Repo Scanner 2023 (#1455)
Disclaimer: Automated Commit Alert

Please be aware that this commit, generated through automated processes, may contain false alerts or not be precisely targeted. This automated commit is part of a large-scale effort to enhance software security over time. It is sent to various repositories to improve code quality and security. Exercise caution when reviewing the changes, and ensure that any necessary adjustments are made to maintain the integrity and functionality of the software.

Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/TkgUEiqd7?organizationId=RWNsaXBzZSBGb3VuZGF0aW9u

Co-authored-by: Moderne <team@moderne.io>
2023-11-01 16:41:08 +02:00
Florian BEZANNIER
dafc08304d Add portRequest url handler property (#1449)
* Add portRequest url handler property

The option server.forward-headers-strategy=NATIVE allow to dynamicly
generate link based on X-Forwarded-Proto header.
Unfortunately Hawkbit artifact use a custom url handler.
This PR allow to serve artifacts on http and https in the same time.

Signed-off-by: Florian Bezannier <florian.bezannier@hotmail.fr>

* docs: use server.forward-headers-strategy option

---------

Signed-off-by: Florian Bezannier <florian.bezannier@hotmail.fr>
2023-10-19 12:04:23 +03:00