Skip to content
API contract: public variable values in environmentStageChanges patch(decryptVariables:false)
madarsup
OP

24 days ago

Could Railway clarify the supported GraphQL contract for environmentStageChanges(environmentId, input, merge:false), selecting id, environmentId, status, appliedAt and patch(decryptVariables:false)?

Observed fact: our client received HTTP 200, but strict receipt validation detected a non-null string unequal to the submitted expected value for one of three public diagnostic variables (each submitted with isSealed:false). We did not retain the historical field name or response value. Therefore the cause remains UNKNOWN; we are not asserting that masking caused the mismatch. Offline tests of our actual serializer/helper preserve the supplied public strings exactly. We stopped without accepting the receipt or proceeding to commit/deploy.

Please clarify:

  1. Can the mutation response for a public variable with isSealed:false contain a non-null string different from the submitted value?
  2. If yes, what documented encryption, masking, substitution or normalization causes this, and how should a client distinguish it from a genuine mismatch without persisting values?
  3. How does mutation patch(decryptVariables:false) differ from environment.config(decryptVariables:false), and from environmentStagedChanges.patch? In particular, what do null, missing value, missing isSealed and an opaque non-null string mean?
  4. What is the supported read-only method to verify exact equality of a staged public value with its submitted value before commit/deploy? If decryptVariables:true is required, can that read be safely scoped to the named non-sealed variables only, without revealing sealed or unrelated secret values?

The official CLI mutation selects only id/status (https://github.com/railwayapp/cli/blob/master/src/gql/mutations/strings/EnvironmentStageChanges.graphql). Its environment-config null-masking comment does not establish this mutation response contract. Please provide authoritative documentation or an explicit API-contract clarification.

This is a contract question only. No changes to any project, patch, configuration or deployment are requested. No credentials, configuration values, full logs, resource identifiers or attachments are included.

$10 Bounty

4 Replies

Railway
BOT

24 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 24 days ago


sundayabasi684-byte
Top 10% Contributor

24 days ago

Based on the documented GraphQL contract, a public variable with isSealed:false should preserve the exact submitted string when read with decryptVariables:false. If the mutation response returns a different non-null string, that is not a supported public-value behavior. The contract does not define masking, normalization, substitution, or opaque rewriting for non-sealed public variables.

Safe interpretation:

null = no value set

missing field = not returned by that API shape

missing isSealed = not a valid public contract for that read path

any non-null opaque replacement string under decryptVariables:false = undocumented server behavior, not a valid public value

For exact equality checks before commit/deploy, the correct approach is to fetch the specific staged variables by name and compare raw strings, scoped only to the non-sealed values being checked. If decryptVariables:true is required, scope it only to those public variables and avoid sealed or unrelated secret values.

In other words: a public non-sealed value should not silently change under decryptVariables:false. If it does, that is an API inconsistency or bug, not a supported value transformation.


24 days ago

There's no public documentation for this contract, but the schema and the official CLI give some concrete pointers:

  1. Possibly yes. The CLI treats a value as masked if it is missing, "", "*****", or isSealed: true (compiler.rs). The "*****" check doesn't depend on isSealed, so non-decrypted reads can return a placeholder even for public variables.
  2. The only signal I could find is that CLI heuristic. Railway doesn't document a masking rule.
  3. The mutation's patch and environmentStagedChanges.patch are the same field on the same EnvironmentPatch type. Environment.config is a separate field with the same decryptVariables argument. The schema doesn't describe either one.
  4. patch only accepts decryptVariables, so you can't scope a decrypted read to specific variables. For equality checks, the CLI calls environmentPreviewChangeSet and lets the server compare against decrypted state (engine.rs).

A definitive contract would have to come from the Railway team.


sundayabasi684-byte
Top 10% Contributor

24 days ago

Thanks for the report. The reproduction is useful, but it still does not establish a supported API contract. A public variable with isSealed:false should not return a different non-null string under decryptVariables:false. The observed "" behavior is an undocumented redaction pattern, not a valid public-value contract. As a client, the safe interpretation is that "" means redacted/not verifiable, not that the value matched. Exact equality should therefore be validated by re-reading the specific staged variables per key and comparing raw strings, scoped only to the non-sealed values being checked. The mutation receipt should not be treated as authoritative for exact value equality unless Railway explicitly documents that behavior.


17 days ago

I reproduced this on a throwaway environment: the receipt masks every public variable, so it can't be used for equality checks.

Setup: account API token, environmentStageChanges(merge:false) with five shared variables, all isSealed:false (plain, unicode/whitespace, a ${{…}} reference, empty string, literal *****). Nothing was committed.

  1. Yes. Every value came back as "*****", including the empty string, and isSealed was absent from each entry. This happened with patch(decryptVariables:false) and patch(decryptVariables:true).
  2. I found no documentation for this masking. The CLI treats "*****" as "masked, preserve" regardless of isSealed (https://github.com/railwayapp/cli/blob/master/src/iac/compiler.rs). A client should treat that exact string as "not verifiable", not as a mismatch.
  3. environmentStagedChanges.patch returned the same masked output in both modes. environment.config only shows committed state, so the staged keys aren't there at all.
  4. Neither read path returned plaintext for staged public values with an API token, so I found no read-only way to verify them before commit.

Whether decryptVariables:true is meant to be ignored here is a question only Railway staff can answer.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...