Skip to content

Dev/anasanc/pep addingcommonextensioncode#41

Merged
alsanmsft merged 16 commits into
mainfrom
dev/anasanc/pep-addingcommonextensioncode
Mar 12, 2026
Merged

Dev/anasanc/pep addingcommonextensioncode#41
alsanmsft merged 16 commits into
mainfrom
dev/anasanc/pep-addingcommonextensioncode

Conversation

@alsanmsft

Copy link
Copy Markdown
Contributor

Changes here implement functions that will be frequently used across different extensions for a feature called Constrained Extensions. Constrained extensions limits the capabilities of onboarded extensions according to a customer-defined, pre-set policy.

The changes in this PR include:

  • LoadPolicySettings() to load policy settings into a struct (defined by an extension) from the policy file
  • ValidateFileHashInAllowlist() to implement allowlist logic into extensions that run scripts.
  • ComputeFileHash()
  • ValidateItemInList()
  • UTs

HashTypeSHA256
)

func ValidateValueInAllowlist(value string, allowlist []string) error {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm wondering is whether the search should be done case insensitive. That seems to make sense to me.

Also not a bad idea to trim the values.

@jscalev jscalev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Had one small comment.

If you haven't done so already, I recommend asking AI if more unit tests are recommended (and to write them).

@alsanmsft alsanmsft merged commit 6da8a25 into main Mar 12, 2026
2 checks passed
@alsanmsft alsanmsft deleted the dev/anasanc/pep-addingcommonextensioncode branch March 12, 2026 21:21
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.

2 participants