Skip to content

Agent template listSecrets/secret omits id/comment metadata #103

@YewFence

Description

@YewFence

Background

This issue is specific to the infisical agent command and its template rendering pipeline.
Docs also state that the secret template function returns a single secret object with keys: Key, WorkspaceId, Value, SecretPath, Type, ID, and Comment.(https://infisical.com/docs/integrations/platforms/infisical-agent#secret).
In agent templates, listSecrets/secret is used to render secrets into files. Some templates need id/comment for debugging and traceability.

Actual behavior

listSecrets/secret returns secrets without id/comment (and sometimes secretPath for imports), even though the raw secrets API includes them.

Expected behavior

listSecrets should include id/comment/secretPath in the returned objects to match API payload and enable template access.

Repro steps

  1. Create a secret with a comment.
  2. Use an agent template with {{ range (secret "<PROJECT_ID>" "" "/") }}{{ .ID }}{{ .Comment }}{{ end }}
  3. Run agent and check output file.
  4. ID/Comment are empty.

Impact

Templates that rely on metadata cannot work without switching to per-secret calls.

Possible fix

Map id/comment/secretPath when converting raw secrets to SingleEnvironmentVariable in the CLI.
I plan to submit a PR to address this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions