Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
22 changes: 22 additions & 0 deletions .github/workflows/snykScan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Snyk Security

on:
push:
branches: ["master" ]
pull_request:
branches: ["master"]


jobs:
snyk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: snyk/actions/setup@master
- name: Snyk Code Test
continue-on-error: true
run: snyk code test --json > snykResult.json
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
- name: Get JSON data
run: cat snykResult.json
22 changes: 22 additions & 0 deletions src/vulnCode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fetch = require('node-fetch');

async function fetchGitHubUserCount(pat, orgName) {
try {
const response = await fetch(`https://api.github.com/orgs/${orgName}/members`, {
headers: {
Authorization: `token ${pat}`
}
});
const members = await response.json();
const memberCount = members.length;
console.log(`Total members in ${orgName} organization:`, memberCount);
} catch (error) {
console.error('Error fetching GitHub user count:', error);
}
}

// Replace 'YOUR_PAT' and 'YOUR_ORG_NAME' with your personal access token and GitHub organization name respectively
const pat = 'YOUR_PAT';

Check failure

Code scanning / CodeQL

Hard-coded credentials

The hard-coded value "YOUR_PAT" is used as [authorization header](1).
const orgName = 'YOUR_ORG_NAME';

fetchGitHubUserCount(pat, orgName);