Repository navigation
Fix the Gitea workspace service and limit Key Vault roles #5284
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
Merged
Jay W (JayDoubleu)
merged 23 commits into
microsoft:main
from
JayDoubleu:fix/gitea-workspace-service
Oct 30, 2026
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
48e6981
Add a private Gitea lifecycle check (#5141)
JayDoubleu eabf485
Create the Gitea file share through Resource Manager (#5141)
JayDoubleu 7e953b1
Keep the Gitea workspace repositories on the file share
JayDoubleu 960f8bb
Wrap a long CHANGELOG entry
JayDoubleu f1f342d
Stop writing Gitea secrets to the console log
JayDoubleu 6345ac5
Make sure that the Gitea console log shows no secret
JayDoubleu 361b9b8
Wrap a long CHANGELOG entry
JayDoubleu 5c5fd11
Give the Gitea identity a role on its own secrets only
JayDoubleu 7f310dc
Give the shared Gitea identity a role on its own secrets only
JayDoubleu efe6e9d
Give the Nexus identity a role on its own secrets only
JayDoubleu d1c5822
Use one workspace owner token in the Gitea test (#5141)
JayDoubleu 9cd14a9
Use one version bump for each Gitea and Nexus bundle
JayDoubleu d6e0cf2
Hide the shared Gitea admin password and reload changed OIDC settings
JayDoubleu f4dd202
Stop and start the Gitea app in the test and read all its references
JayDoubleu eaa5571
Make the Gitea workspace service 2.0.0, because its upgrade needs steps
JayDoubleu 3e29891
Wait for the Gitea log lines of the start after the stop
JayDoubleu 8329404
Remove the leaked service principal password in the Gitea steps
JayDoubleu 95a2efa
Test the Gitea stop when the OIDC settings change
JayDoubleu 7853874
Rotate a registered workspace secret through the Key Vault
JayDoubleu 72ea496
Link the new Gitea CHANGELOG entries to their issue
JayDoubleu dabfe28
Make the shared Gitea admin script executable
JayDoubleu c31938d
Explain the bundle test deadlines in the workflow
JayDoubleu 30f9562
Tell operators how to replace the migration token after a password ch…
JayDoubleu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| """Make sure that the shared service identities read only their own Key Vault secrets.""" | ||
|
|
||
| from pathlib import Path | ||
| import re | ||
| import unittest | ||
|
|
||
|
|
||
| ROOT = Path(__file__).resolve().parents[2] | ||
| # Each of these identities reads a fixed list of secrets from the core Key Vault. | ||
| FILES = ( | ||
| ROOT / "templates/shared_services/gitea/terraform/gitea-webapp.tf", | ||
| ROOT / "templates/shared_services/sonatype-nexus-vm/terraform/vm.tf", | ||
| ) | ||
| ASSIGNMENT = re.compile(r'^resource "azurerm_role_assignment" "(\w+)" \{(\n.*?)^\}', re.MULTILINE | re.DOTALL) | ||
| VAULT_SCOPE = re.compile(r"\n scope\s*=\s*data\.azurerm_key_vault\.\w+\.id\n") | ||
|
|
||
|
|
||
| class KeyVaultScopeTests(unittest.TestCase): | ||
| def test_secret_roles_are_not_on_the_whole_vault(self): | ||
| for path in FILES: | ||
| roles = [ | ||
| (name, body) | ||
| for name, body in ASSIGNMENT.findall(path.read_text()) | ||
| if '"Key Vault Secrets User"' in body | ||
| ] | ||
| with self.subTest(path=str(path.relative_to(ROOT))): | ||
| self.assertTrue(roles) | ||
| for name, body in roles: | ||
| with self.subTest(path=str(path.relative_to(ROOT)), role=name): | ||
| self.assertNotRegex(body, VAULT_SCOPE) | ||
| self.assertIn("for_each = {", body) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.