Commit Graph

289 Commits

Author SHA1 Message Date
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
Avgustin Marinov
7d76a5a97e Fix change if placeholder prop name typos (#1436)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-09-26 13:27:17 +03:00
Zygmunt Krynicki
318f94fa32 Assorted collection of typos (#1434)
* hawkbit-repository: fix typoL annotations

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>

* hawkbit-repository: fix typo: verifies

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>

* hawkbit-repository: fix typo: exclusion

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>

* hawkbit-core: fix typo: placeholder

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>

---------

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2023-09-26 12:30:29 +03:00
Avgustin Marinov
e2d90b7092 [#1372] Add SERVER_SERVLET_CONTEXT_PATH support (#1433)
added support for SERVER_SERVLET_CONTEXT_PATH. Could be used in some cases

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
2023-09-26 11:58:38 +03: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
Denislav Prinov
2fe73ee40c Filter Distribution Sets by assigned Software Modules (#1386)
* Filter Distribution Sets by assigned Software Modules

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

* Fixed tests

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>

---------

Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
2023-07-10 15:19:08 +03:00
Stanislav Trailov
99a0da1c2f Apply changes from review
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
2023-06-29 14:38:12 +03:00
Stanislav Trailov
52d671bdc5 Add some useful comments
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
2023-06-29 12:31:25 +03:00
Stanislav Trailov
0d4f67e345 Small refactoring + additional classes
Signed-off-by: Stanislav Trailov <Stanislav.Trailov@bosch.io>
2023-06-29 12:29:40 +03:00
Stanislav Trailov
e81c68e9b0 Extend the Rollout filtration fields with status and Distribution set
Extend the Rollout filtration fields with status and Distribution set
2023-06-29 11:13:39 +03:00
Denislav Prinov
9bf2612c7d Extend the Rollout filtration fields with status and Distribution set
Signed-off-by: Denislav Prinov <denislav.prinov@bosch.com>
2023-06-29 08:40:22 +03:00
Shruthi Manavalli Ramanna
0759fd80b0 Added support for cdn download url for mgmt API and tests
Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
2023-06-02 19:09:31 +02:00
Zygmunt Krynicki
a64c2bc28e Fix several typos (#1314)
Those were discorvered while casually browsing the source code in an IDE.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2023-02-01 15:24:34 +01:00
Michael Herdt
21f1569881 Support user consent flow (#1293)
* Introduce user consent flow
* Add permissions to confirmation management
* rename from consent to confirmation
* Reformat code. Remove unused imports. Change and add permission checks when configuring auto-confirmation.
* Do not include null values for DDI confirmation base endpoint
* fix confirmation required checkbox id
* Remove unused import. Fix consume/produce type of new API's.
* Change term processing to proceeding when activating user consent flow
* Align formatting and extend integration test cases for DMF and DDI.
* Extend DMF test cases to consider auto-confirmation
* Refactor action management to fix problem of handling action status updates on closed actions.
* remove unsupported validation
* use new confirmation api for DMF. Extend test cases.,
* Remove unnecessary fields.
* Extend API documentation for DDI and MGMT API.
* adapt ddi api docs adoc file
* Fixed the duplicate migration version for db files
* fix method to support confirmation
* Fixed PR comments
* Addressed PR comments
* Fixed after merge compilation issue
* Fixed after merge compilation issue
* Fix failing tests in MgmtRolloutResourceTest
* Fixed the permissions issue reflected by integration tests
* Added back the missing line of code lost during merge
* Fix the failing test on Jenkins

Signed-off-by: Stanislav Trailov <stanislav.trailov@bosch.io>
Signed-off-by: Dimitar Shterev <dimitar.shterev@bosch.io>
Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io>
Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
Co-authored-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
2023-01-25 12:11:05 +01:00
Stefan Behl
b919ceda5c Management REST API: Allow to filter actions by last status code (#1311)
* Introduce sorting /filtering field for "lastActionStatusCode"

* Rename new sort /filter field to "lastStatusCode"
2023-01-13 12:12:51 +01:00
Stefan Behl
d7796121d1 Add resource collection /rest/v1/actions to Management REST API (#1299)
* Initial commit

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>

* Added filtering by RSQL

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>

* Support for filtering actions by distribution set, target, rollout

* Added REST docs

* Fixed REST docs

* Introduce a config property which allows to disable the actions endpoint

* Introduce representation mode parameter

* Adapt REST docs

* Incorporate review findings

* Adapt REST docs

* Improve unit tests

* Minor improvements

* Fix REST docs

* Fix REST docs

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>
2023-01-10 17:19:05 +01:00
Peter Vigier
44a85f20eb Feature/fix sonar warnings (#1226)
* Fixed sonar warnings

- "Cognitive Complexity"
- "Do not use replaceAll when not using a regex"
- java:S5869 - Character classes in regular expressions should not contain the same character twice
- Improved bad name
- Typos
- reduced code duplications
- Replaced hand-made wait-utility with Awaitility
- Log messages
- Duplicate code
- Typos
- Removed Thread.sleep, instead relaxed check condition
- Removed use of deprecated API
- Removed use of deprecated API
- Added supress-warnings as I do not see a better way to write the tests
- Removed Thread.sleep / redundant functionality to Awaitility
- Fixed other warnings (use isZero, isEmpty, hasToString)
- Removed/Reduced duplicate code
- Added generics
- Fixed asserts
- removed: field.setAccessible(true) actually should not be needed for public static fields!
- Too long constructor passes arguments in wrong order - how surprisingly...
- Clean-up use of varargs arguments
- Fixed regex
- Fixed typos and other minor stuff
- Making public constructors protected in abstract classes
- Swapped expected and asserted argument
- volatile not enough for syncing threads
- volatile not enough for syncing threads
- out-commented code
- Made regex not-greedy, added tests for verification
- Avoid exposure of thread-local member var

Signed-off-by: Peter Vigier <Peter.Vigier@bosch.io>

* Fixed Sonar warnings

* License header fix

Signed-off-by: Peter Vigier <Peter.Vigier@bosch.io>

* License header fix #2

Signed-off-by: Peter Vigier <Peter.Vigier@bosch.io>

* Fixing review findings

Signed-off-by: Peter Vigier <Peter.Vigier@bosch.io>

* Fixing tests

- Fixed '&' usage in javadoc and typos
- Fixing some warnings

Signed-off-by: Peter Vigier <Peter.Vigier@bosch.io>
2022-01-31 21:59:46 +01:00
Bondar Bogdan
146735012a Artifact Encryption plug point (#1202)
* added ArtifactEncryption interface, injected it into SM creation UI module, added encryption metadata key generation upon SM creation, used encryptor during file upload

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* add default artifact encryption implementation based on gcm aes algorithm

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* changed ArtifactEncryptor interface to manage encryption secrets by itself

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* cleaned up stale code, fixed sonar

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* fixed software module encryption within transaction

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* added artifact encryption secrets store

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* extended ArtifactEncryption interface to allow decryption, secrets store provides removeSecret, added missing javadocs

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* intriduced DbArtifact interface, use EncryptionAwareDbArtifact for artifact decryption during download

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* introduced ArtifactEncryptionService to minimize duplications and unneccessary dependency injections

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* declared ArtifactEncryptionService as a bean

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* added persistant encryption flag to software module

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* further adptations for encryption flag persistence

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* added ArtifactEncryptionException, fixed encryption check in UI

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* added encryption error handling

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* added encrypted flag to DDI/DMF, adapted exception handling

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* adapted rest docs

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* Add test to verify artifact encryption is not given by default

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Add isEncrypted() to toString() of JpaSoftwareModule, fix typos

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Fix sql migration scripts

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* Calculate encrypted artifact size by subtract encryption size overhead

Signed-off-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>

* publish upload failed without waiting for interuption during UI file upload

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

* upgraded cron utils to 9.1.6

Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>

Co-authored-by: Florian Ruschbaschan <Florian.Ruschbaschan@bosch.io>
2021-11-18 09:07:05 +01:00
Anand Kumar
70779d1ac7 Feature target type filter (#1197)
* Added Target type filter with drag and drop support

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Removed the unused enums and target type filter button class

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Resolved merge conflicts

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed java doc issue with the method link in the comment

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed the IN query overflow for target Type assignment

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed Review comments

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>
2021-10-27 15:24:09 +02:00
Robert Sing
dea6fa3ce6 Adapt UI for target type compatibility check (#1189)
* Added compatibility calls needed for UI

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* Adapted UI for target type compatibility checks

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* improved exception handling for incompatibility check

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* added & fixed unit tests

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed merged conflicts

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed target type incompatibly specification

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* changed UI behaviour to close assignment popup in case of IncompatibleTargetTypeException

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* added unit test to validate incompatibly specification fix

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed review findings

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed review findings

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fix potential null pointer

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* Fixed rolloutcopy by adding dsTypeId to ProxyDistributionSetInfo

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* suppressed warning

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>
2021-10-22 16:23:25 +02:00
Natalia Kislicyn
d5661d2fe2 Support keywords in queries (#1193)
* support targettype as keyword in target-queries

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* support valid as keyword in distributionset-queries

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* remove targettype.id from filter queries

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>

* remove targettype.description from filter queries

Signed-off-by: Natalia Kislicyn <natalia.kislicyn@bosch.io>
2021-10-20 13:13:24 +02:00
Markus Block
be3dfbf617 Ensure a '.' character is allowed to be used in target filter query for metadata key and attribute name (#1186)
* Adapted code to allow '.' inside of metadata key and attribute names


Signed-off-by: Markus Block <markus.block@bosch-si.com>

* added handling of corner cases

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* Adapted metadata and attribute tests to check that dot is allowed

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed documentation

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* Allow usage of dot in key names for every map attribute, e.g. also for
metadata in distribution set

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed typo

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* adapted test key to ensure a dot can be used

Signed-off-by: Markus Block <markus.block@bosch-si.com>

* fixed typo

Signed-off-by: Markus Block <markus.block@bosch-si.com>
2021-10-18 10:51:04 +02:00
Sebastian Firsching
825cb64448 Introduce basic functionality for invalidation of distributionsets (#1179)
* Basic DS invalidation functionality

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add checks for valid/complete DS

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Stop rollouts + auto assignments when invalidating a DS

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add methods to count AAs + rollouts for invalidation

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Small refactoring for DS management

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add invalidation functionality to REST API

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix update stopped rollouts status

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add various tests

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Introduce countActionsForInvalidation

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix event tests with incomplete DS

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add H2 migration script

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix action count method

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix REST documentation tests

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Change flyway version number

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add lock for DS invalidation + adapt tests

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Move concurrency test to own class

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Handle possible InterruptedException

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix concurrency test

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Use one transaction for all invalidations

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add invalidate endpoint to REST docu

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Execute invalidation in transaction when actions are cancelled

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Check that distribution set is valid when editing/creating metadata

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Remove all changes in UI

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add DB migration files for all databases

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Implement review findings

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Move DS invalidation to own class to check permissions for single steps

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Move invalidation count methods to management classes

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Fix failing tests

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>
2021-09-30 15:26:36 +02:00
Anand Kumar
3fa1dd1be4 Feature target type entity (#1162)
* Added Target Type model

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added Target Type JPA model

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added Target Type repository model classes

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Removed the name entity from Target Type

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Refactored the Target Type models

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added the DB migration script and updated the Target Type models

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added target type in target Mapper

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Changed the target type ID to Long

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added MYSQL DB migration script and removed the deleted column for target type

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Updated the DB migration script for target table

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added manyToMany reltation between target type and Ds type

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added POSTGRESQL DB migration script

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added MSSQL SERVER DB migration script

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added DB2 DB migration script

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added missing license header and java docs

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added on delete cascade in DB migration script

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added Target Type specification

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Removed the delete cascade and Added type API
Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* fixed API doc build

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added target type management test

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added target type events test

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added target type update and unassign to target

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added API tests for assigning target type to target

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added missing license header

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added missing docs

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed sonar issues

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed license header build issue

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Updated the attribute name to target type

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed the review comments

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Removed unused error status variable

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added target API to assign target type

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Added the tests for assigning target type to target

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>

* Fixed the review comments for null check

Signed-off-by: Anand kumar <anand.kumar@bosch-si.com>
2021-08-25 12:13:27 +02:00
Robert Sing
2574581b2c Feature/enforce hash validation for uploads (#1158)
* moved artifact duplication check after hash check

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* added unit tests

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed copyright header

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>

* fixed review finding

Signed-off-by: Robert Sing <robert.sing@bosch-si.com>
2021-08-05 14:53:36 +02:00
Stefan Behl
cf67467fb5 Execute rollouts and auto assignments in the correct user context (#1100)
* Execute rollouts and auto assignments in correct user context

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>

* Fix PR review findings

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>

* Cleanup usage of lenient

Signed-off-by: Stefan Behl <stefan.behl@bosch.io>
2021-04-15 12:23:14 +02:00
Stefan Klotz
78d784f3c4 Fix error for downloading soft deleted artifact binary (#1102)
* download soft deleted artifact throws binary gone exception

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* add test and update documentation

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* fix javadoc

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* test soft deleted artifact has no download link

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>
2021-03-24 15:17:34 +01:00
Dominic Schabel
81defa10a6 Migration to JUnit5 as default test runtime (#1082)
* Migrate tests to JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* REST docs tests migrated to JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Migrated security and UI tests to JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Migrated management tests to JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Reflecting changes from JUnit5 migration

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Fix RabbitMQ test detection

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Drop support for JUnit4

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>
2021-03-15 13:40:40 +01:00
Dominic Schabel
9c5360e59d JUnit5 support (#1063)
* First preparation for JUnit5

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>

* Exclusion of JUnit5 removed

Signed-off-by: Dominic Schabel <dominic.schabel@bosch.io>
2021-02-12 08:22:26 +01:00
Ammar Bikic
165f6e0435 Change to proper versioning
Signed-off-by: Ammar Bikic <ammar.bikic@bosch.io>
2020-11-03 09:59:21 +01:00
Ammar Bikic
28b65a290d Update Spring Boot to 2.3.2
-Update Spring Cloud to Hoxton.SR7
-Replace ResourceSupport by RepresentationModel (Spring Hateoas 1.0)
-Replace ControllerLinkBuilder by WebMvcLinkBuilder (Spring Hateoas 1.0)
-Move getId() from Identifiable to BaseEntity (Spring Hateoas 1.0)
-Remove hamcrest.Factory
-Use static Sort.by reference
-Place http security anyRequest().authenticated()
-Replace MockMvcRequestBuilders.fileUpload by MockMvcRequestBuilders.multipart
-Deprecate MEDIA_TYPE_CBOR_UTF8
-Replace MEDIA_TYPE_CBOR_UTF8 by MEDIA_TYPE_CBOR in tests
-Replace HAL_JSON_UTF8 by HAL_JSON in tests
-Replace APPLICATION_JSON_UTF8 by APPLICATION_JSON in tests
-Use org.mockito.junit.MockitoJUnitRunner
-Remove overridden dependency versions
-Removing not needed comments in pom.xml
-Downgrade flyway-core to be MySQL 5.6 compatible
-Add maven-site-plugin since it was removed with spring-boot 2.3
-Set servlet encoding properties
-Introducing Test that verifies the charset inside the content-type of a response
-Add @DirtiesContext to CorsTest and ContentTypeTest
-Add content-type mockmvc test with adapted mockmvc config
-Move encoding.force property to test class
-Switch expected and actual parameter values in content-type test
-Delete deprecated content-type test with TestRestTemplate
-Exclude JUnit5 from spring-boot-starter-test
-Upgrade allure-junit4 to 2.13.5
-Add aspectjweaver 1.9.6 to surefire test execution
-Add flyway-core version to property
-Use getRequiredLink() within MgmtBaseEntity.getId()

Signed-off-by: Ammar Bikic <ammar.bikic@bosch.io>
2020-10-02 18:11:18 +02:00
Ahmed Sayed
ba96c68eb0 added triggeredBy for rollouts and autoassignment (#1017)
* added triggeredBy for rollouts and autoassignment

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* use createdBy as fallback for triggeredBy in AutoAssignChecker

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* removed 'NOT NULL' from db migration scripts for JpaTargetFilterQuery

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed tests

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* inlined redundant method in JpaDeploymentManagement

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* added tests + renamed property to 'initiatedBy'

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
2020-09-28 09:35:19 +02:00
Sebastian Firsching
0d52524202 Fix not equal operator (#935)
* Use nested query in getNotEqual Predicate
* Refactor RSQL Utility + use identifierField for field enums
* Don't join in case of not equal rsql operator
* Bugfix for automatic cross join + small refactoring
* Fix rsql out operator
* Fix tests for out-operator + extend TargetFieldTest
* Use inner join for subquery
* Don't use subquery for simple rsql queries
* Refactor RSQLUtility
* Change some methods to static
* Only use outer joins when they are needed
* Add tests for empty tag names
* Minor changes and refactoring for RSQLUtility
* Refactor methods to remove duplications

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>
2020-04-15 08:01:54 +02:00
Sebastian Firsching
5feb5873c4 Feature mgmtapi add sha256 to softwaremodules (#918)
* Add sha256 hash to softwaremodules in mgmt api

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Adapt rest docs

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Edit comments

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>

* Add proper license header

Signed-off-by: Sebastian Firsching <sebastian.firsching@bosch-si.com>
2020-01-13 12:36:14 +01:00
Stefan Klotz
9cb5d31396 Prioritisation of assignments via mgmt-API (#895)
* Updating the schema for targetfilterquery and rollout
* Updating the weight validation logic and tests
* Make weight optional
* Fix existing multi assignment tests by adding weight, remove weight from TargetFilterQuery
* Add weight validation tests, fix tests
* Add mgmt api tests for assignment and getting action with weight
* Add management layer validation and tests for creating rollouts with weight
* Fix amqp test, add repo level validation to resource tests
* Add weight to rollout mgmt-api and tests
* Add weight to mgmt api target Filter create and update
* Add target filter auto assign weight. disable enforcement of setting a weight in multiassign mode
* Remove ignored tests, fix api doc
* Fix minor findings
* Fix findings
* Remove hardcoded min weight
* Add docu text, fix findings
* Fix api documentation
* Expose weight via DMF
* Expose actions according to weight via ddi
* Fix documentation
* Add method to get actions ordered by weight to deploymentManagement
* Updating the schema for targetfilterquery and rollout
* Updated the indentation
* Updated the helper class, fixed the randomUID in test factory
* Updated the class name with prefix JPA
* Adding the missing License for WeightValidationHelper class
* Adding documentation to the dmf api on weight
* Removed the merger markers
* Updated the class name
* Removed the redundant method
* Addressed final PR comments
* Updated the missing testcase with latest default weight value
* Reverting the default value of weight back to 1000 and updated tests

Signed-off-by: Shruthi Manavalli Ramanna <shruthimanavalli.ramanna@bosch-si.com>
Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>
2019-11-08 10:47:35 +01:00
Alexander Dobler
09f2d8a481 Fix upload quota check and provide better error message (#893)
* Adjusted upload quota check to include file size and show proper error message

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Fixed failing upload quota tests

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Moved quota check to stream, fixed review findings

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Added missing license header to QuotaInputStream

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Reworked uploadLock, ensured error messages may be translated, review fixes

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Added local artifactrepo to gitignore

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Fixed sonar issues and assignment quota message

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* PR review fixes

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Split quota exceptions, PR fixes

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Removed left over conversion method in quota helper

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Made conversion helper class final

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>
2019-10-30 11:24:33 +01:00
Stefan Klotz
8687510131 Assign multiple distribution sets to a target via mgmt api (#886)
* Add multiassignment to mgmt api target endpoint
* Remove single assignment ds to targets offline
* Fix tests
* Add quota for maxResultingActionsPerManualAssignment
* Fix assignment with same target or distribution set multiple times in one request
* Log UI error
* Add tests
* Enable single assignment requests with multiple DSs and types
* Remove redundant target to DS assignment methods
* Add tests, fix assignment
* Fix possible nullpointer during target assignment request
* Update api docu
* Clean up deployment management code
* Enforce MaxActions quota for offline assignment
* Fix review findings
* Rename property, add migration into
* Add builder for DeploymentRequest
* Change offline assignment method to accept an assignment list, like online assignment
* Fix PR findings

Signed-off-by: Stefan Klotz <stefan.klotz@bosch-si.com>
2019-09-17 14:20:26 +02:00
Ahmed Sayed
d40b11d2ab introduced open actionIds in MgmtTargetAssignmentResponseBody (#864)
* introduced open actionIds in MgmtTargetAssignmentResponseBody

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed SonarQube issues

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* removed unused method parameter

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* updated documentation tests

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* added limit to the alreadyAssignedActions in the AssignmentResult

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* moved alreadyAssignedActions limitation to MgmtDistributionSetMapper

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* removed alreadyAssignedActions

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed sonarQube issues

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed compilation error

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed PR review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed PR review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* Renamed AssignmentResult to AbstractAssignmentResult

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed review findings

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* fixed formatting

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>

* reverted method visibility

Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
2019-08-20 11:31:20 +02:00
Alexander Dobler
bde3548846 DDI supports sha256 (#869)
* Add SHA256 file hash to ddi GET outputs

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Integrate review findings for SHA256 changes

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Renamed hashes to base16hases in store() parameters

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>

* Added missing javadoc according to sonarqube findings

Signed-off-by: Alexander Dobler <alexander.dobler3@bosch-si.com>
2019-07-29 14:11:40 +02:00
Robert Sing
749218098f Fixed typos in server error codes and messages (#867)
* fixed typos in server error codes and messages

Signed-off-by: Robert Sing <Robert.Sing@bosch-si.com>

* reverted changes of server error message keys

Signed-off-by: Robert Sing <Robert.Sing@bosch-si.com>
2019-07-18 09:55:13 +02:00