Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
38 changes: 38 additions & 0 deletions .github/workflows/frontend-security-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Frontend Security Audit

on:
push:
branches: [master]
paths:
- 'react-frontend/**'
pull_request:
paths:
- 'react-frontend/**'
Comment on lines +1 to +10

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paths filter doesn't include the workflow file itself, so changes to this workflow won't trigger the audit. This PR cannot self-verify. Consider adding .github/workflows/frontend-security-audit.yml to the paths list.


permissions:
contents: read

jobs:
npm-audit:
name: npm audit (high and critical)
runs-on: ubuntu-latest
defaults:
run:
working-directory: react-frontend

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: react-frontend/package-lock.json

- name: Install dependencies
run: npm ci

- name: Run security audit
run: npm audit --audit-level=high --omit=dev

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--omit=dev skips auditing devDependencies. Vulnerabilities in build-time tools won't be caught. Consider removing this flag for full coverage, or add a comment explaining why dev vulnerabilities are intentionally excluded.

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.pyc
.env
src/config/supported_distros.py
.DS_Store
node_modules/
react-frontend/node_modules/
react-frontend/build/
log/
14 changes: 14 additions & 0 deletions docs/Contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ git push origin Software-Discovery-Tool-feature_name

For more information on creating a pull request, refer to the [GitHub Help documentation](https://help.github.com/articles/creating-a-pull-request/).


## Security Policy for React Frontend

All pull requests that modify files under `react-frontend/` are subject
to an automated security audit via GitHub Actions. The CI pipeline runs `npm audit --audit-level=high` and will fail CI if any high or

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs say the CI "will fail if any high or critical vulnerabilities are introduced", but the workflow flags all existing ones too. Since react-scripts 5.0.1 already has known high/critical vulns, every PR touching react-frontend/ will fail CI immediately. Please fix existing vulnerabilities first or update the wording to reflect the actual behavior.

critical severity vulnerabilities are introduced, which may block merging
when required checks are enforced.

If your PR fails this check:
1. Run `npm audit` locally inside `react-frontend/` to see the issues.
2. Run `npm audit fix` to auto-fix what's safe.
3. For issues that can't be auto-fixed, update the affected dependency
manually or open a separate issue.

## Note

Please note that not all pull requests may be accepted. The project maintainers will review your changes and determine their suitability for merging into the main branch. If your contribution is not accepted, the reviewer will provide feedback and explain the reason.
Expand Down
Loading