r/GithubCopilot • • 24d ago

General Credentials in Context

Should I be concerned that Github Copilot will add any credentials to the context and send it to the model? Are there any other areas when using GHCP where I should be concerned about credential exposure?

If so, what are best practices for securing credentials when using Github copilot in VScode?

5 Upvotes

2 comments sorted by

1

u/Lonsarg 24d ago

Copilot sandbox mode so agent does not have acces to credentials manager.

And then designing development flow so agent needs no credentials, developer should run manually outside sandbox when credentials are needed (and precache data for unit tests while having credentials so agent can run code against cached data in sandbox).

I work like this already for 2 weeks and it is very nice. Secure and also fast (l, since agent needing credentials only slows prompts a lot, cache makes it very fast for agent to iterate code changes.

1

u/Acrobatic-Survey-820 23d ago

Don't enable the Agent mode if you care. The LSP architecture for standard completions runs sensitive filtering and strips .env files before hitting the model. But CLI and Agent modes give Copilot filesystem access to read, modify, and execute files in your directory. If your credentials are hardcoded or stored in plain text files within that workspace, the agent can ingest them into its context window and potentially leak them via generated code or logs. Keep your secrets out of the repo entirely and use a separate secure store that requires manual user interaction to fetch, so the AI never sees the actual string values during automation.