1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
Commit Graph

2352 Commits

Author SHA1 Message Date
Christopher Kolstad
29b292f1ea
task: make count column bigint. (#8183)
We now have customers that exceed INT capacity, so we need to change
this to BIGINT in client_metrics_env_variants_daily as well.

Even heavy users only have about 10000 rows here, so should be a quick
enough operation.
2024-09-19 10:59:40 +02:00
Thomas Heartman
15a98fcaf4
fix: update playground SDK to increase the possible random numbers used for stickiness id (#8182)
Same fix as done in some other sdks, such as the node one at
https://github.com/Unleash/unleash-client-node/pull/417o

Fixes an issue where 1% rollout would not yield any results with
random rollout for certain group ids
2024-09-19 08:34:04 +00:00
Mateusz Kwasniewski
8e037a335f
feat: personal dashboard route (#8173) 2024-09-19 09:59:07 +02:00
Gastón Fournier
a48da821ef
fix: upgrade openapi to drop dompurify and fix path-to-regexp (#8170)
This new version [does not depend on
dompurify](https://github.com/Unleash/unleash/pull/8170/files#diff-51e4f558fae534656963876761c95b83b6ef5da5103c4adef6768219ed76c2deL3853-L3858)
which should fix
https://github.com/Unleash/unleash/security/dependabot/195

Tested the UI locally

![image](https://github.com/user-attachments/assets/af350bf1-d736-4a4a-a092-53da2d21c471)
2024-09-18 12:16:21 +02:00
Nuno Góis
85b67ae330
chore: add eventTimeline feature flag (#8159)
https://linear.app/unleash/issue/2-2658/create-eventtimeline-feature-flag

Adds a new `eventTimeline` feature flag for the new event timeline
feature.

I think `eventTimeline` is an appropriate name given the feature
description and the way it is evolving, but I'm open to suggestions.
~~This also assumes that this feature will target OSS.~~ Confirmed that
this will be a premium feature.
2024-09-18 08:55:50 +01:00
Fredrik Strand Oseberg
2406b10ca3
chore: remove debug logs (#8147)
We used these logs to debug an issue in sandbox regarding permissions.
They are no longer needed.
2024-09-17 09:06:29 +02:00
Fredrik Strand Oseberg
9c435a9ec6
chore: add stringified logs (#8134) 2024-09-11 09:33:13 +02:00
Fredrik Strand Oseberg
8a92dd0fd7
chore: add logging to new code path (#8133) 2024-09-11 08:31:31 +02:00
Fredrik Strand Oseberg
e1b7cfd8dd
Fix/project role permission grant (#8084)
## Background

In #6380 we fixed a privilege escalation bug that allowed members of a
project that had permission to add users to the project with roles that
had a higher permission set than themselves. The PR linked essentially
constricts you only be able to assign users to roles that you possess
yourself if you are not an Admin or Project owner.

This fix broke expectations for another customer who needed to have a
project owner without the DELETE_PROJECT permission. The fix above made
it so that their custom project owner role only was able to assign users
to the project with the role that they posessed.

## Fix

Instead of looking directly at which role the role granter has, this PR
addresses the issue by making the assessment based on the permission
sets of the user and the roles to be granted. If the granter has all the
permissions of the role being granted, the granter is permitted to
assign the role.

## Other considerations

The endpoint to get roles was changed in this PR. It previously only
retrieved the roles that the user had in the project. This no-longer
makes sense because the user should be able to see other project roles
than the one they themselves hold when assigning users to the project.

The drawback of returning all project roles is that there may be a
project role in the list that the user does not have access to assign,
because they do not hold all the permissions required of the role. This
was discussed internally and we decided that it's an acceptable
trade-off for now because the complexities of returning a role list
based on comparing permissions set is not trivial. We would have to
retrieve each project role with permissions from the database, and run
the same in-memory check against the users permission to determine which
roles to return from this endpoint. Instead we opted for returning all
project roles and display an error if you try to assign a role that you
do not have access to.

## Follow up
When this is merged, there's no longer need for the frontend logic that
filters out roles in the role assignment form. I deliberately left this
out of the scope for this PR because I couldn't wrap my head around
everything that was going on there and I thought it was better to pair
on this with @chriswk or @nunogois in order to make sure we get this
right as the logic for this filtering seemed quite complex and was
touching multiple different components.

---------

Co-authored-by: Fredrik Strand Oseberg <fredrikstrandoseberg@Fredrik-sin-MacBook-Pro.local>
2024-09-10 20:35:45 +02:00
Mateusz Kwasniewski
47753b90b2
fix: user projects should exclude archived ones (#8118) 2024-09-06 12:29:05 +02:00
Jaanus Sellin
b6e22d6178
feat: new onboarding welcome screen logic (#8110)
1. We will not show grid until 2 flags exist
2. Now new feature creation button will be always displayed on top with
different style
3. Moved some text around


![image](https://github.com/user-attachments/assets/6cfc2152-b52d-479c-8a2e-988c9e8b79ad)
2024-09-06 13:15:28 +03:00
Thomas Heartman
c1092bacf9
fix: give project_default_strategy_write the ability to update the default strategy (#8112)
This appears to have been an oversight in the original implementation
of this endpoint. This seems to be the primary point of this
permission. Additionally, the docs mention that this permission should
allow you to do just that.

Note: I've not added any tests for this, because we don't typically add
tests for it. If we have an example to follow, I'd be very happy to add
it, though
2024-09-06 11:49:11 +02:00
Nuno Góis
ec417bf15e
docs: remove mention of admin name and email env vars (#8096)
https://github.com/Unleash/unleash/pull/7795 mistakenly included a
mention that these environment variables can be used:

- `UNLEASH_DEFAULT_ADMIN_NAME`
- `UNLEASH_DEFAULT_ADMIN_EMAIL`

However that's not really the case, since we decided to remove their
respective implementation before merging that PR.
2024-09-05 09:27:54 +01:00
Nuno Góis
39538012ac
fix: use the correct env vars for initial admin account (#8095)
https://github.com/Unleash/unleash/pull/7795 mistakenly changed the
initial admin account environment variables to be:

 - `INITIAL_ADMIN_USER_USERNAME`
 - `INITIAL_ADMIN_USER_PASSWORD`

Instead of the previous:

 - `UNLEASH_DEFAULT_ADMIN_USERNAME`
 - `UNLEASH_DEFAULT_ADMIN_PASSWORD`

See:
https://github.com/Unleash/unleash/pull/7795/files?diff=unified&w=0#diff-a38cc7ae9f963264333b6535498970a33e046dba50a6af554f438343a6edd2ddR319-R334

This PR reverts them back to the correct environment variable names and
adds a test to prevent something similar from happening in the future.
2024-09-05 09:10:51 +01:00
Nuno Góis
7bfc8b23ee
fix: add request body schema in update segment endpoint (#8085)
https://linear.app/unleash/issue/2-2592/updateimprove-a-segment-via-api-call

Related to https://github.com/Unleash/unleash/issues/7987

This does not make the endpoint necessarily better - It's still a PUT
that acts as a PUT in some ways (expects specific required fields to be
present, resets the project to `null` if it's not included in the body)
and a PATCH in others (ignores most fields if they're not included in
the body). We need to have a more in-depth discussion about developing
long-term strategies for our API and respective OpenAPI spec.

However this at least includes the proper schema for the request body,
which is slightly better than before.
2024-09-05 08:17:04 +01:00
Mateusz Kwasniewski
d220aaec0f
fix: editor can add dependencies in default project (#8077) 2024-09-04 11:25:32 +02:00
Jaanus Sellin
9eb80a8d48
chore: clear onboarding events (#8062)
Clearing onboarding tables, because the data is invalid and we want to
start tracking all of this for only new customers.
This migration must be applied after the new logic is implemented.
2024-09-03 16:27:11 +03:00
Mateusz Kwasniewski
3d63089cb2
feat: ignore onboarding events for existing customers (#8064) 2024-09-03 15:24:33 +02:00
Jaanus Sellin
037651c35f
feat: start returning onboarding status with project overview (#8058)
To show/hide onboarding flow, we need to get extra info about onboarding
status. This PR adds it to project overview.
2024-09-03 14:41:47 +03:00
Mateusz Kwasniewski
b350bd11a7
fix: onboarding events corner cases (#8057) 2024-09-03 12:53:48 +02:00
Tymoteusz Czech
ea328e5b43
fix: prevent config resolver snapshot test (#8041)
Prevent test failing on a system with different environment variables.
Spreading `experimental` serves similar purpose.
2024-09-02 15:14:34 +02:00
Tymoteusz Czech
76ffdb2cd3
chore: update Frontend schema (#8037)
update types, fix frontend types issues in insights and archive
2024-09-02 14:41:17 +02:00
Jaanus Sellin
e4fcb252d1
feat: welcome to your project component (#8039)
Currently displaying always when flag enabled.


![image](https://github.com/user-attachments/assets/e4c48595-b2d9-4093-af98-360d5856e7d5)
2024-09-02 15:09:00 +03:00
Tymoteusz Czech
bd25bb633d
Feat: projects OpenAPI update (#8036)
Make OpenApi ready for new project read-model.
2024-09-02 13:45:23 +02:00
Mateusz Kwasniewski
1bc0f97101
feat: onboarding service composition root (#8035) 2024-09-02 11:39:47 +02:00
Christopher Kolstad
0f5e4dc96b
task: remove upgrade edge banner. (#8032)
All customers but one are now upgraded, and this banner no longer adds
value, we also have the outdated SDK banner, which can fill in if
needed.
2024-09-02 10:50:19 +02:00
Jaanus Sellin
2a6b2e98e0
feat: onboarding table to prometheus (#8034)
Instead of lifecycle table, we take the metrics directly from onboarding
tables.
2024-09-02 11:41:00 +03:00
Mateusz Kwasniewski
f27e07ab88
feat: onboarding store (#8027) 2024-09-02 08:53:23 +02:00
gitar-bot[bot]
b26fb8992d
[Gitar] Cleaning up stale flag: killInsightsUI with value false (#8002)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-08-30 12:32:51 +02:00
Mateusz Kwasniewski
2a35976081
feat: user loging event emitting with login order (#8021) 2024-08-30 11:28:19 +02:00
Jaanus Sellin
4079485338
feat: collect onboarding events in separate table (#8020) 2024-08-30 11:34:47 +03:00
Mateusz Kwasniewski
c5d6bdecac
feat: projects onboarding metrics (#8014) 2024-08-29 14:57:27 +02:00
gitar-bot[bot]
536f7320b2
[Gitar] Cleaning up stale flag: checkEdgeValidTokensFromCache with value true (#7853)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

Co-authored-by: Gitar <noreply@gitar.co>
2024-08-29 12:27:33 +02:00
Jaanus Sellin
e61f016c8c
feat: start collecting prometheus metrics for onboarding events (#8012)
We start collecting prometheus metrics for onboarding events.

Co-authored-by: @kwasniew
2024-08-29 12:46:23 +03:00
Jaanus Sellin
5fe811ca3e
feat: start populating user first seen column (#8010)
Co-authored-by: kwasniew <kwasniewski.mateusz@gmail.com>
2024-08-29 10:45:30 +02:00
Jaanus Sellin
3188f991f4
feat: start tracking user first login migration (#8006)
Start tracking user first login.
2024-08-28 16:27:09 +03:00
gitar-bot[bot]
031a2e805a
[Gitar] Cleaning up stale flag: timeAgoRefactor with value true (#7997)
Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Tymoteusz Czech <2625371+Tymek@users.noreply.github.com>
2024-08-28 11:12:27 +00:00
Jaanus Sellin
7ad686e14e
fix: change .inc calls to .increment (#8000)
We are observing incorrect data in Prometheus, which is consistently
non-reproducible. After a restart, the issue does not occur, but if the
pods run for an extended period, they seem to enter a strange state
where the counters become entangled and start sharing arbitrary values
that are added to the counters.

For example, the `feature_lifecycle_stage_entered` counter gets an
arbitrary value, such as 12, added when `inc()` is called. The
`exceedsLimitErrorCounter` shows the same behavior, and the code
implementation is identical.

We also tested some existing `increase()` counters, and they do not
suffer from this issue.

All calls to `counter.labels(labels).inc(`) will be replaced by
`counter.increment()` to try to mitigate the issue.
2024-08-28 12:50:36 +03:00
Jaanus Sellin
3d22f6e909
fix: support search for tags that has colon inside (#7998)
Previously we expected the tag to look like `type:value`. Now we allow
everything after first colon, as the value and not break query
`type:this:still:is:value`.
2024-08-28 11:33:51 +03:00
Tymoteusz Czech
427c43e123
fix: project last seen at metrics (#7988)
Read `last_seen_at` from correct table `last_seen_at_metrics`, instead
of deprecated `feature.last_seen_at`
2024-08-27 10:17:19 +00:00
Thomas Heartman
9af42b3565
fix: add migration to normalize api token types (#7974)
Adds a migration to normalize api token types already in the database,
to remove any weird casing issues as currently demonstrated on sandbox


![image](https://github.com/user-attachments/assets/ad14db22-114d-4de2-b952-722df9ae84a4)

This is a companion piece to #7972
2024-08-23 13:29:49 +02:00
Mateusz Kwasniewski
1f3cc3917e
fix: split features schema into archived and project features (#7973) 2024-08-23 12:59:39 +02:00
Thomas Heartman
4693f7c598
fix: normalize casing for API token types before insert (#7972)
Fixes a bug where if you had API keys using different casing for the
same type, they'd come out as different types in the API token count
map. To get around it, we normalize the keys to lowercase before
inserting them into the map, taking into account any previous values
that might have existed for that type.

Should fix issues like this:

![image](https://github.com/user-attachments/assets/1fe218ed-7729-4a06-9a10-f4c8c7831bf8)
2024-08-23 12:53:53 +02:00
gitar-bot[bot]
4615ff40ce
[Gitar] Cleaning up stale flag: resourceLimits with value true (#7964)
[![Gitar](https://raw.githubusercontent.com/gitarcode/.github/main/assets/gitar-banner.svg)](https://gitar.co)
  
  ---
This automated PR was generated by [Gitar](https://gitar.co). View
[docs](https://gitar.co/docs).

---------

Co-authored-by: Gitar <noreply@gitar.co>
Co-authored-by: Thomas Heartman <thomas@getunleash.io>
2024-08-22 13:20:53 +02:00
Thomas Heartman
b0541a0af2
feat: add remaining resource usage to instance stats (#7958)
Updates the instance stats endpoint with 
- maxEnvironmentStrategies
- maxConstraints
- maxConstraintValues

It adds the following rows to the front end table:
- segments (already in the payload, just not used for the table before)
- API tokens (separate rows for type, + one for total) (also existed
before, but wasn't listed)
- Highest number of strategies used for a single flag in a single
environment
- Highest number of constraints used on a single strategy
- Highest number of values used for a single constraint


![image](https://github.com/user-attachments/assets/57798f8e-c466-4590-820b-15afd3729243)
2024-08-22 13:09:26 +02:00
David Leek
00700918c8
chore: remove unused feature flag for webhooks name logging (#7968) 2024-08-22 12:39:52 +02:00
David Leek
e13f7eea63
feat: log domain every time a webhook is invoked (#7962) 2024-08-22 11:26:53 +02:00
Thomas Heartman
e5cca661d9
fix: serialize API token data correctly in instance stats (#7953)
Turns out we've been trying to return API token data in instance stats
for a while, but that the serialization has failed. Serializing a JS map
just yields an empty object.

This PR fixes that serialization and also adds API tokens to the
instance stats schema (it wasn't before, but we did return it). Adding
it to the schema is also part of making resource usage visible as part
of the soft limits project.
2024-08-22 10:29:05 +02:00
Jaanus Sellin
ead195923c
fix: fixing flaky test, because order for distinct may be random (#7954) 2024-08-21 15:42:23 +03:00
Jaanus Sellin
99e4a564d0
fix: fix events with no-project projects (#7951)
Fixes issue where `segment-created `events had fake project name
**no-project** attached.

In total for previous 4 months, all segments created that were global
segments, have this issue.


https://github.com/Unleash/unleash/pull/6872/files#diff-68dcd43b31d35a8a80c73bca1f2a9626b0234dd0b76920a6881b81fa04708268R135
2024-08-21 15:32:37 +03:00