1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
Commit Graph

952 Commits

Author SHA1 Message Date
Tymoteusz Czech
169b2bd0c5
Strategy title frontend (#3556)
Ability to add a title to a strategy
2023-04-19 17:27:23 +00:00
Christopher Kolstad
4f7fd46623
fix: return 404 when gettings tags for a non existing feature (#3560)
From the discussion here
https://github.com/Unleash/unleash/pull/3496#discussion_r1163745860

This PR checks the existence of the feature before trying to get tags
for the feature. Doing so by stealing the exists method from the feature
store, since that's what we need to know exists, and avoiding having the
feature store as a dependency to the featureTagStore seemed reasonable.
2023-04-19 14:10:13 +02:00
Gastón Fournier
0e80484068
docs: update documentation and dev server use of passord (#3564)
## About the changes
Update `passord` documentation with `password`. Note this was not a typo
but just Norwegian:
https://dictionary.cambridge.org/dictionary/english-norwegian/password
```shell
grep passord * -R -l | grep -v .git | grep -v dist | grep -v v3 | xargs sed -i 's/passord/password/g'
```
The script above avoids updating v3 because of legacy reasons

Related to #1265
2023-04-19 13:29:18 +02:00
andreas-unleash
9e1241d728
fix: migration (#3558)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Fixes `down` migration  for add_title_to_strategy
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-19 10:07:56 +03:00
Gastón Fournier
008d9b8bb6
feat: deprecate state api (#3551)
## About the changes
This deprecates state API in favor of the new batch import/export
2023-04-18 18:34:12 +02:00
Thomas Heartman
34204c3565
chore: remove uses of type errors from user-facing code (#3553)
BREAKING CHANGE: This changes the `name` property of a small number of error responses that we return. The property would have been `TypeError`, but is now `ValidationError` instead. It's a grey area, but I'd rather be strict.

---

This change removes uses of the `TypeError` type from user-facing code.
Type errors are used by typescript when you provide it the wrong type.
This is a valid concern. However, in the API, they're usually a signal
that **we've** done something wrong rather than the user having done
something wrong. As such, it makes more sense to return them as
validation errors or bad request errors.

## Breaking changes

Note that because of the way we handle errors, some of these changes
will be made visible to the end user, but only in the response body.

```ts
{ "name": "TypeError", "message": "Something is wrong", "isJoi": true }
```

will become

```ts
{ "name": "ValidationError", "message": "Something is wrong", "isJoi": true }
```

Technically, this could be considered a breaking change. However, as
we're gearing up for v5, this might be a good time to merge that?

## A return to 500

This PR also makes TypeErrors a 500-type error again because they should
never be caused by invalid data provided by the user
2023-04-18 13:42:07 +02:00
Thomas Heartman
e11fae56e9
OpenAPI: addon operations (#3421)
This PR updates the OpenAPI schemas for all the operations tagged with
"addons". In doing so, I also uncovered a few bugs and inconsistencies.
These have also been fixed.

## Changes

I've added inline comments to the changed files to call out anything
that I think is worth clarifying specifically. As an overall
description, this PR does the following:

Splits `addon-schema` into `addon-schema` and
`addon-create-update-schema`. The former is used when describing addons
that exist within Unleash and contain IDs and `created_at` timestamps.
The latter is used when creating or updating addons.

Adds examples and descriptions to all relevant schemas (and their
dependencies).

Updates addons operations descriptions and response codes (including the
recently introduced 413 and 415).

Fixes a bug where the server would crash if it didn't recognize the
addon provider (test added).

Fixes a bug where updating an addon wouldn't return anything, even if
the API said that it would. (test added)

Resolves some inconsistencies in handling of addon description. (tests
added)

### Addon descriptions

when creating addons, descriptions are optional. The original
`addonSchema` said they could be `null | string | undefined`. This
caused some inconsistencies in return values. Sometimes they were
returned, other times not. I've made it so that `descriptions` are now
always returned from the API. If it's not defined or if it's set to
`null`, the API will return `description: null`.

### `IAddonDto`

`IAddonDto`, the type we used internally to model the incoming addons
(for create and update) says that `description` is required. This hasn't
been true at least since we introduced OpenAPI schemas. As such, the
update and insert methods that the service uses were incompatible with
the **actual** data that we require.

I've changed the type to reflect reality for now. Assuming the tests
pass, this **should** all be good, but I'd like the reviewer(s) to give
this a think too.

---------

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2023-04-18 10:50:34 +00:00
Gastón Fournier
c97294aee4
Fix openapi tests (#3549)
## About the changes
Update tests due to fixes introduced in
2da279b7fb

This PR removes the fixes from the exceptions' list
2023-04-18 08:17:23 +00:00
andreas-unleash
2da279b7fb
feat: add title to strategy (#3510)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Adds title column to strategies, feature_strategies and features_view in
the db
Updates model/schemas
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #
[1-855](https://linear.app/unleash/issue/1-855/allow-for-title-on-strategy-backend)

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-18 08:59:02 +02:00
Gastón Fournier
5940a81158
docs: improve open api (#3535)
## About the changes
Amends based on https://github.com/Unleash/unleash/pull/3519
2023-04-18 08:50:36 +02:00
Mateusz Kwasniewski
5fa13aba0e
feat: remove project overview flags (#3532) 2023-04-17 11:21:52 +02:00
Gastón Fournier
4f78db3be9
fix: segments schemas (#3525)
## About the changes
Remove segment schemas from exceptions

---------

Co-authored-by: GitHub Actions Bot <>
2023-04-17 10:51:48 +02:00
Gastón Fournier
d9b6357281
Fix main after OpenAPI fixes (#3530)
## About the changes
After fixing some OpenAPI descriptions:
6cc51b7ba0
this test needs to be updated
2023-04-17 10:34:29 +02:00
Gastón Fournier
ea9bf7f447
chore: add linter rules for regexp (#3500)
## About the changes
Add linter rules for regexp security vulnerabilities

Commit 1c5d54c76e [fails due to
regexp/no-super-linear-backtracking](https://github.com/Unleash/unleash/actions/runs/4668430535/jobs/8265506170#step:5:37)
as reported here:
https://github.com/Unleash/unleash/security/code-scanning/1


[0127d1a](0127d1a746)
fixes the issues and warnings by running `yarn lint --fix`
2023-04-17 07:11:22 +00:00
Christopher Kolstad
6cc51b7ba0
docs: Added docs for edge endpoints (#3501)
Adding documentation for the edge endpoints. Also separating request and
response schema for our validate endpoint to make clear that we expect a
list of strings as input, but yield tokens as output.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-04-14 15:39:39 +02:00
Gastón Fournier
9105f31e81
fix: test in main (#3526)
## About the changes
Due to some merge conflict some open API specs marked as exceptions are
no longer exceptions
2023-04-14 12:30:11 +00:00
Gastón Fournier
ff99ffc27c
chore: rule for description on properties (#3523)
## About the changes
This rule defines that all properties should have a description

We also considered enforcing an example but we noticed that in some
cases that's not needed.
2023-04-14 13:38:58 +02:00
Gastón Fournier
d4c24c9520
chore: amend open api tags descriptions and examples (#3519)
## About the changes
Adds descriptions and examples to tag schemas
2023-04-14 12:26:19 +02:00
Gastón Fournier
19982ecbc7
chore: test requirements for openapi (#3511)
## About the changes
This enables us to validate the shape of our OpenAPI schemas by defining
specific json-schema rules that will be evaluated against all our open
API schemas.

Because we know there are things we need to improve, we've added a list
of `knownExceptions`. When fixing some of the known exceptions the tests
will force us to remove the exception from the list, that way
contributing to reducing the number of violations to our own rules.

Co-authored-by: Mateusz Kwasniewski <kwasniewski.mateusz@gmail.com>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2023-04-14 10:37:17 +02:00
Mateusz Kwasniewski
51e871da96
fix: 4 param error handler (#3520) 2023-04-14 08:59:27 +02:00
Nuno Góis
d2da6de7d5
feat: adds demo feature flag (#3514)
https://linear.app/unleash/issue/2-912/create-demo-feature-flag

Adds `demo` as a feature flag that controls the new interactive demo
feature.
2023-04-13 12:06:00 +01:00
andreas-unleash
60a2c1a996
chore: Backport 4.22.3 (#3508)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Backports stickiness fixes 
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Gastón Fournier <gaston@getunleash.io>
Co-authored-by: GitHub Actions Bot <>
Co-authored-by: Mateusz Kwasniewski <kwasniewski.mateusz@gmail.com>
2023-04-12 16:22:13 +03:00
Mateusz Kwasniewski
4c30a5dcac
chore: remove unused flags (#3506) 2023-04-12 09:57:43 +00:00
Gastón Fournier
37beaa611f
chore: Improve openapi documentation for tags (#3496)
## About the changes
1. Create tag should not throw a 500 when bad data is provided
2. Added summary, description and examples to open API endpoints

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-04-12 09:34:32 +00:00
Gastón Fournier
c1a1a0fdeb
docs: open api examples for segment schemas (#3503)
## About the changes
Add additional documentation for segments

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2023-04-12 09:29:51 +00:00
Mateusz Kwasniewski
15e5b983ac
feat: change request title migration (#3502) 2023-04-12 08:42:52 +02:00
Mateusz Kwasniewski
84bf60ca78
feat: Catch all error handler (#3499) 2023-04-12 08:05:34 +02:00
Gastón Fournier
5ff883bc69
fix: security vulnerability (#3497)
This was an oversight of https://github.com/Unleash/unleash/pull/3402
2023-04-11 16:13:59 +02:00
Mateusz Kwasniewski
3b1157b869
feat: skip change request in UI (#3495) 2023-04-11 14:47:54 +02:00
Mateusz Kwasniewski
d9f22f4349
feat: Maintenance openapi (#3478) 2023-04-10 09:55:29 +02:00
Mateusz Kwasniewski
f1133556bd
refactor: switching to new stats calculations (#3477) 2023-04-10 09:50:39 +02:00
Mateusz Kwasniewski
8d61332543
refactor: Improved lead time calculation (#3475) 2023-04-07 13:31:27 +02:00
Tymoteusz Czech
8f278cb726
Fix: feature schema (#3456) 2023-04-07 09:16:00 +00:00
Mateusz Kwasniewski
126d2d2e45
feat: save memory on reading stats (#3472) 2023-04-06 15:34:08 +02:00
Jaanus Sellin
14a2ca700c
feat: rate limit user creation (#3468) 2023-04-06 13:45:54 +02:00
Jaanus Sellin
33487d11b9
feat: authorization middleware (#3464) 2023-04-06 11:46:54 +02:00
Jaanus Sellin
80bea14d42
feat: changing password will expire reset password tokens (#3451) 2023-04-05 12:39:52 +03:00
Gastón Fournier
0e37e68424
feat: add PAT kill switch (#3454)
## Add the ability to disable Personal Access Tokens (PAT) admin API

This PR disables PAT admin endpoints so it's not possible to create or
get PATs the kill switch is enabled, the UI is hidden but the existing
PATs will continue to work if they were created before. The delete
endpoint still works allowing an admin to delete old PATs

By default the kill switch is disabled (i.e. PAT is enabled by default)
2023-04-05 10:20:50 +02:00
Christopher Kolstad
512efe0809
docs: Flesh out openapi for tag: Environments (#3440)
### What
This fleshes out the documentation for actions tagged with Environments.

Co-authored-by: Thomas Heartman <thomas@getunleash.ai>
2023-04-04 15:45:34 +02:00
andreas-unleash
3a84dfde08
fix: bug (#3449)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->
Remove enum for defaultStickiness from joi schema
## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-04-04 15:52:45 +03:00
Mateusz Kwasniewski
c16fde5ab4
test: increase timer values in scheduler integration test (#3448) 2023-04-04 14:15:45 +02:00
Mateusz Kwasniewski
8654c9ea42
feat: postgres lock (#3443) 2023-04-04 13:28:17 +02:00
Gastón Fournier
2bfbe3cd79
fix: concurrency issue when running multiple requests (#3442)
## About the changes

Fix issue when running multiple calls to the /frontend endpoint concurrently, which ends up creating many instances of unleash SDK client.
2023-04-04 09:32:35 +02:00
Gastón Fournier
36f1125c25
fix: input used to read file should be sanitized (#3402)
## About the changes
Following the recommendation to fix
https://github.com/Unleash/unleash/security/code-scanning/2 and
https://github.com/Unleash/unleash/security/code-scanning/3

The endpoint seems to be used for developing purposes only (to preview
an email under development) but it's available in every Unleash
installation and can potentially be exploited.
2023-04-03 14:17:44 +02:00
Nuno Góis
07e8e5826c
refactor: revert adding apiPagination feature flag (#3433)
Reverts https://github.com/Unleash/unleash/pull/3417 - If we're not
going forward with this project at this stage, we should clean up after
ourselves and remove the unused flag that we added.
2023-03-31 13:20:18 +02:00
Nuno Góis
fbb1280b0e
fix: show profile projects correctly (#3422)
Profile projects were not showing correctly in most cases. This fixes
the query to only take into consider whether you have access to the
project (either directly or through a group).

![image](https://user-images.githubusercontent.com/14320932/228598175-874f0daa-8d33-49a8-b6f8-072942876138.png)
2023-03-30 07:37:42 +00:00
andreas-unleash
87c1407923
chore: remove showProjectApiAccess flag (#3406)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

Remove `showProjectApiAccess` flag

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-30 10:22:45 +03:00
Nuno Góis
2a4ef56935
feat: add API pagination feature flag (#3417)
https://linear.app/unleash/issue/2-826/add-pagination-feature-flag

Adds `apiPagination` feature flag in order to start
https://linear.app/unleash/project/[med][m][none]-api-filter-and-pagination-support-29ef4909dd2e/2
2023-03-29 09:01:57 +01:00
andreas-unleash
9b6f5cd198
fix: make api tokens ui consistent and remove check for deprecated envs. (#3410)
<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

This PR removes the check for deprecated environments when validating
api token environment.

Unifies global and project level tokens allow selection of deprecated
environments when creating an api token

Adds 'deprecated' to the EnvironmentSelector when appropriate

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-03-29 10:33:14 +03:00
Jaanus Sellin
99bcd7ca5c
feat: add import export flag (#3411) 2023-03-29 09:19:33 +03:00