Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/api/v2/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ import { OpenApiRequestExt } from 'src/otomi-models'

const debug = Debug('otomi:api:v2:git')

/**
* GET /v2/git
* Returns the configured external Git settings.
*/
export const getGitSettings = async (req: OpenApiRequestExt, res: Response): Promise<void> => {
debug('getGitSettings')

const gitSettings = await req.otomi.getGitSettings()

res.json(gitSettings)
}
Comment on lines +12 to +18

/**
* PUT /v2/git
* Migrate the values repository to a new git remote.
Expand Down
25 changes: 25 additions & 0 deletions src/openapi/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2032,6 +2032,31 @@ paths:
description: Successfully edited app values.

/v2/git:
get:
operationId: getGitSettings
x-eov-operation-handler: v2/git
summary: Get Git settings
description: Get the current Git configuration.
x-aclSchema: AplGit
responses:
'200':
description: Current Git settings
content:
application/json:
schema:
$ref: '#/components/schemas/AplGit'
Comment on lines +2044 to +2047
'401':
description: Unauthorized
'403':
$ref: '#/components/responses/Forbidden'
'500':
description: Internal Server Error
'503':
description: Service Unavailable (API locked or not ready)
content:
application/json:
schema:
$ref: '#/components/schemas/OtomiStackError'
put:
operationId: migrateGit
x-eov-operation-handler: v2/git
Expand Down
6 changes: 4 additions & 2 deletions src/openapi/git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ AplGit:
x-acl:
platformAdmin:
- update-any
teamAdmin: []
teamMember: []
teamAdmin:

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.

why allowing teams to read this data?

- read-any
teamMember:
- read-any
type: object
additionalProperties: false
properties:
Expand Down
10 changes: 10 additions & 0 deletions src/openapi/settingsinfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ SettingsInfo:
branch:
type: string
description: The branch to use in the Git repository.
username:
type: string
description: The username used to authenticate with the Git repository.
password:
type: string
description: The password or personal access token used to authenticate with the Git repository.
email:
type: string
description: The email address used for Git commit author information.
format: email
Comment on lines +65 to +71
ingressClassNames:
description: Ingress class names that are used by the cluster.
items:
Expand Down
22 changes: 22 additions & 0 deletions src/otomi-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@ export default class OtomiStack {
'aiEnabled',
'git.repoUrl',
'git.branch',
'git.username',
'git.password',
'git.email',
Comment on lines 373 to +377

@merll merll Jun 18, 2026

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.

I certainly think so, too. The password should never be there to read. Even if it may be encrypted there is no reason to send it back to the client at all.

])
if (otomiInfo.git?.repoUrl?.includes('gitea-http.gitea.svc.cluster.local')) {
otomiInfo.git.repoUrl = `https://gitea.${settings.cluster?.domainSuffix}/otomi/values`
Expand Down Expand Up @@ -660,6 +663,25 @@ export default class OtomiStack {
await this.commitAndPushMigration({ ...params, filePath, aplObject, sealedSecretRecord })
}

async getGitSettings(): Promise<{
repoUrl?: string
branch?: string
username?: string
password?: string
email?: string
}> {
const settingsInfo = await this.getSettingsInfo()
const git = settingsInfo.otomi?.git

return {
repoUrl: git?.repoUrl,
branch: git?.branch,
username: git?.username,
password: git?.password,
email: git?.email,
}
}
Comment on lines +666 to +683

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.

I agree with that. Sending back passwords, even in encrypted form, suggests that secrets are exposed. Console can just insert placeholders.


private async persistOtomiSettings(
updatedOtomi: Record<string, any>,
): Promise<{ filePath: string; aplObject: AplObject }> {
Expand Down
Loading