Use artifacts v4 jwt if available #471

Merged
ChristopherHX merged 2 commits from jwt-runtime-token into main 2024-02-08 02:43:40 +00:00
ChristopherHX commented 2024-01-21 20:25:11 +00:00 (Migrated from gitea.com)

Needs https://github.com/go-gitea/gitea/pull/28885 to provide jwt if sent by server

Could fix #459, but that has not been verified.

Needs https://github.com/go-gitea/gitea/pull/28885 to provide jwt if sent by server Could fix #459, but that has not been verified.
ChristopherHX commented 2024-01-21 20:40:02 +00:00 (Migrated from gitea.com)

Need to look into masking the new secret Should be masked now in this PR.

~~Need to look into masking the new secret~~ Should be masked now in this PR.
delvh (Migrated from gitea.com) approved these changes 2024-01-29 00:07:10 +00:00
delvh (Migrated from gitea.com) left a comment

Which of the PRs must be merged first?
Or is the order irrelevant?

Which of the PRs must be merged first? Or is the order irrelevant?
delvh commented 2024-01-29 00:12:23 +00:00 (Migrated from gitea.com)

How are runners on old instances handled?
To me as a relative outsider, it looks like the map would return null in this case, thus letting the runner panic as null has no GetStringValue().

How are runners on old instances handled? To me as a relative outsider, it looks like the map would return `null` in this case, thus letting the runner panic as `null` has no `GetStringValue()`.
ChristopherHX commented 2024-01-29 07:27:33 +00:00 (Migrated from gitea.com)

Yes the order is irrelevant.

How are runners on old instances handled?

Old Gitea Instances are handled by using the old token for artifacts v3

Old runners are handled like this
act_runner just drops the jwt field if it is older.
Also the old token will continue to work with artifacts v3

To me as a relative outsider, it looks like the map would return null in this case

Yes this is true

thus letting the runner panic as null has no GetStringValue().

No panic, just an empty string

The last time I looked into this GetStringValue isn't virtual (interface method are virtual) and don't do any lookup based on the this object.

GetStringValue call GetKind and handles the conversion error

3068604084/types/known/structpb/struct.pb.go (L495)

GetKind handles the nil case

3068604084/types/known/structpb/struct.pb.go (L474)

BTW in go is a typed nil of a struct not the same as a nil of type interface{} / other interfaces

Yes the order is irrelevant. > How are runners on old instances handled? Old Gitea Instances are handled by using the old token for artifacts v3 Old runners are handled like this act_runner just drops the jwt field if it is older. Also the old token will continue to work with artifacts v3 > To me as a relative outsider, it looks like the map would return null in this case Yes this is true > thus letting the runner panic as null has no GetStringValue(). No panic, just an empty string The last time I looked into this `GetStringValue` isn't virtual (interface method are virtual) and don't do any lookup based on the this object. GetStringValue call GetKind and handles the conversion error https://github.com/protocolbuffers/protobuf-go/blob/3068604084670a0d5cc410b3489db359c30afd33/types/known/structpb/struct.pb.go#L495 GetKind handles the nil case https://github.com/protocolbuffers/protobuf-go/blob/3068604084670a0d5cc410b3489db359c30afd33/types/known/structpb/struct.pb.go#L474 BTW in go is a typed nil of a struct not the same as a nil of type interface{} / other interfaces
lunny (Migrated from gitea.com) approved these changes 2024-02-05 10:48:05 +00:00
Sign in to join this conversation.
No description provided.