Skip to content
Open
Changes from 41 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1b97488
ASim workflow update
v-amolpatil Oct 6, 2025
f2246c7
for testing added branch
v-amolpatil Oct 6, 2025
ba1377f
updated upload and download artifact action
v-amolpatil Oct 6, 2025
f4f6a43
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
c0ec2a3
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
6e3dd14
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
2cfb375
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
0ea4b4c
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
a30e78e
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
516c847
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
b51e69e
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
da2f96b
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 6, 2025
64ba4b5
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 7, 2025
45dae4a
Update VerifyASimParserTemplate.py
v-amolpatil Oct 7, 2025
ede896d
customization of code
v-amolpatil Oct 7, 2025
4277d62
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 7, 2025
496ab0a
code customization
v-amolpatil Oct 7, 2025
92e1141
Update VerifyASimParserTemplate.py
v-amolpatil Oct 7, 2025
1ea68a6
Update ingestASimSampleData.py
v-amolpatil Oct 7, 2025
0a9f7e0
code changes in powershell files.
v-amolpatil Oct 7, 2025
fa3bf06
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 7, 2025
ac6d630
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 7, 2025
2580ab5
new changes
v-amolpatil Oct 8, 2025
a6a1446
Revert "new changes"
v-amolpatil Oct 8, 2025
04eac13
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 8, 2025
d3a4218
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 8, 2025
c8171e0
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 8, 2025
32f71bd
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 8, 2025
1d1ec62
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 16, 2025
66717a1
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 17, 2025
87461fb
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 22, 2025
20c87e6
simplified code and removed unused code
v-amolpatil Oct 23, 2025
87eee14
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 23, 2025
e4568fb
cleanup of code
v-amolpatil Oct 23, 2025
6fe307d
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 23, 2025
3f0dcad
added label code "safe to test"
v-amolpatil Oct 23, 2025
92b1557
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 23, 2025
cb178b0
reverted code changes to match master branch changes
v-amolpatil Oct 24, 2025
37d56e8
Add security gate for fork PRs in ASIM test workflow
v-amolpatil Oct 27, 2025
434ac58
Fix race condition check for 'safe to test' label
v-amolpatil Oct 27, 2025
d31e91c
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
9f848d3
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
5a3d014
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 27, 2025
a252139
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
9f93dd4
Improve commit timestamp accuracy and add debug logs
v-amolpatil Oct 27, 2025
5ca051b
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
3de21ca
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
f01b2f2
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
67afc67
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
2465ae0
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
c4f395b
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
98054f3
Update runAsimSchemaAndDataTesters.yaml
v-amolpatil Oct 27, 2025
764f8a5
Always create new security guidance comments
v-amolpatil Oct 27, 2025
6135e38
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 28, 2025
4b91f2f
Update workflow to use head SHA and set permissions per job
v-amolpatil Oct 30, 2025
6703c6a
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 30, 2025
c239da7
Update PR review steps to verify file types
v-amolpatil Oct 30, 2025
6d7db91
Merge branch 'master' into asim-github-workflow
v-amolpatil Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 205 additions & 3 deletions .github/workflows/runAsimSchemaAndDataTesters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# The script runs ASIM Schema and Data testers on the "eco-connector-test" workspace.
name: Run ASIM tests on "ASIM-SchemaDataTester-GithubShared" workspace
on:
pull_request:
types: [opened, edited, reopened, synchronize]
pull_request_target:
types: [opened, edited, reopened, synchronize, labeled]
branches:
- master
- asim-github-workflow
paths:
- 'Parsers/ASimDns/Parsers/**'
- 'Parsers/ASimNetworkSession/Parsers/**'
Expand All @@ -26,9 +27,210 @@
id-token: write
contents: read

