Draft
Conversation
Contributor
Author
CI Test Failure - Thoughts?I noticed the CI is failing on
It looks like this might be a pre-existing flaky test, and so I'd be keen for it not to block this PR, but I could be overlooking something. Whatcha think? |
b4bc072 to
3aece63
Compare
Support global and project-specific Cedar policy file paths in config.toml, providing consistency with target_image and envvars configuration. - Add PolicyFile and ProjectPolicyFiles fields to Config struct - Implement GetPolicyFile, SetGlobalPolicyFile, SetProjectPolicyFile methods - Parse policy_file from [leash] and [projects] sections in TOML - Update runner to respect config policy with correct precedence: CLI flag > env var > project config > global config - Document policy_file directive in CONFIG.md with link to CEDAR.md Co-Authored-By: opencode <noreply@opencode.ai>
The test was attempting to query GetPolicyFile with an empty string to check global policy, but normalizeProjectKey rejects empty paths. Fixed by querying a different project path to verify global policy fallback behaviour works correctly. Co-Authored-By: opencode <noreply@opencode.ai>
Co-Authored-By: opencode <noreply@opencode.ai>
Implements the documented feature that policy file paths support environment variable expansion. Previously, the documentation promised this functionality but resolvePolicyPath only handled tilde and relative paths. Changes: - Add os.ExpandEnv() to resolvePolicyPath before tilde expansion - Add comprehensive tests covering env var expansion scenarios - Add example to CONFIG.md showing env var usage - Document code duplication decision with migration guidance This matches the pattern used in resolveVolumeHost (mounts.go:325). Co-Authored-By: opencode <noreply@opencode.ai>
Merged TestPolicyFileConfigPrecedence and TestPolicyFileSaveRoundTrip into a single comprehensive test TestPolicyFilePersistenceAndPrecedence. Both tests were covering the same functionality: - Save/Load roundtrip - TOML persistence verification - Global vs project scope precedence The consolidated test maintains all coverage while removing duplication. Co-Authored-By: opencode <noreply@opencode.ai>
Replace vanilla base images (ubuntu:22.04, node:20) with custom image examples that include leash-entry, reflecting actual usage per CUSTOM-DOCKER-IMAGES.md guidance. Co-Authored-By: opencode <noreply@opencode.ai>
3aece63 to
b4cb1e0
Compare
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.
Warning
DRAFT PR—DO NOT MERGE
Blocked by: #60 (Leash fails to start on Docker Desktop)
Also, I want to complete a little more manual testing on Docker Desktop before removing draft status.
Summary
Add support for configuring Cedar policy file paths in
config.toml, allowing users to manage security policies at global and project scopes without relying on CLI flags or environment variables.Example use case: allowing different network calls to different URLs depending on project-specific tech stack, 3rd-party services, etc.
Changes
Add
policy_fileconfiguration directive[leash] policy_file = "~/leash/policies/default.cedar"[projects."/path"] policy_file = "./policies/project.cedar"~expansion, environment variables, and relative paths (for project entries)Implement precedence hierarchy
--policyflag takes highest priorityLEASH_POLICY_FILEenvironment variableUpdate contributor list
Screenshots/Videos
N/A
Reviewer Notes
Note
Not being super familiar with the codebase I let the coding agent copy+adapt the code used for
target_imageconfiguration and did not prompt it to do any refactoring/deduplication.