Skip to content

[authorizer] prepare Authorizer for SubjectId rollout #19195

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

Merged
merged 1 commit into from
Dec 6, 2023

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

@@ -165,7 +166,8 @@ export type RequestContextSeed = Omit<RequestContext, "requestId" | "startTime"
};

/**
* 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
Member

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
Member

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.

3 participants