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

Add note to GPG key response if user has no keys #18961

Merged
merged 6 commits into from
Mar 2, 2022

Conversation

KN4CK3R
Copy link
Member

@KN4CK3R KN4CK3R commented Mar 1, 2022

Prevents the invalid reponse if there are no keys:

-----BEGIN PGP PUBLIC KEY BLOCK-----


=twTO
-----END PGP PUBLIC KEY BLOCK-----

Additional questions:

  • Should ShowSSHKeys do the same?
  • Is this an "api" endpoint and the response should be just the plain 404 response code instead of the html page? If yes we need to add an addition route for /orgs/<org>.gpg to get the same behaviour there too.

Adds a note if user has no keys.

@KN4CK3R KN4CK3R mentioned this pull request Mar 1, 2022
@6543 6543 added this to the 1.17.0 milestone Mar 1, 2022
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 1, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 1, 2022
@Gusted
Copy link
Contributor

Gusted commented Mar 1, 2022

  • Should ShowSSHKeys do the same?

Yes.

Is this an "api" endpoint and the response should be just the plain 404 response code instead of the html page? If yes we need to add an addition route for /orgs/<org>.gpg to get the same behaviour there too.

So far I can see, it's only used in the web part.

@KN4CK3R
Copy link
Member Author

KN4CK3R commented Mar 1, 2022

So far I can see, it's only used in the web part.

Yes, but the response looks like something a tool uses as input which could be confused by html error page.

@Gusted
Copy link
Contributor

Gusted commented Mar 1, 2022

So far I can see, it's only used in the web part.

Yes, but the response looks like something a tool uses as input which could be confused by html error page.

Well, I hope that tools can detect a simple 404 statuscode 😅 .

routers/web/user/home.go Outdated Show resolved Hide resolved
@zeripath
Copy link
Contributor

zeripath commented Mar 1, 2022

This response should be:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Note: This user hasn't uploaded any GPG keys.


=twTO
-----END PGP PUBLIC KEY BLOCK-----

See: https://github.com/aymerick.gpg

@KN4CK3R KN4CK3R added type/enhancement An improvement of existing functionality and removed type/bug labels Mar 2, 2022
@Gusted
Copy link
Contributor

Gusted commented Mar 2, 2022

CI errors are related TestExportUserGPGKeys test needs to be adjusted.

@Gusted
Copy link
Contributor

Gusted commented Mar 2, 2022

Should this be backported?

@zeripath
Copy link
Contributor

zeripath commented Mar 2, 2022

This is very minor - a backport is reasonable but equally not sending one is also reasonable.

@KN4CK3R KN4CK3R changed the title Prevent invalid GPG key response Add note to GPG key response if user has no keys Mar 2, 2022
@techknowlogick techknowlogick merged commit f8898c3 into go-gitea:main Mar 2, 2022
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 3, 2022
* giteaofficial/main:
  Don't clean up hardcoded `tmp` (go-gitea#18983)
  git backend ignore replace objects (go-gitea#18979)
  Improve the deletion of issue (go-gitea#18945)
  Add note to GPG key response if user has no keys (go-gitea#18961)
  adds restore docs for docker based instances (go-gitea#18844)
  Refactor admin user filter query parameters (go-gitea#18965)
@KN4CK3R KN4CK3R deleted the fix-gpg branch March 3, 2022 08:44
a1012112796 added a commit to a1012112796/gitea that referenced this pull request Mar 3, 2022
* main:
  ignore missing comment for user notifications (go-gitea#18954)
  allow overwrite artifacts for github releases (go-gitea#18987)
  fix & refactor (go-gitea#18973)
  Don't clean up hardcoded `tmp` (go-gitea#18983)
  git backend ignore replace objects (go-gitea#18979)
  Improve the deletion of issue (go-gitea#18945)
  Add note to GPG key response if user has no keys (go-gitea#18961)
  adds restore docs for docker based instances (go-gitea#18844)
  Refactor admin user filter query parameters (go-gitea#18965)
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Prevent invalid key response.

* Display note instead of 404 response.

* Fixed test.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants