Skip to content

feat: list spaces for a connection whose API key is held in a parameter - #264

Merged
matt-richardson merged 33 commits into
mainfrom
mr/space-picker-parameter-key
Oct 15, 2026
Merged

matt-richardson merged 33 commits into
mainfrom
mr/space-picker-parameter-key

Conversation

@matt-richardson

Copy link
Copy Markdown
Contributor

Part of DPT-3630 (Renaming an Octopus space breaks TeamCity configurations that name it). Stacked on #263.

Why

A connection can take its API key from a %parameter% instead of storing it. Until now the picker told those connections to type the space name. It now resolves the reference the way a build would, and lists spaces when the parameter has a value outside a build.

How the reference is resolved

On a step form the reference is resolved against that step's build configuration, so a key defined on the build configuration is found. On the connection form, which has no build configuration, it is resolved against the project. A parameter that only gets a value when a build runs (for example, set by an earlier step) can't be resolved at edit time. The picker says so, quoting the reference, and typing the name still works.

Security

The build configuration is named by the request, and its parameters can hold the API key. So it is used only when the caller also holds EDIT_PROJECT on its project, not just on the project whose form they're editing. A missing build configuration and one the caller can't edit get the same message, so the endpoint can't be used to find out which build configurations exist. Both cases have tests.

Notes

OIDC connections still get a message to type the name; that follows in the next PR. OctopusSpacePickerUiTest (now 6 cases, including a password parameter and one that only resolves during a build) passes locally against the real containers.

🤖 Generated with Claude Code

matt-richardson and others added 4 commits October 14, 2026 10:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…API key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chosen id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
matt-richardson and others added 19 commits October 14, 2026 11:38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ackage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	octopus-server/src/main/java/octopus/teamcity/server/connection/OctopusConnectionUiData.java
#	octopus-server/src/main/resources/buildServerResources/spacePicker.jsp
…ection from TeamCity

Switching a step's connection clears the stored space id, since an id only
identifies a space on one Octopus server. The connection form now gets the
connection being edited from TeamCity's oauthConnectionBean instead of trying
request parameter names. The picker's loader copes with missing markup and a
script that fails to load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from mr/space-picker-ui to main October 15, 2026 04:14
matt-richardson and others added 4 commits October 15, 2026 15:14
…e-picker-parameter-key

# Conflicts:
#	e2e/src/test/java/octopus/teamcity/e2e/test/OctopusSpacePickerUiTest.java
#	octopus-server/src/main/java/octopus/teamcity/server/spaces/OctopusSpacesController.java
#	octopus-server/src/main/resources/buildServerResources/spacePicker.jsp
…eter-key

# Conflicts:
#	e2e/src/test/java/octopus/teamcity/e2e/test/OctopusSpacePickerUiTest.java
#	octopus-server/src/main/java/octopus/teamcity/server/connection/OctopusConnectionUiData.java
#	octopus-server/src/main/resources/buildServerResources/js/spacePicker.js
#	octopus-server/src/main/resources/buildServerResources/spacePicker.jsp
…there

Resolving the parameter sends its value, which can be a password the user
cannot read, to the connection's URL. Requiring RUN_BUILD keeps the picker
within what a build step could already do, and each lookup is logged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…project

A build finds its connection from its own project, so a build configuration
from any other project would pair a URL and key no build would use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
matt-richardson and others added 3 commits October 15, 2026 16:09
…nding whitespace

Validation and the space picker both trim the reference, so builds now use the
same value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@APErebus APErebus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Couple of minor nits, but looks good

@matt-richardson
matt-richardson merged commit a8a2390 into main Oct 15, 2026
6 checks passed
@matt-richardson
matt-richardson deleted the mr/space-picker-parameter-key branch October 15, 2026 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants