Skip to content

Conversation

@geropl
Copy link
Member

@geropl geropl commented Dec 5, 2023

Description

Prepares the central function in Authorizer to switch the way we determine SubjectId, and adds exhaustive tests for it.

Summary generated by Copilot

🤖[deprecated] Generated by Copilot at 1f93161

Refactored and tested the authorization logic for handling different subjects in the request context. Moved some types and functions to separate files for better organization and readability. Added error handling and metrics for missing subject id when a feature flag is on. Improved the documentation and comments for the request context interface and related utilities.

Related Issue(s)

Related: EXP-1022

How to test

  • check that the tests in CI are ✔️

Documentation

Preview status

gitpod:summary

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold


/**
* The context all our request-handling code should run in.
* Creates a _root_ context request-handling code should run in. MANDATORY for any authorization to work.
Copy link
Contributor

Choose a reason for hiding this comment

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

if we never want to nest these, we should add a check and throw an error in case we do

Copy link
Member Author

Choose a reason for hiding this comment

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

That's an excellent point. I will add an error log for now, and make a note to bump it to an error next week (after checking it does not break somewhere) to not defer progress here. 📓

it("all tests", async () => {
interface Test {
name: string;
passed: Subject;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: passedSubjectId would have helped me understanding the purpose of this

@geropl geropl force-pushed the gpl/authorizer-rollout branch from 1f93161 to 133cab5 Compare December 6, 2023 08:48
@geropl
Copy link
Member Author

geropl commented Dec 6, 2023

/unhold

@roboquat roboquat merged commit 2b5a36e into main Dec 6, 2023
@roboquat roboquat deleted the gpl/authorizer-rollout branch December 6, 2023 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants