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

test(artifacts): demonstrate that S3ArtifactStoreGetter.get does not … #1178

Merged

Conversation

dbyron-sf
Copy link
Contributor

@dbyron-sf dbyron-sf commented Apr 26, 2024

…use AuthenticatedRequest.getSpinnakerUser

when authenticating with the permission evaluator. It uses SecurityContextHolder.getContext() which may be null depending how the context is propagated across threads. This is the case in some scenarios during pipeline execution in orca (e.g. using #fetchReference in an Evaluate Variables stage).

@dbyron-sf dbyron-sf force-pushed the demonstrate-artifact-store-getter-auth-bug branch 2 times, most recently from 9069f58 to 30dfe7c Compare April 26, 2024 23:19
…use AuthenticatedRequest.getSpinnakerUser

when authenticating with the permission evaluator.  It uses
SecurityContextHolder.getContext() which may be null depending how the context is
propagated across threads. This is the case in some scenarios during pipeline execution in
orca (e.g. using #fetchReference in an Evaluate Variables stage).
@dbyron-sf dbyron-sf force-pushed the demonstrate-artifact-store-getter-auth-bug branch from 30dfe7c to 1c74ba7 Compare April 26, 2024 23:20
dbyron-sf added a commit to dbyron-sf/kork that referenced this pull request Apr 26, 2024
so S3ArtifactStoreGetter can call a username-based hasPermission method.
FiatPermissionEvaluator has this method, but using FiatPermissionEvaluator in kork would
create a circular dependency.

The plan is:

- publish a kork jar with UserPermissionEvaluator,
- consume it in fiat and change FiatPermissionEvaluator to implement UserPermissionEvaluator instead of PermissionEvaluator
- publish a fiat jar and consume it everywhere
- change S3ArtifactStoreGetter to use UserPermissionEvaluator to fix the bug that spinnaker#1178 generates
- publish yet another kork jar and consume it everywhere to fix use of fetchReference in Evaluate Variables stages
dbyron-sf added a commit to dbyron-sf/kork that referenced this pull request Apr 26, 2024
so S3ArtifactStoreGetter can call a username-based hasPermission method.
FiatPermissionEvaluator has this method, but using FiatPermissionEvaluator in kork would
create a circular dependency.

The plan is:

- publish a kork jar with UserPermissionEvaluator,
- consume it in fiat and change FiatPermissionEvaluator to implement UserPermissionEvaluator instead of PermissionEvaluator
- publish a fiat jar and consume it everywhere
- change S3ArtifactStoreGetter to use UserPermissionEvaluator to fix the bug that spinnaker#1178 demonstrates
- publish yet another kork jar and consume it everywhere to fix use of fetchReference in Evaluate Variables stages
@dbyron-sf dbyron-sf marked this pull request as ready for review April 26, 2024 23:59
@dbyron-sf dbyron-sf added the ready to merge Approved and ready for merge label Apr 27, 2024
@mergify mergify bot added the auto merged label Apr 27, 2024
@mergify mergify bot merged commit 9df959e into spinnaker:master Apr 27, 2024
5 checks passed
@dbyron-sf dbyron-sf deleted the demonstrate-artifact-store-getter-auth-bug branch April 27, 2024 00:05
mergify bot added a commit that referenced this pull request Apr 27, 2024
so S3ArtifactStoreGetter can call a username-based hasPermission method.
FiatPermissionEvaluator has this method, but using FiatPermissionEvaluator in kork would
create a circular dependency.

The plan is:

- publish a kork jar with UserPermissionEvaluator,
- consume it in fiat and change FiatPermissionEvaluator to implement UserPermissionEvaluator instead of PermissionEvaluator
- publish a fiat jar and consume it everywhere
- change S3ArtifactStoreGetter to use UserPermissionEvaluator to fix the bug that #1178 demonstrates
- publish yet another kork jar and consume it everywhere to fix use of fetchReference in Evaluate Variables stages

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
dbyron-sf added a commit to dbyron-sf/kork that referenced this pull request Apr 27, 2024
…rUser in S3ArtifactStoreGetter

instead of SecurityContextHolder.getContext() which might be null.  Previously
hasAuthorization would only user userId for logging.  Now it's used for authentication
too.  This fixes the bug that spinnaker#1178 demonstrates.
dbyron-sf added a commit that referenced this pull request Apr 28, 2024
…rUser in S3ArtifactStoreGetter (#1180)

* chore(build): give local gradle invocations more memory

The same amount that github actions uses, to avoid errors like:

Expiring Daemon because JVM heap space is exhausted
Expiring Daemon because JVM heap space is exhausted

FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon has been stopped: JVM garbage collector thrashing and after running out of JVM memory and after running out of JVM memory

* fix(artifacts): authenticate against AuthenticatedRequest.getSpinnakerUser in S3ArtifactStoreGetter

instead of SecurityContextHolder.getContext() which might be null.  Previously
hasAuthorization would only user userId for logging.  Now it's used for authentication
too.  This fixes the bug that #1178 demonstrates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants