Skip to content

Main content

Environment Variable Name Policy Audit

Audit explicit environment names under the portable ASCII shell-style identifier policy; not an OS-wide variable-name validity rule.

Loading tool…

Description

Audit explicit environment names under the portable ASCII shell-style identifier policy; not an OS-wide variable-name validity rule.

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 names under the portable ASCII shell-style identifier policy; not an OS-wide variable-name validity rule.

When to use this tool

Use this tool to audit explicit environment names under the portable ASCII shell-style identifier policy; not an OS-wide variable-name validity rule.

How to use the tool and how it works

  1. Enter names using the input definitions below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.violations. Interpret signs, units, ordering and null values using the rules below.

Test each complete name against [A-Za-z_][A-Za-z0-9_]* and return each failing spelling with its original index.1

Input fieldMeaning and unitsAccepted input
namesExplicit name strings to audit against the stated ASCII policy.Dense list of at most 128 strings, each at most 8,192 UTF-16 code units.
Output fieldInterpretation
resultObject containing the fields below.
result.violationsOriginal {index,name} records failing the portable name grammar.
json
{
  "input": {
    "names": [
      "GOOD",
      "2BAD",
      "a-b"
    ]
  },
  "output": {
    "result": {
      "violations": [
        {
          "index": 1,
          "name": "2BAD"
        },
        {
          "index": 2,
          "name": "a-b"
        }
      ]
    }
  }
}

Limitations and assumptions

  • This portable ASCII naming policy is narrower than every operating system’s possible environment names.
  • 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

  1. Tool behavior and example: Environment Variable Name Policy Audit — tool.io

Similar or alternative tools