Skip to content

Use CF_USERNAME/CF_PASSWORD env vars via .env file instead of positional args#7

Open
mheadd wants to merge 1 commit intomainfrom
issue-6-env-var-auth
Open

Use CF_USERNAME/CF_PASSWORD env vars via .env file instead of positional args#7
mheadd wants to merge 1 commit intomainfrom
issue-6-env-var-auth

Conversation

@mheadd
Copy link
Collaborator

@mheadd mheadd commented Feb 24, 2026

Summary

Addresses #6 — replaces cf auth <USERNAME> <PASSWORD> with the .env file pattern.

Changes

  • .github/copilot-instructions.md: Updated the Authentication section to show credentials stored in a .env file and loaded via source .env before running cf auth. Added a security note callout explaining why positional args should be avoided.

  • .github/instructions/cicd.instructions.md: Updated the CircleCI example to use cf api + cf auth + cf target (which reads CF_USERNAME/CF_PASSWORD from the environment) instead of passing credentials as -u/-p flags to cf login.

Rationale

  • Avoids credentials in shell history and process listings
  • Aligns with 12-factor principles (configuration via environment variables)
  • Uses the .env file approach per @mogul's feedback — agents can create files natively, and source .env doesn't leak values in shell history
  • Standard CF CLI pattern (cf auth natively reads these env vars)

@mogul — want to take a look at these changes?

…nal args

Replace 'cf auth <USERNAME> <PASSWORD>' with the .env file pattern:
store CF_USERNAME and CF_PASSWORD in a .env file, then 'source .env'
before running 'cf auth'. This avoids credentials appearing in shell
history or process listings.

Also update the CircleCI example in cicd.instructions.md to use
'cf auth' (which reads CF_USERNAME/CF_PASSWORD from the environment)
instead of passing credentials as flags to 'cf login'.

Add a security note callout explaining the rationale.

Incorporates feedback from @mogul on using a .env file rather than
export statements.

Closes #6
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.

1 participant