In a Postman run, why might a vault secret resolve into one request's URL but not into another's?
answer
- The value has a reach of its own
- Something is compared against the URL
- The same list type gates a proxy bypass
- An absent list is permissive, not restrictive
- The check can run a second time
basics
~20 sA vault variable can carry a domains array of URL match patterns. The runtime compiles them and offers the variable only to requests whose URL they match, so a non-matching URL keeps the token literal.
solid answer
~50 sA vault variable may carry metadata named `domains`: an array of URL-match-pattern strings. Before the run starts, the runtime prepares the vault scope once, rewriting each entry into a normalised pattern — protocol, remote, any port, any path, so the **path is ignored** — and compiling them into a **`UrlMatchPatternList`**, the same list type used for a proxy's bypass list and a certificate's matches. A helper on the scope then returns, for a given URL string, only the variables whose patterns test true. A variable with no domains is offered everywhere. The match runs on the request's raw URL and, if substitution changed the URL, again on the resolved one — so a token that only becomes a given host after substitution is re-checked. A non-match is silent: the brace token is simply left literal.
go deeper
Recall that a value held in Postman's vault can be limited to particular URLs, so a token left literal in one request may simply be out of that value's reach.
Explain the compilation step: domain strings become URL match patterns covering any port and path, and the scope is filtered against the request's URL string before substitution.
Diagnose from the URL as it will actually be sent, after any script rewrite, and know the second match pass exists because substitution can change the host the request targets.
Own where value-level reach belongs in a team's design: what you gain by binding a credential to a host, what it cannot express, and when separate values beat a broader pattern.
## A vault variable can carry a domain list Most variables in a Postman run are offered to whatever is being substituted, and the only thing that decides the outcome is whether a key matches. **Vault variables are different**: one can carry a piece of metadata named `domains`, an array of URL-match-pattern strings, and that array narrows where the value is allowed to appear. So the answer to "why did it fill in here and not there" is usually not a typo, a scope problem or a timing problem. It is that the *request's URL* did not match the *variable's* pattern list. ## How the list becomes a matcher Before the run walks its items, the runtime prepares the vault scope once and mutates it in place: 1. It visits every variable in the scope and reads the `domains` array off the variable's metadata. 2. A variable with no array, or an empty one, is left exactly as it is. 3. For a variable that has one, each entry is parsed as a URL and rewritten into a normalised pattern of the form *protocol, remote, any port, any path* — the **path is deliberately ignored**, and a missing protocol defaults to a secure one. 4. Those patterns are compiled into a **`UrlMatchPatternList`** — the same list type the SDK uses for a proxy's bypass list and a client certificate's `matches` — and stored back on the variable. 5. The scope is marked as having domain patterns, and a helper is attached to it that returns, for a given URL string, the sub-list of variables whose patterns test true. The scope is only prepared once; a second call sees the marker and returns immediately. ## When the match runs The matching happens as the runtime resolves the request's URL, and it can happen **twice**: - First, the raw URL string of the request is tested — with a protocol forced onto it if the URL has none — and the matching vault variables are collected. - Substitution then runs over the URL. - If substitution actually changed the URL, the resolved URL is tested **again** and the matching set is recomputed, because a brace token in the host could have moved the request to a different origin. Only vault variables are re-applied in that second pass; the other scopes are already resolved. That second pass is the detail worth knowing. A vault secret gated to one host will not leak into a request whose host only *becomes* that host after another variable is substituted in — the check is re-run against what the URL actually became. ## What that means in practice | variable | domain list | offered to | |---|---|---| | ordinary vault variable | absent or empty | every request URL | | gated vault variable | one or more patterns | only URLs its patterns match | - **No domains means no filter.** An absent list is permissive, not restrictive; the helper returns the variable unconditionally. - **The path does not matter.** Patterns are normalised to any port and any path, so gating by a path prefix is not a thing you can express. - **The comparison is against the URL string**, so a host reached by two different spellings is two different matching decisions. - **A non-match is silent.** The token is simply left unresolved rather than raising an error, which is why this presents as a request going out with a literal brace token in it. ## Diagnosing it Start from the URL, not from the variable. Take the request's URL exactly as it is about to be sent — after any pre-request script has rewritten it — and ask whether the variable's patterns cover that protocol and host. If the URL is itself built out of variables, resolve it first; the runtime does the same thing, and it is the resolved form that decides the second pass. If the value fills in for one request and not its neighbour, compare the two hosts before you compare anything else. The interviewer is checking whether you know that a vault value has a **reach**, and that the reach is expressed as URL match patterns rather than as folders, environments or collections. Anyone who answers "check the environment you selected" has the wrong model.
- Why does the runtime test the URL a second time after substitution?Because the URL can change. If a brace token in the host resolves to a different origin, the request is no longer aimed where the first test assumed, so the matching set is recomputed against the resolved URL and only vault variables are re-applied. It stops a value gated to one host from being placed into a request that turned out to target another.
- Can a domain entry restrict a vault value to one path on a host?No. Each entry is normalised into a pattern covering any port and any path on the remote, so the path component of whatever you wrote is discarded. Gating is per protocol and host, not per route. If you need finer separation than that, you need separate values rather than a cleverer pattern.
saying these in an interview costs you the question
- Blames the selected environment for a non-match
- Thinks folder placement scopes a vault value
- Assumes an empty domain list blocks everything
- Expects a path prefix to narrow the match
- Expects an error rather than a literal token