1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-04 00:18:40 +01:00
Commit Graph

547 Commits

Author SHA1 Message Date
Gastón Fournier
45de8ceae0
chore: type our path parameters when they are numbers ()
Path types in our openapi are inferred as string (which is a sensible
default). But we can be more specific and provide the right type for
each parameter. This is one example of how we can do that
2024-08-21 13:01:00 +02:00
David Leek
74133395cc
chore: change integration events api tag to addons () 2024-08-20 14:00:58 +02:00
Gastón Fournier
cac621c450
fix: messed up on merge-conflicts ()
When fixing conflicts accidentally I've undone my changes
2024-08-14 12:00:57 +02:00
Nuno Góis
585eb30730
chore: initial admin email ()
https://linear.app/unleash/issue/2-2518/figure-out-how-to-create-the-initial-admin-user-in-unleash

The logic around `initAdminUser` that was introduced in
https://github.com/Unleash/unleash/pull/4927 confused me a bit. I wrote
new tests with what I assume are our expectations for this feature and
refactored the code accordingly, but would like someone to confirm that
it makes sense to them as well.

The logic was split into 2 different methods: one to get the initial
invite link, and another to send a welcome email. Now these two methods
are more granular than the previous alternative and can be used
independently of creating a new user.

---------

Co-authored-by: Gastón Fournier <gaston@getunleash.io>
2024-08-14 10:05:11 +02:00
Jaanus Sellin
2f92dac14e
feat: event creators ()
Adds an endpoint to return all event creators.

An interesting point is that it does not return the user object, but
just created_by as a string. This is because we do not store user IDs
for events, as they are not strictly bound to a user object, but rather
a historical user with the name X.
2024-08-09 10:32:31 +03:00
Simon Hornby
a507ca91a5
chore: remove scim api flag () 2024-08-07 09:19:42 +02:00
Jaanus Sellin
57a8b9da79
feat: event search on new endpoint, first test ()
Changed the url of event search to search/events to align with
search/features. With that created a search controller to keep all
searches under there.
Added first test.
2024-08-02 15:07:21 +03:00
Jaanus Sellin
bcb7a803d0
feat: new event search ()
This introduces the new event search API, with paging.
2024-08-02 10:56:42 +03:00
Nuno Góis
1d6dc9b195
chore: integration events API ()
https://linear.app/unleash/issue/2-2439/create-new-integration-events-endpoint

https://linear.app/unleash/issue/2-2436/create-new-integration-event-openapi-schemas

This adds a new `/events` endpoint to the Addons API, allowing us to
fetch integration events for a specific integration configuration id.


![image](https://github.com/user-attachments/assets/e95b669e-e498-40c0-9d66-55be30a24c13)

Also includes:
- `IntegrationEventsSchema`: New schema to represent the response object
of the list of integration events;
- `yarn schema:update`: New `package.json` script to update the OpenAPI
spec file;
- `BasePaginationParameters`: This is copied from Enterprise. After
merging this we should be able to refactor Enterprise to use this one
instead of the one it has, so we don't repeat ourselves;

We're also now correctly representing the BIGSERIAL as BigInt (string +
pattern) in our OpenAPI schema. Otherwise our validation would complain,
since we're saying it's a number in the schema but in fact returning a
string.
2024-07-23 10:09:19 +01:00
Christopher Kolstad
f65afff6c1
feat: Disallow repeating last 5 passwords. ()
We'll store hashes for the last 5 passwords, fetch them all for the user
wanting to change their password, and make sure the password does not
verify against any of the 5 stored hashes.

Includes some password-related UI/UX improvements and refactors. Also
some fixes related to reset password rate limiting (instead of an
unhandled exception), and token expiration on error.

---------

Co-authored-by: Nuno Góis <github@nunogois.com>
2024-07-09 16:18:35 +02:00
Thomas Heartman
6d913809ca
chore: extract api token service composition root; place it in /features ()
This is a refactoring task, creating an ApiTokenService composition root
in /features.
2024-07-03 11:49:11 +02:00
Mateusz Kwasniewski
c3fa468a9d
refactor: lifecycle stage duration outside instance stats () 2024-06-25 11:22:26 +02:00
Mateusz Kwasniewski
ea1221c45e
chore: remove unstable label from GA metrics features () 2024-06-24 13:32:35 +02:00
Thomas Heartman
2bad98a121
fix: disallow invalid tag values ()
This PR fixes how Unleash handles tag values. Specifically, it does
these things:
1. Trims leading and trailing whitespace from tag values before
inserting them into the database
2. Updates OpenAPI validation to not allow whitespace-only and to ignore
leading and trailing whitespace

Additionally, it moves the tag length constants into the constants file
from the Joi tag schema file. This is because importing the values
previously rendered them as undefined (probably due to a circular
dependency somewhere in the system). This means that the previous values
were also ignored by OpenAPI.

UI updates reflecting this wil follow.

## Background
When you tag a flag, there's nothing stopping you from using an entirely
empty tag or a tag with leading/trailing whitespace.

