Skip to content

Commit f3d792b

Browse files
Copilotmarkcowl
andauthored
Add security warning to tsp init documentation and CLI for external templates (#8917)
Add warning to documentation and CLI help for templateUrl parameter in tsp init command **Completed:** - [x] Explore repository structure and locate documentation files - [x] Install dependencies - [x] Add warning to CLI reference documentation (/website/src/content/docs/docs/handbook/cli.md) - [x] Add warning to scaffolding template documentation (/website/src/content/docs/docs/extending-typespec/writing-scaffolding-template.md) - [x] Add warning to templatesUrl parameter description in CLI code (packages/compiler/src/core/cli/cli.ts) - [x] Build and validate the documentation changes - [x] Address code review feedback for consistency - [x] Add changelog entry for @typespec/compiler referencing issue #8916 - [x] Review and finalize **Changes Made:** - Added security warnings to both the CLI handbook and scaffolding templates documentation - Added security warning to the templatesUrl parameter description in the CLI code, which appears in the `tsp init --help` output - The warnings inform users that downloading or using an untrusted template may contain malicious packages that can compromise their system and data, matching the warning prompt shown in the `tsp init` command - Warning text is consistent across documentation files and CLI help - Added changelog entry using chronus format for @typespec/compiler package only (no changelog needed for website documentation changes) - Fixes #8916 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Add warning text to documentation on `templateUrl` parameter in tsp init command</issue_title> > <issue_description>External templates *can* contain malicious packages and the like. We prompt about this when folks use `tsp init`: > > ```bash > warning: Downloading or using an untrusted template may contain malicious packages that can compromise your system and data. Proceed with caution and verify the source. > ? Continue (Y/n) > ``` > > We should also add a similar warning to the reference doc on tsp init</issue_description> > > <agent_instructions>Add a warning to the documentation on the templateUrl parameter to `tsp init`, similar to the warning prompt mentioned in the bug. It should be clear to users that using tsp init with an external templateUrl is unsafe, unless the template source is trusted.</agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> - Fixes #8916 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/microsoft/typespec/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: markcowl <[email protected]>
1 parent 9d36399 commit f3d792b

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: fix
3+
packages:
4+
- "@typespec/compiler"
5+
---
6+
7+
Add security warning to tsp init CLI documentation for external templates (#8916)

packages/compiler/src/core/cli/cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ async function main() {
211211
(cmd) =>
212212
cmd
213213
.positional("templatesUrl", {
214-
description: "Url of the initialization template",
214+
description:
215+
"Url of the initialization template. WARNING: Downloading or using an untrusted template may contain malicious packages that can compromise your system and data. Proceed with caution and verify the source.",
215216
type: "string",
216217
})
217218
.option("template", {

website/src/content/docs/docs/extending-typespec/writing-scaffolding-template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ TypeSpec offers a scaffolding feature through the `tsp init` command.
88
tsp init <templateUrl>
99
```
1010

11+
:::warning
12+
When using `tsp init` with an external template URL, be aware that downloading or using an untrusted template may contain malicious packages that can compromise your system and data. Proceed with caution and verify the source.
13+
:::
14+
1115
## Setting a minimum TypeSpec version
1216

1317
If your template requires a feature that was introduced in a later version of TypeSpec, you can specify this in the template. This will alert the user that the template may not function as expected and ask them to confirm if they wish to proceed.

website/src/content/docs/docs/handbook/cli.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ title: Cli usage
55

66
See full usage documentation by typing `tsp --help`:
77

8+
:::warning
9+
When using `tsp init` with an external template URL, be aware that downloading or using an untrusted template may contain malicious packages that can compromise your system and data. Proceed with caution and verify the source.
10+
:::
11+
812
```bash
913
>tsp --help
1014
TypeSpec compiler v0.36.1

0 commit comments

Comments
 (0)