-
Notifications
You must be signed in to change notification settings - Fork 10
Prince/ added shiftai workflows #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Dependency ReviewThe following issues were found:
License Issues.github/workflows/ai-code-analysis.yml
OpenSSF Scorecard
Scanned Manifest Files.github/workflows/ai-code-analysis.yml
.github/workflows/ai-dashboard.yml |
- Move permissions from global to job level for both workflows - Replace direct GitHub context usage with environment variables - Prevent script injection attacks in GitHub Actions scripts - Follow GitHub security best practices for workflow design REF: GitHub security recommendations for workflow permissions and injection prevention
run: | | ||
cat > analyze_script.js << 'EOF' | ||
const fs = require('fs'); | ||
const path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this being injected rather than have a concrete debuggable file?
// Get the diff for this specific file, showing only added lines | ||
// Note: Using path.normalize() would require additional import, | ||
// but git itself provides good protection against path traversal | ||
const diffCommand = `git diff origin/${baseRef}...HEAD -- "${filePath}"`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we diffing again here?, isn't previous step already giving us diff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First diff gets us the list of files that changed:
git diff --name-only "origin/$PR_BASE_REF...HEAD"
This just gives us filenames like: app.js
, utils.js
, README.md
Second diff gets us the actual content that was added in each file:
git diff origin/${baseRef}...HEAD -- "${filePath}"
This shows the real diff with +
and -
lines.
Why we need both:
Think of it like this - the first one answers "What files were touched?" and the second one answers "What was actually added to this specific file?"
We only want to analyze the newly added content (the +
lines), not the entire file. So we need to:
- Know which files to look at (first diff)
- Extract just the added lines from each file (second diff)
- Search those added lines for
[AI]
tags
Without the second diff, we'd just have filenames but no idea what content was actually added to scan for AI-generated code.
const AI_BLOCK_REGEXES = [ | ||
{ | ||
name: 'universal', | ||
regex: /\[AI\]([\s\S]*?)\[\/AI\]/g, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought we uses a vectordb or a service for checking this, this looks like a loophole to me?
if: steps.check-skip.outputs.should-skip == 'false' | ||
run: | | ||
# Create the dashboard generation script inline | ||
cat << 'EOF' > generate-dashboard.js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, i think we can create a concrete js file for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was previously a standalone JS file. After moving it into a reusable workflow, it's now being referenced from the caller’s repository instead of this one, which results in a "file not found" error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, can it referenced the file link instead, for e.g github.com/deriv-com/shared-actions/scripts/generate-dashboard.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can address the comments on the next PR, so far this looks OK
No description provided.