Skip to content

Scrub environment-specific Sigma values and add a leak guard - #10

Merged
mattsenicksigma merged 3 commits into
mainfrom
scrub-environment-ids
Sep 29, 2026
Merged

mattsenicksigma merged 3 commits into
mainfrom
scrub-environment-ids

Conversation

@mattsenicksigma

Copy link
Copy Markdown
Collaborator

What this changes

A scan of the tracked files and the full git history found environment-specific Sigma values in the repo. This PR removes everything that can be removed from the current tree and adds a guard so it can't come back. (#9 already handled the connection id; this finishes the job.)

Ids

  • sigma_folder_id and the data model id follow the connection id pattern: project vars in integration_tests/dbt_project.yml that read SIGMA_FOLDER_ID / SIGMA_DATA_MODEL_ID and default to 00000000-0000-0000-0000-0000000000NN placeholders.
  • Golden files store <folderId> and <dataModelId> (check_golden.py normalizes them on both sides, like connectionId). The golden diff is exactly those 7 lines.
  • assert_workbooks now compares folderId and dataModelId with the vars. Before, the folder assertion only checked truthiness while its message claimed it checked the var. The script's override step re-runs the assertions with all three ids overridden.
  • README examples use <your-sigma-...-id> placeholders.

Wording

  • Removed the stale "The repository is private, so dbt deps needs credentials" paragraph (with its credential-token snippet).
  • Dropped the two comments referring to "Sigma's own build plugin".

Guard

  • New scripts/test_no_leaked_ids.py scans tracked files and fails on: any UUID that isn't a placeholder, any email address not at example.com, any *.sigmacomputing.com host other than help., assets., api. and app., and local paths (/Users/<name>/, /home/<name>/). It runs in CI with the other script tests. Tests prove it can find each kind (and that it scans tracked files only, not local ignored ones), and I planted a real-looking id in the README to confirm it fails with the file and line.
  • AGENTS.md records the rule.

Verification

Passes on dbt 1.x with --warn-error (also with all three SIGMA_* variables set to other values, with no golden churn) and on dbt 2.x: 30 negative cases, 45 Python tests. A re-run of the original scan over tracked files finds only the three placeholder defaults.

What this cannot fix: git history

The following are still in the history of every branch and PR ref, and merging this does not remove them:

  • the connection id (29 added lines across 6 commits), the folder id (8) and the data model id (5);
  • the author and committer identity on every commit (matt.senick@sigmacomputing.com, and "Matt Senick (Sigma)" on the merge commits GitHub made).

Whether that matters depends on how the repo reaches Matts52: a transfer or mirror carries all of it, while publishing a squashed snapshot of the cleaned tree does not. Rewriting this repo's history is possible but destructive (all branches and PRs would need re-pushing), so it is left as a decision. Also worth checking: the configured git user.email on any machine that will keep committing.

If the real connection or folder ids were ever in use, whether they need rotating depends on your org's policy.

🤖 Generated with Claude Code

mattsenicksigma and others added 3 commits September 28, 2026 23:32
…st regressions

- Folder and data model ids follow the connection id: project vars reading SIGMA_FOLDER_ID and
  SIGMA_DATA_MODEL_ID with placeholder defaults; golden files store <folderId> and <dataModelId>.
- Assertions now compare folderId and dataModelId with the vars (they only checked truthiness), and
  the script's override step covers all three ids.
- README examples use placeholders; remove the stale 'repository is private' paragraph; drop the
  references to Sigma's own build plugin.
- Add scripts/test_no_leaked_ids.py: fails on real-looking ids, non-example emails, non-public Sigma
  hosts and local paths in tracked files, with tests proving it can find each.
- AGENTS.md: never commit real ids, emails, internal hosts or local paths.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The guard scans tracked files, and its scanner tests contained literal fake ids, addresses and paths,
so it reported itself in CI (locally the file was still untracked, so it was skipped). Assemble the
fixtures at run time so the source holds no literal leaks, rather than exempting the file.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds .pre-commit-config.yaml with a local hook that runs scripts/test_no_leaked_ids.py before every
commit, so a leak is stopped before it enters history (which is permanent). Verified it passes on the
clean tree and fails, naming file and line, on a staged file holding a real-looking id. Documented in
AGENTS.md and the integration tests README.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mattsenicksigma
mattsenicksigma merged commit eb2f124 into main Sep 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant