Sub topic 13
Privacy, Data Handling and Licensing Considerations
This chapter assumes you know how a completion request is assembled from the prefix, the suffix and related files. It also assumes you can read short Python. The earlier chapter on context assembly is the starting point, because everything that goes into a request is also data that can leave your machine.
What leaves your machine
An inline completion request is not just the line you are typing. It usually contains:
- The text before the cursor (prefix) and after it (suffix), often thousands of tokens.
- Snippets from other open or related files.
- For next edit suggestions, your recent edit history.
- Metadata such as the file path, language and editor version.
The request goes to a model server, either a vendor's cloud or a model you host. Anything in the context window can be sent, including API keys in a .env file you have open, customer data in a fixture, or a comment containing a password.
Data handling questions to ask
Check these items in your vendor's documentation or your own deployment before enabling a tool for a team:
| Question | Why it matters |
|---|---|
| Is the prompt stored, and for how long? | Stored prompts can include secrets and proprietary code. |
| Is your code used to train models? | Business plans often opt out by default. Individual plans may not. |
| Where is the data processed? | Regional rules may restrict where source code or personal data can go. |
| Are telemetry and code snippets collected separately? | Acceptance metrics are less sensitive than the code itself. |
Controlling what gets sent
Most tools let you disable completions for specific languages, file patterns or whole repositories. Use these controls for secrets files, generated data and regulated code. You can also add your own filter before a request is built. The sketch below drops files that match sensitive patterns from the related-context list.
from fnmatch import fnmatch
BLOCKED = [".env", "*.pem", "*.key", "secrets/*", "*credentials*"]
def is_allowed(path: str) -> bool:
return not any(fnmatch(path, pattern) for pattern in BLOCKED)
def filter_context(paths: list[str]) -> list[str]:
return [p for p in paths if is_allowed(p)]
print(filter_context(["app.py", ".env", "secrets/db.json", "deploy/server.pem"]))
# ['app.py']Note that the filter matches on the path only. A password pasted into app.py still passes through.
Licensing
A model trained on public code can reproduce a passage it saw many times. This is rare for short completions and more likely for long, distinctive blocks such as a well-known algorithm with its original comments. The risks are:
- The suggestion matches code under a license with obligations, such as attribution or copyleft terms.
- You cannot tell from the ghost text where it came from.
Some tools offer a duplicate-detection filter that compares a suggestion with known public code and blocks close matches. Others show the matching source and its license. Turning on such a filter reduces the risk but does not remove it. Your team should decide a policy: which filter setting is required, and what to do when a long block looks familiar. Searching for a distinctive line of the suggestion is a quick check.
Some vendors also offer indemnification for customers on paid plans. Read the conditions, because they typically require the filter to be enabled.
A practical checklist
- Read the retention and training terms for your plan.
- Disable completions for secrets files and sensitive repositories.
- Enable the duplicate-code filter where it exists.
- Review long suggestions before accepting them. The next chapter covers failure modes in more detail.
Exercise
A developer has .env open in a tab while editing app.py. The tool's exclusion list blocks .env. Name one way secrets could still reach the model server, and one fix.
Show answer
The developer may have pasted a secret into app.py or a comment, and the path-based filter cannot see it. The prefix and suffix are sent as written. The fix is to keep secrets in environment variables or a secrets manager and out of source text. Scanning for secrets before commit also helps.