Skip to main content

Security

A template is a set of files from someone else, and CodeBaker runs it on your machine, in your project. This page says what an installed template can and cannot do, so you know how much to trust one.


A template writes files into your project and can read data from addresses it declares (see $api). Install templates only from sources you trust, and review the changes in the diff step before accepting them, as with any generation.

What a template cannot do, whatever it says:

  • Write outside the folder you generate into. A target with .., a backslash or a control character is refused in step 2, before anything is written; a leading / means the root of the output folder, not of your disk.
  • Read outside your project. A $file reference (project://, target:// or template://) and a seed stay inside the folder they are relative to: .. is refused, and so is a link inside it that points outside.
  • Open or reveal files outside your project. The open and expand lists are checked the same way.
  • Run code or read your files through its expressions. Pebble expressions cannot use Java reflection (getClass() and the chains built on it), and the tags that load other templates are switched off.
  • Fetch anything but a web address. $api takes http and https only, never file: or jar:.

What it can do, which is why you should trust the source: read any file inside your project with project:// into the variables of the files it generates (you see the result in the diff), and call any http or https address through $api, including addresses on your own machine or network. The address can contain values from the form, so do not type a secret into a field of a template you do not know.


What protects you​

  • Nothing is written before you confirm. The preview shows every file that would be created or changed, with a diff for files that exist. Read it. See Step 3: Code Preview.
  • A target that cannot be written stops the run in step 2, before anything is written, and one undo reverts what was written: Step 4.
  • An archive is checked before it is unpacked, against limits on size and number of files, and a path that tries to leave its folder is refused: Limits.
  • A web page cannot install a template on its own. The Install in IDE button only opens the install dialog with the address filled in, and nothing is installed until you confirm.

What to keep in mind​

  • The history stores what you type, unencrypted, in the .history folder of the template, inside your project. Add .history to your .gitignore, and do not type a secret into a field of a template you do not know. See $api.
  • Only public links can be installed from a URL. A template that needs a sign-in has to be downloaded and installed from a file.
  • Plain http:// is accepted for localhost only when a template is installed from a web page.