rokucommunity / rokucommunity/brighterscript

Manifest parsing can result in mutated values

Open
#422 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug plugin api
Dominant language
TypeScript
Stars
208
Forks
68
Avg merge
8h 39m
Merged PRs (30d)
39

Description

When working on a plug-in for a client that required modifications to the manifest I had discovered that values in the manifest can get mutated. For example if you have something like have rsg_version=1.2 it will get parsed as rsg_version=1. Also if I put something like build_version=0 in the manifest its value will become 0 but if I do build_version=0-alpha I will get "0-alpha" for the value.

Another example is I had a key of revision with a value of 000000. The goal was to replace with with a commit sha as a form of binary versioning. This bug did not prevent me from doing so but the value was converted to 0 rather then staying 000000.

To get around this for the rsg_version I needed to do the following:

	public afterPublish(builder: ProgramBuilder, files: FileObj[]) {
		let manifest = builder.program['_manifest']

		let manifestString = ''
		manifest.forEach((value: any, key: string) => {
			if (key === 'rsg_version') {
				manifestString += `rsg_version=1.2\n`
			} else {
				manifestString += `${key}=${value}\n`
			}
		});
		fsExtra.writeFileSync(path.join(builder.program.options.stagingFolderPath, '/manifest'), manifestString);
	};

I propose that we need a white list known manifest values and the exact ways they can be converted and if the key is not a known type we always treat it as a string since this is also how the device treats the values.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how builder.program['_manifest'] is populated and how manifest values are parsed; the issue does not name a source file or test. Reproduce the decimal, zero, hyphenated, and zero-padded examples, then confirm unknown keys retain their exact string values and known conversions follow an explicit whitelist.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.