Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent API requests from firing when no measures #5446

Merged
merged 28 commits into from
Sep 10, 2024

Conversation

lovincyrus
Copy link
Contributor

@lovincyrus lovincyrus commented Aug 13, 2024

This PR prevents the API requests from running when there are no measures mentioned in the security policy. Closes #5224

  • How to check for project admins?
  • Check for no measures before firing the API requests
  • Check error banner for project admins only
  • Update "Error parsing dashboard" to banner instead of ErrorPage
  • Test error banner when there is a parser error
  • admin & non-admin - ErrorPage - not measures available
  • use the actual measures
  • non-admin - hide the error banner, prevent api request from running

Related: #5432

Set up this project to test this PR: #5224 (comment)

@lovincyrus lovincyrus force-pushed the cyrus/prevent-requests-no-measures branch 2 times, most recently from dd55743 to c068e1b Compare August 16, 2024 19:00
@nishantmonu51 nishantmonu51 added the blocker A release blocker issue that should be resolved before a new release label Sep 3, 2024
@lovincyrus lovincyrus force-pushed the cyrus/prevent-requests-no-measures branch from cbf6c2c to 95d67c3 Compare September 4, 2024 23:51
@lovincyrus lovincyrus marked this pull request as ready for review September 5, 2024 18:56
@lovincyrus
Copy link
Contributor Author

Recording:

CleanShot.2024-09-05.at.11.55.53.mp4

@lovincyrus
Copy link
Contributor Author

Latest:

  • Display ErrorPage with no measures available in admin and non-admin mock users
  • Prevent ProjectParser API request from firing when there are no measures
CleanShot.2024-09-05.at.16.58.30.mp4

@lovincyrus
Copy link
Contributor Author

Addressed the feedback from our offline sync @ericpgreen2

Copy link
Contributor

@ericpgreen2 ericpgreen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good for now (pending my last 2 PR comments), though I'll note that this doesn't handle the case for Rill Cloud. We can skip Rill Cloud handling for now because:

  1. The error case is more likely in Rill Developer (when you're developing your security policy) than in Rill Cloud
  2. It'll be cleaner to add this logic to Rill Cloud once we move the dashboard's instantiation logic to a SvelteKit load function (which @AdityaHegde is considering in his "human-readable" URL state work), so IMO we can wait until then.

web-local/src/routes/(viz)/dashboard/[name]/+page.svelte Outdated Show resolved Hide resolved
web-local/src/routes/(viz)/dashboard/[name]/+page.svelte Outdated Show resolved Hide resolved
@lovincyrus lovincyrus merged commit 14e2403 into main Sep 10, 2024
7 checks passed
@lovincyrus lovincyrus deleted the cyrus/prevent-requests-no-measures branch September 10, 2024 15:51
ericpgreen2 pushed a commit that referenced this pull request Sep 12, 2024
* prevent aggregation and timeseries requests from running when no measures

* prevent aggregation and timeseries requests from running when no measures

* gracefully fail with no measures

* reset

* comments

* lint

* wip

* wip

* skip firing if no measures

* handle no measures before firing

* clean up

* todos

* lint

* error banner when parser error, no mock user or mock user is admin

* handle more structure for the writable

* update error parsing dashboard to banner rather than errorpage

* test error banner

* clean up

* hide banner when error page is on

* mock user admin check for error banner

* error page for admin/non-admin, no measures available

* use the actual measures

* hide previous banner error

* enable conditionally in useProjectParser

* lint

* pr feedback

* pr feedback

* lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker A release blocker issue that should be resolved before a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Security policy without measures should not fire certain API requests
3 participants