Repository navigation
intrinsic: keep iac state directories under an operator root - #870
Merged
general-kroll-4-life merged 1 commit intoOct 24, 2026
Merged
general-kroll-4-life merged 1 commit into
general-kroll-4-life merged 1 commit into
Conversation
The 'state' predicate on stackql_preview.iac relations was passed straight to the ledger, so a query could create state anywhere the process can write. It is now a relative name resolved under the state root (the new iacStateRoot preview setting, or <approot>/iac), and names that are absolute, climb out with '..', or follow a link out of the root are refused before anything touches disk. Fixes #834 Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
general-kroll-4-life
approved these changes
Oct 24, 2026
general-kroll-4-life
left a comment
Contributor
There was a problem hiding this comment.
@RyoKusnadi thanks again, great contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #834
What
With the unstable preview on, the
statepredicate onstackql_preview.iacrelations went straight toomnisdk.NewLedger. A query could therefore create ledger and journal files anywhere the process can write.Now:
iacStateRootfield in--preview, e.g.--preview '{"unstable": true, "iacStateRoot": "/srv/stackql/iac"}'. When it's unset, the root is<approot>/iac, the same default as before.stateis now a relative name resolved under that root (state = 'prod'→<root>/prod). Leaving it out still uses the root itself..., or go through a symlink (or a junction on Windows) that leads out of the root. The root itself may be a link, so an operator can still point it at another disk.ledgerPredicates, beforeomnisdk.Prepare. A refused query writes nothing and makes no provider calls.For a local CLI run, the operator keeps the override through
iacStateRoot, which the process owner controls. A query can no longer choose the path on its own. That's a behaviour change: any query that passed an absolutestatepath now has to use a name under the root, or the operator has to setiacStateRoot. Since this is preview-only, I think that's acceptable, but I'm happy to change it.Notes
os.Root), which is outside this repo.Tests
internal/stackql/intrinsic/iac_test.go:..and nested..escapes are refused, and nothing is created on disk.--previewparsing ofiacStateRoot.go build ./...,go vet ./internal/stackql/intrinsic/andgo test ./internal/stackql/intrinsic/...pass on Go 1.27.3.