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 server config to disable user registered agents #4206

Merged

Conversation

6543
Copy link
Member

@6543 6543 commented Oct 7, 2024

As user-/org-agents allow normal (non instance admins) to extract secrets if they know how from the repos they are admin at, this is an hardening option.

normally you already trust users who are admin but in edge cases you want to forbid them to register own agents ...

@6543 6543 added enhancement improve existing features security labels Oct 7, 2024
@6543 6543 requested a review from anbraten October 7, 2024 10:31
@6543 6543 mentioned this pull request Oct 7, 2024
4 tasks
@woodpecker-bot
Copy link
Contributor

woodpecker-bot commented Oct 7, 2024

Deployment of preview was torn down

@qwerty287
Copy link
Contributor

qwerty287 commented Oct 7, 2024

Why do we need separate fields in web-config.js? And the option is missing in https://woodpecker-ci.org/docs/administration/server-config#all-server-configuration-options

@6543
Copy link
Member Author

6543 commented Oct 7, 2024

It looked nicer but the only real answer is that i did not come up witj a combined name for the var

@qwerty287
Copy link
Contributor

What about userRegisteredAgents?

@6543 6543 requested a review from qwerty287 October 7, 2024 15:49
@6543
Copy link
Member Author

6543 commented Oct 7, 2024

fixed the fail and added test for it!

@qwerty287
Copy link
Contributor

OK. If you think old ones still should be usable I need to dive more into the code of org/user agents first.

Copy link

codecov bot commented Oct 7, 2024

Codecov Report

Attention: Patch coverage is 30.76923% with 9 lines in your changes missing coverage. Please review.

Project coverage is 26.73%. Comparing base (2543105) to head (8e48926).

Files with missing lines Patch % Lines
server/web/config.go 0.00% 7 Missing ⚠️
cmd/server/setup.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4206      +/-   ##
==========================================
+ Coverage   26.46%   26.73%   +0.27%     
==========================================
  Files         376      376              
  Lines       27455    27463       +8     
==========================================
+ Hits         7265     7342      +77     
+ Misses      19525    19440      -85     
- Partials      665      681      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qwerty287
Copy link
Contributor

OK, I checked it out.

If I understand it correctly, if this feature is disabled now and all agents are still manageable from the admin interface, the admin interface will use the api routes for global agents. So we should just disable the org-specific routes I think.

Otherwise the PR seems fine to me.

@6543
Copy link
Member Author

6543 commented Oct 7, 2024

well this would allow instance admins to still create org agents ... but not normal users

there is no much downside in doing so ... this is the same argument i wana have repo agents.

It is easier in therms of UX for the user and do not add much code on our side to maintain

@qwerty287
Copy link
Contributor

It is easier in therms of UX for the user

I don't get that. The ui for this is completely hidden, so the only way how you can create a new org agent is directly using the api.

@anbraten
Copy link
Member

anbraten commented Oct 8, 2024

well this would allow instance admins to still create org agents ... but not normal users

Would probably help to ask: What would be the argument for an instance admin to disable user agents in general.

@6543
Copy link
Member Author

6543 commented Oct 8, 2024

I wrote that argument also into the docs

@qwerty287
Copy link
Contributor

I still think the org agent routes should be disabled completely if the feature is disabled. Or you extend the admin UI to allow to create user agents from there.

@6543 6543 added this to the 3.0.0 milestone Nov 7, 2024
@6543
Copy link
Member Author

6543 commented Nov 9, 2024

now the flack disable the function & ui alltogether

@6543 6543 requested a review from qwerty287 November 10, 2024 20:30
Copy link
Contributor

@qwerty287 qwerty287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code lgtm, untested

@6543 6543 enabled auto-merge (squash) November 11, 2024 16:24
@6543 6543 merged commit 04e8309 into woodpecker-ci:main Nov 11, 2024
6 of 7 checks passed
@6543 6543 deleted the allow-admin-to-decide-of-useragents branch November 11, 2024 18:13
@woodpecker-bot woodpecker-bot mentioned this pull request Nov 11, 2024
1 task
@woodpecker-bot woodpecker-bot mentioned this pull request Dec 14, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improve existing features security
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants