Allow gitea_status_proxy to properly proxy statuses #88

Manually merged
adamm merged 5 commits from szarate/gitea_status_proxy AGit into main 2025-11-03 17:50:22 +01:00
Contributor

In its current state, the gitea_status_proxy is not able to forward requests it gets from authorized users, this PR fixes that by changing the Authorization and Content Headers to what gitea expects.

I'm also adding a quick readme file, with an usage example.

A result of setting the statuses can be seen at szarate/test-actions-gitea#1

In its current state, the `gitea_status_proxy` is not able to forward requests it gets from authorized users, this PR fixes that by changing the `Authorization` and `Content` Headers to what gitea expects. I'm also adding a quick readme file, with an usage example. A result of setting the statuses can be seen at https://src.opensuse.org/szarate/test-actions-gitea/pulls/1
szarate added 4 commits 2025-10-30 13:09:25 +01:00
szarate added 2 commits 2025-10-30 13:35:32 +01:00
adamm requested changes 2025-10-30 22:55:27 +01:00
adamm left a comment
Owner

Just some nit-picks, otherwise looks good, thanks!

Just some nit-picks, otherwise looks good, thanks!
@@ -19,3 +17,1 @@
State string `json:"state"`
TargetUrl string `json:"target_url"`
}
// type Status struct {
Owner

I think we can remove this commented out stuct.

I think we can remove this commented out stuct.
szarate marked this conversation as resolved
@@ -83,6 +89,7 @@ func StatusProxy(w http.ResponseWriter, r *http.Request) {
token := token_arr[1]
if !slices.Contains(config.Keys, token) {
common.LogError("Provided token is not known")
Owner

These pre-auth errors should probably use Debug() logging level instead of Error(). If someone spams this endpoint with garbage, it could generate a lot of useless logs here.

These pre-auth errors should probably use Debug() logging level instead of Error(). If someone spams this endpoint with garbage, it could generate a lot of useless logs here.
szarate marked this conversation as resolved
@@ -114,0 +117,4 @@
// Context: statusinput.Context,
// State: statusinput.State,
// TargetUrl: statusinput.TargetUrl,
// }
Owner

this comment too can be removed

this comment too can be removed
szarate marked this conversation as resolved
@@ -0,0 +11,4 @@
```
{
"forge_url": "https://src.opensuse.org/api/v1",
"keys": ["some-application-key"]
Owner

We should add that keys should be random and generated like

openssl rand -base64 48

And the build section can probably be removed, as it's just go build

We should add that keys should be random and generated like `openssl rand -base64 48` And the build section can probably be removed, as it's just `go build`
Author
Contributor

Updated the readme to reflect that

Updated the readme to reflect that
adamm marked this conversation as resolved
szarate added 2 commits 2025-10-31 10:34:38 +01:00
szarate requested review from adamm 2025-10-31 10:37:43 +01:00
Author
Contributor

All comments have been addressed

All comments have been addressed
adamm manually merged commit 918723d57b into main 2025-11-03 17:50:22 +01:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: git-workflow/autogits#88