Skip to content

feat: add principals flag to cli for ssh dynamic secrets#238

Open
saifsmailbox98 wants to merge 1 commit into
mainfrom
saif/secrets-296-add-principals-flag-to-cli-for-ssh-dynamic-secrets
Open

feat: add principals flag to cli for ssh dynamic secrets#238
saifsmailbox98 wants to merge 1 commit into
mainfrom
saif/secrets-296-add-principals-flag-to-cli-for-ssh-dynamic-secrets

Conversation

@saifsmailbox98
Copy link
Copy Markdown
Contributor

Description 📣

Adds a --principals flag to infisical dynamic-secrets lease create so users can specify which principals to include in SSH dynamic secret leases. Also adds principals support to the agent dynamicSecret template function as an optional 6th argument.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

@linear
Copy link
Copy Markdown

linear Bot commented May 18, 2026

SECRETS-296

@infisical-review-police
Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-238-feat-add-principals-flag-to-cli-for-ssh-dynamic-secrets

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

Comment thread packages/cmd/agent.go
Comment thread packages/cmd/agent.go
@saifsmailbox98 saifsmailbox98 requested a review from adilsitos May 19, 2026 00:26
Comment thread packages/cmd/agent.go
Comment on lines 511 to 512
if match {
log.Debug().Msgf("[cache]: found matching active lease: [project=%s], [env=%s], [path=%s], [slug=%s]",
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.

don't we also need to add the principals here? isn't it good for debug?

Comment thread packages/cmd/agent.go
dynamicSecretManager.RegisterTemplateUnsafe(projectSlug, envSlug, secretPath, slug, templateId, ttl, principals)

etagData := fmt.Sprintf("%s-%s-%s-%s-%s", projectSlug, envSlug, secretPath, slug, ttl)
etagData := fmt.Sprintf("%s-%s-%s-%s-%s-%s", projectSlug, envSlug, secretPath, slug, ttl, principals)
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 think for the cache we won't have a problem if the principals are different, but can't this be a problem on the etag as well? if they change the order of the principals, this would cause a difference an we would write on disk the change (which in case wouldn't really be a change, since only the order was changed)

Not sure if this is a problem, I just wanted to raise this so we can discuss.

Comment thread packages/cmd/agent.go
Comment on lines +991 to +1002
if principals != "" {
var parsedPrincipals []string
for _, p := range strings.Split(principals, ",") {
trimmed := strings.TrimSpace(p)
if trimmed != "" {
parsedPrincipals = append(parsedPrincipals, trimmed)
}
}
if len(parsedPrincipals) > 0 {
leaseConfig["principals"] = parsedPrincipals
}
}
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.

maybe this could be a helper? if we have something similar in another command we might also need something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants