Description
Audit explicit environment values against a supplied UTF-8 byte budget, excluding variable names, equals, NUL terminators and OS argv/env aggregate limits.
Environment assignments pair names with literal string values. Repeated names need an explicit first/last policy, and missing values differ from present empty strings. A dotenv file and a shell program can use different quoting and expansion rules; these tools implement their stated literal subsets using supplied data.
Audit explicit environment values against a supplied UTF-8 byte budget, excluding variable names, equals, NUL terminators and OS argv/env aggregate limits.
When to use this tool
Use this tool to audit explicit environment values against a supplied UTF-8 byte budget, excluding variable names, equals, NUL terminators and OS argv/env aggregate limits.
How to use the tool and how it works
- Enter assignmentsJson, budget using the input definitions below. Serialize the JSON text fields in the decoded shape shown below.
- Run the operation. Resolve malformed-input errors before interpreting the result.
- Read result.records. Interpret signs, units, ordering and null values using the rules below.
For each assignment calculate the UTF-8 byte length of its value and compare bytes ≤ budget. Preserve each name and occurrence, including empty values.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| assignmentsJson | JSON array of {name, value} strings using portable ASCII names and NUL-free literal values. Repeated names are retained until the stated policy is applied. | Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply. |
| budget | Inclusive per-value UTF-8 budget, integer 0–1,000,000,000 bytes. | Finite safe integer satisfying the stated bounds. |
These decoded examples show the structure of the JSON text fields. Supply each as its corresponding serialized JSON string.
{
"assignmentsJson": [
{
"name": "A",
"value": "é"
}
]
} | Output field | Interpretation |
|---|---|
| result | Object containing the fields below. |
| result.records | Per-value {name,bytes,withinBudget} records in source order. |
{
"input": {
"assignmentsJson": "[{\"name\":\"A\",\"value\":\"é\"}]",
"budget": 1
},
"output": {
"result": {
"records": [
{
"name": "A",
"bytes": 2,
"withinBudget": false
}
]
}
}
} Limitations and assumptions
- The budget is an integer 0–1,000,000,000 bytes per value. Names, equals signs, terminators and platform-wide argv/environment limits are excluded.
- Portable assignment records require names matching [A-Za-z_][A-Za-z0-9_]* and NUL-free values. Name matching is case-sensitive. Reference scanners and quoted-value helpers follow only their own stated grammar and do not read the process environment.
- Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
- Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.
Alternative or Complementary methods
Select the consuming application’s dotenv dialect explicitly. Keep literal substitution separate from recursive expansion and shell execution, and retain occurrence provenance when resolving duplicate assignments.
References
Similar or alternative tools
- Environment Empty Value Audit
Distinguish empty from nonempty whitespace-only portable environment values, retaining source occurrences; does not conflate missing variables with present empty values.
- Environment Assignment First Wins
Resolve explicit case-sensitive portable environment assignment occurrences under first-wins policy with source indexes; no shell execution or expansion.