concurrency:
group: asim-tests-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
# Security gate: Fork PRs require manual approval via "safe to test" label
# Internal PRs (same repo) can proceed without labels
security-gate:
name: Security approval gate for fork PRs
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
issues: write
outputs:
approved: ${{ steps.check-approval.outputs.approved }}
steps:
- name: Check if PR needs approval
id: check-approval
run: |
echo "=========================================="
echo "Starting PR approval check..."
echo "=========================================="
# Check if this is a fork PR
is_fork="${{ github.event.pull_request.head.repo.fork }}"
echo "🔍 Is this a fork PR? $is_fork"
if [ "$is_fork" = "true" ]; then
echo "📌 FORK PR DETECTED - Proceeding with security checks"
# Check if "safe to test" label is present
labels='${{ toJson(github.event.pull_request.labels.*.name) }}'
echo "📝 Available labels: $labels"
if echo "$labels" | grep -q "safe to test"; then
echo "✅ 'safe to test' label FOUND - Checking for race conditions..."
# SECURITY: Check for race condition - commits after label approval
# Get when the "safe to test" label was added (most recent time)
echo ""
echo "🔐 RACE CONDITION CHECK:"
echo "---"
pr_number="${{ github.event.pull_request.number }}"
repo="${{ github.repository }}"
echo "📊 Fetching timeline for PR #$pr_number in $repo..."
timeline_response=$(curl -s -H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$repo/issues/$pr_number/timeline")
echo "📥 Timeline API response received (showing labeled events):"
echo "$timeline_response" | jq '.[] | select(.event == "labeled" and .label.name == "safe to test") | {event, created_at}' || echo " No labeled events found"
echo ""
label_created=$(echo "$timeline_response" \
| jq -r '.[] | select(.event == "labeled" and .label.name == "safe to test") | .created_at' \
| tail -1)
echo "🏷️ Most recent 'safe to test' label timestamp: $label_created"
if [ -n "$label_created" ]; then
# Get the latest commit timestamp
latest_commit_date="${{ github.event.pull_request.head.repo.pushed_at }}"
echo "📌 Latest commit timestamp: $latest_commit_date"
echo ""
# Convert to epoch time for comparison
echo "⏱️ Converting timestamps to epoch (seconds since 1970-01-01):"
label_epoch=$(date -d "$label_created" +%s 2>/dev/null || echo "0")
commit_epoch=$(date -d "$latest_commit_date" +%s 2>/dev/null || echo "0")
echo " Label timestamp: $label_created → epoch: $label_epoch"
echo " Latest commit: $latest_commit_date → epoch: $commit_epoch"
echo ""
# Allow 60 second grace period for GitHub timestamp variations
grace_period=60
commit_epoch_with_grace=$((commit_epoch + grace_period))
echo "⏳ Grace period: $grace_period seconds"
echo " Commit epoch with grace: $commit_epoch_with_grace"
echo " Label epoch: $label_epoch"
echo ""
if [ "$commit_epoch_with_grace" -gt "$label_epoch" ]; then
echo "❌ RACE CONDITION DETECTED!"
echo " ⚠️ New commits were pushed AFTER the label was approved"
echo " Difference: $((commit_epoch_with_grace - label_epoch)) seconds"
echo ""
echo "⚠️ SECURITY ALERT: Commits may have been pushed after label approval!"
echo "Label added: $label_created (epoch: $label_epoch)"
echo "Latest commit: $latest_commit_date (epoch: $commit_epoch)"
echo "❌ For security, this requires re-approval. Please:"
echo "1. Review the latest commits carefully"
echo "2. Remove and re-add the 'safe to test' label if commits are safe"
echo "approved=false" >> $GITHUB_OUTPUT
echo "needs_reapproval=true" >> $GITHUB_OUTPUT
exit 1
else
echo "✅ RACE CONDITION CHECK PASSED!"
echo " No new commits detected after label approval"
echo " Safe to proceed with testing"
echo "approved=true" >> $GITHUB_OUTPUT
fi
else
echo "❌ ERROR: Could not determine label timestamp"
echo "⚠️ Could not determine when label was added - manual review recommended"
echo "For maximum security, please remove and re-add the 'safe to test' label"
echo "approved=false" >> $GITHUB_OUTPUT
echo "needs_reapproval=true" >> $GITHUB_OUTPUT
exit 1
fi
else
echo "❌ 'safe to test' label NOT FOUND"
echo "Fork PR requires manual approval from a maintainer"
echo "approved=false" >> $GITHUB_OUTPUT
echo "needs_approval=true" >> $GITHUB_OUTPUT
fi
else
echo "✅ INTERNAL PR DETECTED (not a fork)"
echo "Internal PRs are auto-approved - skipping security checks"
echo "approved=true" >> $GITHUB_OUTPUT
fi
echo ""
echo "=========================================="
echo "Approval check complete"
echo "=========================================="
- name: Comment on fork PR for approval guidance
if: github.event.pull_request.head.repo.fork == true && failure()
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
script: |
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
// Check if we already have a guidance comment to avoid spam
const existingComment = comments.find(comment =>
comment.body.includes('🔒 **Security Approval Required**') &&
comment.user.type === 'Bot'
);
let commentBody = '';
// Check what type of approval is needed based on the step outputs
if ('${{ steps.check-approval.outputs.needs_reapproval }}' === 'true') {
commentBody = `🔒 **Security Re-approval Required**
⚠️ **Race condition detected**: New commits were pushed after the \`safe to test\` label was added.
**For security, a maintainer must:**
1. 📝 Review the latest commits carefully for any security concerns
2. 🏷️ Remove the \`safe to test\` label
3. 🏷️ Re-add the \`safe to test\` label if the new commits are safe
This ensures that all commits have been properly reviewed before testing with repository secrets.
---
*This is an automated security check to prevent malicious code execution. Learn more about [GitHub Security Lab recommendations](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/).*`;
} else {
commentBody = `🔒 **Security Approval Required**
This fork PR requires manual approval before automated testing can run.
**For security, a maintainer must:**
1. 📝 Review the code changes carefully
2. 🏷️ Add the \`safe to test\` label if the changes are safe to execute
This protects against malicious code execution in fork contributions.
---
*This is an automated security check to prevent malicious code execution. Learn more about [GitHub Security Lab recommendations](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/).*`;
}
if (existingComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existingComment.id,
body: commentBody
});
console.log('Updated existing security guidance comment');
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
console.log('Created new security guidance comment');
}
Run-ASim-TemplateValidation:
name: Run ASim Template Validation tests
needs: security-gate
if: needs.security-gate.outputs.approved == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout pull request branch
Expand Down Expand Up @@ -246,4 +448,4 @@
echo "Downloading script from the master: $url"
curl -o "$filePath" "$url"
# Execute the script
python "$filePath"
python "$filePath"