Empty tags make little sense and leading trailing whitespace differences
are incredibly subtle:

![image](https://github.com/Unleash/unleash/assets/17786332/ec8fe193-8837-4c6a-b7bf-8766eff34eed)


Additionally, leading and trailing whitespace is not shown in the
dropdown list, so you'd have to guess at which is the right one.

![image](https://github.com/Unleash/unleash/assets/17786332/a14698ab-2bfd-4ec3-8814-b8e876d0aadb)
2024-06-05 08:31:30 +02:00
David Leek
61a8908694
chore: remove state service ()
## About the changes

Removes the deprecated state endpoint, state-service (despite the
service itself not having been marked as deprecated), and the file
import in server-impl. Leaves a TODO in place of where file import was
as traces for a replacement file import based on the new import/export
functionality
2024-05-28 14:47:31 +02:00
Simon Hornby
f16f8594f5
chore: deprecate custom strategies () 2024-05-28 12:33:53 +02:00
Christopher Kolstad
cea64dc21d
task: Removed edge bulk metrics endpoint ()
Removes /edge/metrics. This has been superseded by
/api/client/metrics/bulk. Once this is merged, Unleash 6.0 will require
Edge > 17.0.0. (We recommend at least v19.1.3)
2024-05-28 11:30:41 +02:00
Jaanus Sellin
304d619597
chore: upgrade edge banner version ()
Upgrading banner to 19.1.3, because we fixed critical issue there.
2024-05-28 12:16:42 +03:00
Thomas Heartman
f518b12b07
chore!: [v6] remove error.description in error messages ()
In preparation for v6, this PR removes usage and references to
`error.description` instead favoring `error.message` (as mentioned
)

I found no references in the front end, so this might be (I believe it
to be) all the required changes.
2024-05-27 11:26:19 +02:00
Gastón Fournier
345c34a945
feat: add ip to state-service and group-service ()
The add ip to two services. Despite state is being deprecated, I think
we better get it out of the way.
2024-05-24 09:53:46 +02:00
Jaanus Sellin
7937301424
chore: rename toggle to flag () 2024-05-23 11:32:11 +03:00
Jaanus Sellin
958ccabb54
feat: lifecycle prometheus metrics per project ()
When we pushed metrics per feature, it had too many datapoints and
grafana could not handle it. Now I am taking median for a project.
2024-05-10 15:24:27 +03:00
Jaanus Sellin
cd49ae2a26
feat: add project id to prometheus and feature flag ()
Now we are also sending project id to prometheus, also querying from
database. This sets us up for grafana dashboard.
Also put the metrics behind flag, just incase it causes cpu/memory
issues.
2024-05-08 15:19:23 +03:00
Jaanus Sellin
02440dfed2
feat: duration in stage, add feature lifecycle prometheus metrics ()
Introduce a new concept. Duration in stage.
Also add it into prometheus metric.
2024-05-08 11:33:51 +03:00
Christopher Kolstad
cf2bd28ff6
feat: use audit info in events ()
I've tried to use/add the audit info to all events I could see/find.
This makes this PR necessarily huge, because we do store quite a few
events. 

I realise it might not be complete yet, but tests
run green, and I think we now have a pattern to follow for other events.
2024-04-18 16:32:35 +02:00
Christopher Kolstad
633cae6f0d
feat: added IAuditUser to request with middleware ()
Adds a middleware which adds our needed audit info as a separate object
to the request.
2024-04-18 10:13:40 +02:00
Jaanus Sellin
023e1594e9
feat: validate that id is number or we throw our our source code ()
Previously, we were not validating that the ID was a number, which
sometimes resulted in returning our database queries (source code) to
the frontend. Now, we have validation middleware.
2024-04-16 15:48:57 +03:00
Nuno Góis
f4ef06f69b
chore: SCIM guard for users ()
https://linear.app/unleash/issue/2-2093/api-should-not-allow-manual-management-of-scim-managed-users-in

Introduces a SCIM guard for SCIM users. SCIM users should be managed
exclusively by the SCIM client, not Unleash.

We decided to be restrictive for now, completely covering all of the
write methods, but may fine-tune some of this at a later stage.

Will eventually be followed up by a UI-centric PR.
2024-04-12 08:23:35 +01:00
Mateusz Kwasniewski
0422e5b5b0
feat: private projects in application overview () 2024-04-04 14:56:21 +02:00
Jaanus Sellin
d3847fd8ee
feat: collect prometheus data about archived features () 2024-03-28 13:40:30 +02:00
gitar-bot[bot]
ca6946df86
chore: [Gitar] Cleaning up stale feature flag: sdkReporting with value true ()
Co-authored-by: Gitar Bot <noreply@gitar.co>
Co-authored-by: sjaanus <sellinjaanus@gmail.com>
2024-03-28 09:19:11 +02:00
Christopher Kolstad
53354224fc
chore: Bump biome and configure husky ()
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00
Mateusz Kwasniewski
9438400e77
feat: outdated sdks api () 2024-03-13 15:56:22 +01:00
Mateusz Kwasniewski
1f374ea20e
refactor: rename proxy to frontend api () 2024-03-11 17:30:46 +01:00
Mateusz Kwasniewski
2a3959082c
refactor: proxy/frontend api in feature oriented architecture () 2024-03-11 09:28:40 +01:00
Jaanus Sellin
381af7835b
feat: sort frontend api features by name () 2024-03-08 15:34:33 +02:00
Mateusz Kwasniewski
8f105f9d30
feat: Compare old results with new frontend api () 2024-03-08 13:03:41 +01:00
Gastón Fournier
5b87ca6b75
chore: consider execution limits per minute and actions limit per ()
## About the changes
Define a schema that works both for the frontend and the backend to
define soft limits in the resource usage.
2024-03-07 13:02:49 +01:00
Gastón Fournier
e8e1d6e9f0
fix: path metric labels ()
## About the changes
Some of our metrics are not labeled correctly, one example is
`<base-path>/api/frontend/client/metrics` is labeled as
`/client/metrics`. We can see that in internal-backstage/prometheus:

![image](https://github.com/Unleash/unleash/assets/455064/0d8f1f40-8b5b-49d4-8a88-70b523e9be09)

This issue affects all endpoints that fail to validate the request body.
Also, endpoints that are rejected by the authorization-middleware or the
api-token-middleware are reported as `(hidden)`.

To gain more insights on our api usage but being protective of metrics
cardinality we're prefixing `(hidden)` with some well known base urls:
https://github.com/Unleash/unleash/pull/6400/files#diff-1ed998ca46ffc97c9c0d5d400bfd982dbffdb3004b78a230a8a38e7644eee9b6R17-R33

## How to reproduce:
Make an invalid call to metrics (e.g. stop set to null), then check
/internal-backstage/prometheus and find the 400 error. Expected to be at
`path="/api/client/metrics"` but will have `path=""`:
```shell
curl -H"Authorization: *:development.unleash-insecure-client-api-token" -H'Content-type: application/json' localhost:4242/api/client/metrics -d '{
  "appName": "bash-test",
  "instanceId": "application-name-dacb1234",
  "environment": "development",
  "bucket": {
    "start": "2023-07-27T11:23:44Z",
    "stop": null,
    "toggles": {
      "myCoolToggle": {
        "yes": 25,
        "no": 42,
        "variants": {
          "blue": 6,
          "green": 15,
          "red": 46
        }
      },
      "myOtherToggle": {
        "yes": 0,
        "no": 100
      }
    }
  }
}'
```
2024-03-05 15:25:06 +01:00
Christopher Kolstad
c9e7bec690
task: upgrade edge banner now toggleable by flag ()
So, since our assumption about client instances ended up being wrong (or, less than stable).
This PR moves the EdgeUpgradeBanner to be displayed if the featureflag
displayEdgeBanner is enabled. That way, if customers comes back and says
they have upgraded but still get the banner, we can remove them from the
segment.
2024-02-28 14:06:46 +01:00
Mateusz Kwasniewski
b82a650dab
feat: connected instances support query param for env () 2024-02-28 08:57:34 +01:00
Mateusz Kwasniewski
91c08593a6
feat: app env instances api () 2024-02-26 14:27:44 +01:00
Jaanus Sellin
fb63f21d8a
feat: project applications paging backend () 2024-02-22 15:35:16 +02:00
Mateusz Kwasniewski
81ab77cf7c
feat: schema for paginated applications () 2024-02-22 12:18:23 +01:00
Jaanus Sellin
3c4457af00
feat: application overview backend () 2024-02-22 08:20:57 +02:00
Jaanus Sellin
7baed29c07
feat: application overview schema () 2024-02-21 12:59:55 +02:00
Mateusz Kwasniewski
e5c07f00cb
feat: rate limit password reset attempts () 2024-02-21 08:49:54 +01:00
Christopher Kolstad
7350c91a1e
fix: display all roles if we can't get project roles 2024-02-20 16:23:25 +01:00
Christopher Kolstad
e9d9db17fe
feat: Adding Project access requires same role ()
In order to prevent users from being able to assign roles/permissions
they don't have, this PR adds a check that the user performing the
action either is Admin, Project owner or has the same role they are
trying to grant/add.

This addAccess method is only used from Enterprise, so there will be a
separate PR there, updating how we return the roles list for a user, so
that our frontend can only present the roles a user is actually allowed
to grant.

This adds the validation to the backend to ensure that even if the
frontend thinks we're allowed to add any role to any user here, the
backend can be smart enough to stop it.

We should still update frontend as well, so that it doesn't look like we
can add roles we won't be allowed to.
2024-02-20 15:56:53 +01:00
Gastón Fournier
9c156ac31f
chore: avoid printing out warnings from known frontend proxies ()
## About the changes
Our frontend API creates new instances of unleash-client-proxy. Because
this is by-design, we don't want to log a warning that was designed to
warn users about potential misconfiguration of Unleash Proxy.

As an extra, I'm renaming ProxyController to FrontendAPIController to
better reflect the intent of this controller.
2024-02-20 11:27:21 +01:00