Skip to content

Integrating OpenAI Code Analysis for identifying harmful code#4

Draft
ZanattaMichael wants to merge 23 commits into
ironmansoftware:mainfrom
ZanattaMichael:main
Draft

Integrating OpenAI Code Analysis for identifying harmful code#4
ZanattaMichael wants to merge 23 commits into
ironmansoftware:mainfrom
ZanattaMichael:main

Conversation

@ZanattaMichael

@ZanattaMichael ZanattaMichael commented May 8, 2023

Copy link
Copy Markdown

Description

This pull request adds 1 new commands to PowerShell Protect for integrating OpenAI into the platform. The new commands New-PNPAICondition with 2 conditions added. These are: AIisBestPracticeCondition and AIisSuspiciousCondition.

New Commands Added

  1. It takes in five parameters, including Property, AITemperature, AIRating, APIKey, and ContinueOnError. It then creates a new Condition object with these parameters and writes it to the output. The SecureStringExtensions class is used to convert the APIKey parameter to a base64-encoded string for added security. This cmdlet is part of the PowerShellProtect.Cmdlets namespace and can be used to integrate OpenAI into PowerShell Protect.

New Conditions Added

  1. AIisBestPracticeCondition: This condition checks whether an AI model adheres to best practices for training and deployment. It evaluates various aspects of the model, such as its accuracy, fairness, interpretability, and security, and returns a boolean value indicating whether the model meets the best practice criteria.

  2. AIisSuspiciousCondition: This condition checks whether an AI model exhibits suspicious behavior or is vulnerable to attacks. It evaluates various aspects of the model, such as its inputs, outputs, and internal workings, and returns a boolean value indicating whether the model is suspicious or not.

Usage Example

# Create a new AI condition
New-AICondition -Property isBestPractice|isSuspicious -AITemperature -1|1  -AIRating 0.5 -APIKey SecureString -ContinueOnError

Testing

Initial Testing, however AI Testing (with mocking) is not functional.

Documentation

None so far.

Contributors

  • Michael Zanatta

Michael Zanatta added 13 commits May 8, 2023 16:52
AICondition to Configuration
Added new Command
  New-AICondition
Added SecureStringHelper
Added AI Conditions
Updated Dependency Versions
Fixing Errors in Code
Updating Dependecies
@ZanattaMichael

This comment was marked as resolved.

Michael Zanatta added 10 commits May 10, 2023 21:17
Debugging AI Endpoint.
Updating Configuration
Fixing Bugs
isObfuscated Condition

Refactored OpenAI into seperate class
Added Model to configuration.
Refactoring AI logic to be include PSP non-ai conditions
Added New-AIConfiguration
@adamdriscoll

Copy link
Copy Markdown
Member

@ZanattaMichael - I realize this PR is literally years old but I'm curious if you would care if I resurrected it. I reviewed it and it looks really cool and I could do some work to update for changes that have come around recently.

@ZanattaMichael

Copy link
Copy Markdown
Author

@adamdriscoll No issues. Go for it!

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