Skip to content

Commit dbcef5e

Browse files
fix(security): harden supply chain and resolve dependency alerts
- Pin all reusable workflow refs to SHA digests (org-infra@32b8e9b) - Pin Dockerfile base image to digest - Add SECURITY.md with vulnerability reporting guidelines - Add .github/dependabot.yml for automated dependency updates - Update package-lock.json resolving 6 of 7 Dependabot alerts (vite, postcss, @babel/plugin-transform-modules-systemjs, lodash) Resolves: OpenSSF Scorecard alerts #1, #2, #3, #4, #5, #6, #7, #9, #27 Resolves: Dependabot alerts #15-20, #22 Signed-off-by: sonupreetam <spreetam@redhat.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 85e35b4 commit dbcef5e

9 files changed

Lines changed: 218 additions & 442 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04
1+
FROM mcr.microsoft.com/devcontainers/base:ubuntu-22.04@sha256:253b0ee40a5afd4f295640f9f90aed206953962fab56bfa14d9fcb593f33dc47
22

33
# hadolint ignore=DL3008
44
RUN apt-get update && \

.github/dependabot.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: npm
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
day: monday
9+
open-pull-requests-limit: 10
10+
labels:
11+
- dependencies
12+
- automated
13+
14+
- package-ecosystem: gomod
15+
directory: /
16+
schedule:
17+
interval: weekly
18+
day: monday
19+
open-pull-requests-limit: 5
20+
labels:
21+
- dependencies
22+
- automated
23+
24+
- package-ecosystem: github-actions
25+
directory: /
26+
schedule:
27+
interval: weekly
28+
day: monday
29+
open-pull-requests-limit: 5
30+
labels:
31+
- dependencies
32+
- automated
33+
34+
- package-ecosystem: docker
35+
directory: /.devcontainer
36+
schedule:
37+
interval: monthly
38+
open-pull-requests-limit: 3
39+
labels:
40+
- dependencies
41+
- automated

.github/workflows/ci_checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717
jobs:
1818
call_reusable_ci:
1919
name: Standardized CI
20-
uses: complytime/org-infra/.github/workflows/reusable_ci.yml@main
20+
uses: complytime/org-infra/.github/workflows/reusable_ci.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main
2121
permissions:
2222
contents: read
2323
issues: read

.github/workflows/ci_dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ permissions:
1717
jobs:
1818
call_deps_reviewer:
1919
name: General
20-
uses: complytime/org-infra/.github/workflows/reusable_deps_reviewer.yml@main
20+
uses: complytime/org-infra/.github/workflows/reusable_deps_reviewer.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main
2121

2222
call_dependabot_reviewer:
2323
name: Dependabot
24-
uses: complytime/org-infra/.github/workflows/reusable_dependabot_reviewer.yml@main
24+
uses: complytime/org-infra/.github/workflows/reusable_dependabot_reviewer.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main
2525

2626
comment_on_dependabot_prs:
2727
name: Dependabot Comment

.github/workflows/ci_scheduled.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
actions: read
2020
security-events: write
2121
id-token: write
22-
uses: complytime/org-infra/.github/workflows/reusable_scheduled.yml@main
22+
uses: complytime/org-infra/.github/workflows/reusable_scheduled.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main

.github/workflows/ci_security.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
security-events: write
2626
id-token: write
2727
packages: write
28-
uses: complytime/org-infra/.github/workflows/reusable_vuln_scan.yml@main
28+
uses: complytime/org-infra/.github/workflows/reusable_vuln_scan.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main
2929

3030
call_reusable_security:
3131
name: OpenSSF Scorecards
3232
permissions:
3333
contents: read
3434
id-token: write
3535
security-events: write
36-
uses: complytime/org-infra/.github/workflows/reusable_security.yml@main
36+
uses: complytime/org-infra/.github/workflows/reusable_security.yml@32b8e9b381a33fc4c3f8768856b11d94655f20c4 # main

SECURITY.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| latest | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
If you discover a security vulnerability in this project, please report it
12+
responsibly. **Do not open a public GitHub issue.**
13+
14+
Instead, please use one of the following methods:
15+
16+
1. **GitHub Security Advisory** (preferred): Use the
17+
[private vulnerability reporting](https://github.com/complytime/website/security/advisories/new)
18+
feature on this repository.
19+
20+
2. **Email**: Send details to the maintainers listed in the repository's
21+
`MAINTAINERS` file or reach out via the organization contact.
22+
23+
### What to include
24+
25+
- Description of the vulnerability
26+
- Steps to reproduce
27+
- Potential impact
28+
- Suggested fix (if any)
29+
30+
### Response timeline
31+
32+
- **Acknowledgment**: Within 5 business days of report
33+
- **Assessment**: Within 10 business days
34+
- **Fix or mitigation**: Depending on severity, typically within 30 days
35+
36+
## Security Best Practices
37+
38+
This project follows supply-chain security best practices:
39+
40+
- GitHub Actions are pinned to full SHA digests
41+
- Dependencies are monitored via Dependabot and OSV-Scanner
42+
- OpenSSF Scorecard checks run on every push and on a daily schedule

config/postcss.config.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
const autoprefixer = require('autoprefixer');
2-
const { purgeCSSPlugin } = require('@fullhuman/postcss-purgecss');
3-
const whitelister = require('purgecss-whitelister');
2+
const purgeCSSPlugin = require('@fullhuman/postcss-purgecss');
3+
const glob = require('glob');
4+
const fs = require('fs');
5+
const path = require('path');
6+
7+
/**
8+
* Extracts CSS selectors from SCSS/CSS files matching the given glob patterns.
9+
* Replaces purgecss-whitelister to avoid its vulnerable lodash transitive dep.
10+
*/
11+
function whitelister(patterns) {
12+
const selectors = new Set();
13+
const files = patterns.flatMap((pattern) => glob.sync(pattern));
14+
for (const file of files) {
15+
const content = fs.readFileSync(path.resolve(file), 'utf8');
16+
const matches = content.matchAll(
17+
/(?:^|[\s,{;])([.#])([a-zA-Z_][\w-]*)/g
18+
);
19+
for (const match of matches) {
20+
selectors.add(match[2]);
21+
}
22+
}
23+
return [...selectors];
24+
}
425

526
module.exports = {
627
plugins: [

0 commit comments

Comments
 (0)