Sub topic 13
Privacy, Data Handling and Licensing Considerations
This chapter assumes you know how a completion request is built from the prefix, suffix and related files. It also assumes you have used a completion extension in VS Code or a JetBrains IDE. It covers what leaves your machine, what the provider may do with it, and what comes back that you may not be free to use.
Why completion tools raise their own privacy questions
A completion tool sends code to a model on nearly every pause in typing. A chat assistant sends text only when you ask it to. The request is also built automatically, so you do not choose what goes into it. It can include:
- The text before and after the cursor, often several thousand tokens.
- Snippets from other open tabs or from files found by a retrieval step.
- Recent edit history, which next edit suggestions use to predict the next change.
- Metadata such as file path, language, and the editor and extension version.
Anything in those inputs can reach a remote server. That includes secrets pasted into a scratch file, customer data in a test fixture, and proprietary algorithms. Two further risks go the other way. The model may emit code that resembles licensed training data. The provider may also keep your request and use it to improve the product.
What gets sent, and where it goes
There are three deployment shapes. Each answers the privacy question differently.
| Deployment | Where inference runs | Main privacy property | Main cost |
|---|---|---|---|
| Hosted service | Provider cloud | Code leaves your machine on every request | Depends on provider terms |
| Private or self-hosted endpoint | Your cloud account or data center | Data stays inside your boundary | You operate and scale the model |
| Local model | Your laptop | Nothing leaves the machine | Smaller model, weaker suggestions, slower on weak hardware |
For hosted services, read four things in the terms or the admin documentation:
- Retention. Is the prompt stored after the response is returned, and for how long?
- Training use. Can your prompts, and the suggestions you accepted, be used to train future models? Business and enterprise plans often differ from free or individual plans here.
- Telemetry. Acceptance events, latency and error reports are usually collected even when prompts are not. Check whether telemetry includes code snippets.
- Location. Which region processes the request, if you have data residency rules.
Do not assume the answers from the product name. The same editor extension can behave differently under an individual plan and an organization plan.
Controls you can apply on the client
Most extensions give you some of these controls. The names differ by product, so look for the equivalent in yours.
- Per-language or per-file enablement. You can turn completions off for plaintext, Markdown, or configuration formats, where secrets tend to live.
- Exclusion patterns. Some tools let you list paths, such as
.envorsecrets/, that are never sent as context. Organization administrators can often enforce these lists centrally. - Context sources. You can turn off related-file or workspace retrieval. This shrinks what each request carries, at some cost in relevance.
- Telemetry and data-sharing toggles. Some are user-level, and others are locked by the organization.
- Public-code matching. Some products can block suggestions that match public repositories.
A client-side filter is the most direct control because it runs before anything leaves the machine. The sketch below shows the idea. It drops excluded files from the context and redacts obvious secrets in what remains.
import fnmatch
import os
import re
EXCLUDED_PATTERNS = [".env", ".env.*", "*.pem", "*.key", "secrets/*"]
AWS_KEY = re.compile(r"AKIA[0-9A-Z]{16}")
ASSIGNMENT = re.compile(
r"(?i)\b(api[_-]?key|token|password|secret)\s*=\s*[\"'][^\"']+[\"']"
)
def is_excluded(path: str) -> bool:
name = os.path.basename(path)
return any(
fnmatch.fnmatch(path, pattern) or fnmatch.fnmatch(name, pattern)
for pattern in EXCLUDED_PATTERNS
)
def redact(text: str) -> str:
text = AWS_KEY.sub("<redacted-key>", text)
return ASSIGNMENT.sub(lambda m: f'{m.group(1)} = "<redacted>"', text)
def build_context(files: dict[str, str]) -> dict[str, str]:
return {
path: redact(content)
for path, content in files.items()
if not is_excluded(path)
}
files = {
"app/main.py": 'api_key = "abc123"\nprint("hi")\n',
"config/.env": "TOKEN=zzz\n",
"app/aws.py": "KEY = 'AKIAIOSFODNN7EXAMPLE'\n",
}
for path, content in build_context(files).items():
print(path, "->", repr(content))Running it prints two entries and omits config/.env entirely. In app/main.py the value becomes "<redacted>". In app/aws.py the key becomes <redacted-key>.
Edit history needs the same care
Next edit suggestions add a context source that plain completions lack: your recent edits. A diff of what you just changed can contain a password you typed and then deleted, or a customer record you pasted in and removed. The exclusion and redaction rules should apply to edit history as well as to file contents. When you evaluate a tool, check whether deleted text can still appear in the history it sends.
Licensing and code provenance
Models trained on public code can reproduce fragments of it. Most completions are short and generic, so the risk is low per suggestion. The cases that matter are long, distinctive blocks, such as a full algorithm implementation with unusual variable names or a header comment from another project.
The risk has three parts:
- License obligations. Code under licenses such as the GPL or Apache 2.0 can carry conditions on redistribution or attribution. Pasting it into a project that ignores those conditions can create a compliance problem.
- Unclear authorship. Laws on copyright in machine-assisted output differ by country and are still changing. Your organization's counsel, not the extension, decides what is acceptable.
- Provider indemnity. Some commercial plans offer legal protection for suggestions, usually only when certain filters are on. Read the conditions before relying on this.
Practical habits:
- Turn on the public-code match filter if your tool has one, and know that it detects only matches the provider can find. It is not proof that code is original.
- Treat a long suggestion that looks like a known library function with suspicion. Search for it, or use the provider's reference or citation feature if one exists.
- Keep license scanning in your CI pipeline. A dependency or snippet scanner catches problems regardless of how the code was written.
- Never accept a suggestion that contains a copyright header, author name or license text you did not write.
Data you generate by using the tool
Your behavior is also data. Accepting, rejecting and partially accepting a suggestion are logged by many tools and used to measure acceptance rate and retention, which the previous chapter on measurement covered. That telemetry has two privacy implications:
- Event streams can reveal which files you work on and when, even without code content.
- On individual plans, accepted suggestions may be used to improve the model, which means your code could shape future outputs.
For a team, the questions are whether telemetry is aggregated or per developer, and whether it can be used in performance reviews. Decide that policy before you turn dashboards on, not after.
A decision checklist for adopting a completion tool
Work through these in order. Stop at the first one you cannot answer.
- What data classes exist in the repositories involved: public, internal, regulated or customer data?
- Which deployment shape matches the most sensitive class? Regulated data often rules out a hosted service.
- What are the retention and training terms for the plan you will actually use?
- Which exclusions, context toggles and telemetry settings can be enforced centrally instead of left to each developer?
- Is a public-code filter available, and is it enabled by policy?
- Does the tool apply the same controls to edit history and related-file context?
- Who reviews license findings, and how are they handled in CI?
Common mistakes
- Assuming "the code is private" means "the prompt is private". The repository setting does not change what the extension sends.
- Excluding
.envbut not.env.local, or excluding one folder while an open tab from it still feeds the context. - Enabling completions in every file type, including Markdown notes and SQL dumps with real data.
- Treating a public-code filter as a license review.
- Leaving personal accounts signed in on a work machine, so that work code follows the personal plan's terms.
Exercise
Your team handles customer records and stores test fixtures with real values in fixtures/. You are rolling out a hosted completion tool. Name three controls you would put in place before rollout, and say which one protects against a secret that was typed and then deleted.
Show answer
Three controls: (1) an exclusion pattern such as fixtures/* enforced centrally by an administrator, so those files are never sent as context; (2) an organization plan whose terms state no retention and no training on prompts, checked in writing; (3) client-side redaction and exclusion applied to edit history, plus telemetry set to exclude code snippets. The third control addresses a secret that was typed and then deleted, because next edit suggestions send recent edits, and deleted text can still appear in that history unless it is filtered.
Exercise
A tool suggests a 40-line function with an unusual name and a comment naming another project. List two actions you should take before accepting it.
Show answer
Do not accept it as is. First search for the function or comment text to find the source and its license. Second, either reject it and write your own version, or keep it only if the license allows your use and you add the required attribution. A public-code filter being on does not replace this check.