Skip to content
Draft
Changes from all commits
Commits
Show all changes
54 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
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
170 changes: 167 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,22 +27,185 @@
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:
Comment on lines 29 to +41

Check failure

Code scanning / CodeQL

Checkout of untrusted code in trusted context High

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
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: |
# Function to log with consistent formatting
log_info() { echo "ℹ️ $1"; }
log_success() { echo "✅ $1"; }

log_info "Starting PR approval check..."

# Check if this is a fork PR
is_fork="${{ github.event.pull_request.head.repo.fork }}"
log_info "Fork PR: $is_fork"

if [ "$is_fork" = "true" ]; then
log_info "FORK PR DETECTED - Proceeding with security checks"

# Check if "safe to test" label is present
labels='${{ toJson(github.event.pull_request.labels.*.name) }}'
log_info "Available labels: $labels"

if echo "$labels" | grep -q "safe to test"; then
log_success "'safe to test' label found - checking if re-approval needed"

# Check if this workflow was triggered by new commits (synchronize event)
trigger_event="${{ github.event.action }}"
log_info "Workflow triggered by: $trigger_event"

if [ "$trigger_event" = "synchronize" ]; then
log_info "New commits detected on fork PR with existing 'safe to test' label"
log_info "Maintainer must remove and re-add the 'safe to test' label for security"
echo "approved=false" >> $GITHUB_OUTPUT
echo "needs_approval=false" >> $GITHUB_OUTPUT
echo "comment_needed=true" >> $GITHUB_OUTPUT
exit 1
else
log_success "Label approval granted (no new commits)"
echo "approved=true" >> $GITHUB_OUTPUT
echo "needs_approval=false" >> $GITHUB_OUTPUT
echo "comment_needed=false" >> $GITHUB_OUTPUT
fi
else
log_info "'safe to test' label not found - approval required"
echo "approved=false" >> $GITHUB_OUTPUT
echo "needs_approval=true" >> $GITHUB_OUTPUT
echo "comment_needed=true" >> $GITHUB_OUTPUT
exit 1
fi
else
log_success "Internal PR - auto-approved"
echo "approved=true" >> $GITHUB_OUTPUT
echo "needs_approval=false" >> $GITHUB_OUTPUT
echo "comment_needed=false" >> $GITHUB_OUTPUT
fi

- name: Comment on fork PR for approval guidance
if: |
always() &&
github.event.pull_request.head.repo.fork == true &&
steps.check-approval.outputs.comment_needed == 'true'
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
with:
script: |
// Helper function for consistent logging
const log = (level, message) => {
const icons = { info: 'ℹ️', success: '✅', warning: '⚠️', error: '❌' };
console.log(`${icons[level] || 'ℹ️'} ${message}`);
};

log('info', 'Comment step triggered for fork PR approval guidance');

try {
// Fetch existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

// Look for existing security guidance comments
const botComments = comments.filter(comment =>
comment.user.login === 'github-actions[bot]' &&
(comment.body.includes('🔒 **Security Approval Required**') ||
comment.body.includes('🔒 **Security Re-approval Required**'))
);

// Create approval message
const timestamp = new Date().toISOString();

let commentBody;
if ('${{ steps.check-approval.outputs.needs_approval }}' === 'true') {
// Initial approval scenario
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

**Note**: If new commits are added later, simply remove and re-add the \`safe to test\` label.

---
*🤖 Automated security check • Created: ${timestamp}*
*Learn more: [GitHub Security Lab - Preventing PWN Requests](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/)*`;
} else {
// Re-approval scenario (new commits with existing label)
commentBody = `🔒 **Security Re-approval Required**

⚠️ **New commits detected**: This fork PR has been updated with new commits while the \`safe to test\` label was present.

**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 simple process ensures that all commits have been properly reviewed before testing with repository secrets.

---
*🤖 Automated security check • Updated: ${timestamp}*
*Learn more: [GitHub Security Lab - Preventing PWN Requests](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/)*`;
}

// Always create a new comment for maximum visibility
// Keep existing comments for audit trail - don't delete them
log('info', 'Creating new security guidance comment (preserving audit trail)');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: commentBody
});
log('success', 'Created new security guidance comment');

log('success', 'Comment operation completed successfully');

} catch (error) {
log('error', `Failed to post comment: ${error.message}`);
if (error.response) {
log('error', `API Response: ${error.response.status} - ${error.response.data?.message || 'Unknown error'}`);
}
// Don't fail the step if comment posting fails
log('warning', 'Comment posting failed, but continuing workflow...');
}

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
uses: actions/checkout@v3
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Setup git config
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "<>"
- name: Merge master into pull request branch
run: |
git merge origin/master
Expand Down Expand Up @@ -246,4 +410,4 @@
echo "Downloading script from the master: $url"
curl -o "$filePath" "$url"
# Execute the script
python "$filePath"
python "$filePath"