Skip to content

fix: harden supply-chain security — obfuscation scanner + advisory policy#458

Open
SongotenU wants to merge 1 commit into
Egonex-AI:mainfrom
SongotenU:sec/supply-chain-hardening
Open

fix: harden supply-chain security — obfuscation scanner + advisory policy#458
SongotenU wants to merge 1 commit into
Egonex-AI:mainfrom
SongotenU:sec/supply-chain-hardening

Conversation

@SongotenU

@SongotenU SongotenU commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Hardens supply-chain security following real malicious PRs observed in this repo:

Changes

1. SECURITY.md updates

  • Direct link to Security Advisories page
  • Email fallback (security@egonex.ai) if advisories unavailable
  • Supply-chain attacks explicitly in-scope

2. Obfuscation scanner script (.github/scripts/scan-obfuscation.sh)

Detects patterns commonly found in malicious PRs:

  • Packed/self-decoding JS blobs
  • Large base64/hex-encoded strings
  • String-shuffle decoders
  • global['!'] / global = global hijacks
  • Hidden eval/Function calls
  • require rebinding via global
  • Build-config file targeting (astro/vite/next configs)

3. Supply-chain CI workflow (.github/workflows/supply-chain-scan.yml)

  • Runs on every PR (opened, synchronize, reopened)
  • Generates full PR diff → runs obfuscation scanner
  • Non-blocking: auto-comments when suspicious patterns found, but does NOT block merge (false-positive safety)
  • Explicitly runs for fork PRs (highest risk vector)

Test plan

…policy

- Add CI workflow (supply-chain-scan.yml) scanning PR diffs for obfuscation/supply-chain attack patterns
- Add .github/scripts/scan-obfuscation.sh: detection of packed code, hidden eval, global hijack, base64/hex payloads, build-config targeting
- Update SECURITY.md: actionable advisory link, email fallback, supply-chain as in-scope
- Non-blocking: scan runs on all PRs, auto-comments when suspicious patterns found but does not block merge
- Mitigates real-world supply-chain attacks seen in this repo (PR Egonex-AI#198, Egonex-AI#206, Egonex-AI#261)
@Lum1104

Lum1104 commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eaa63fe3c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

echo "Diff lines: $(wc -l < /tmp/pr-diff.txt)"

- name: Run obfuscation scanner
run: bash .github/scripts/scan-obfuscation.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Run the scanner from trusted code

Because the job checks out the PR head before this line, a malicious fork PR can change .github/scripts/scan-obfuscation.sh in the same PR to simply exit 0 or omit the dangerous patterns, so the supply-chain scan is bypassed exactly in the untrusted PRs it is meant to catch. Run the scanner from the base repository/workflow checkout or otherwise pin the script before checking out untrusted code.

Useful? React with 👍 / 👎.

echo "Diff lines: $(wc -l < /tmp/pr-diff.txt)"

- name: Run obfuscation scanner
run: bash .github/scripts/scan-obfuscation.sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the manual-review path actually non-blocking

When scan-obfuscation.sh finds any warning it exits 1, and GitHub Actions keeps the job failed even though the following if: failure() comment step runs; without continue-on-error or capturing the exit code manually, PRs that only modify package.json or a build config will get a red check rather than the documented non-blocking warning, which can block merges if this workflow is required.

Useful? React with 👍 / 👎.

Comment on lines +47 to +50
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid posting fork warnings with a read-only token

In fork PRs, which this workflow explicitly targets, the pull_request GITHUB_TOKEN is read-only, while creating an issue/PR comment requires issues: write or pull-requests: write; this github.rest.issues.createComment call will fail with a permission error instead of surfacing the scanner warning to maintainers unless the notification is moved to a privileged follow-up workflow or another safe reporting mechanism.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants