Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4a2c42e
update admx for new properties
JohnDuprey Oct 1, 2025
a9a9b6e
update rule regexes
JohnDuprey Oct 11, 2025
c737a87
fix custom rules being reset
JohnDuprey Oct 12, 2025
01f47f7
Cosmetic updates
Oct 16, 2025
a2d93eb
Merge pull request #89 from cogifoo/main
KelvinTegelaar Oct 21, 2025
9b75c75
GITBOOK-62: docs: Rule Playground
bmsimp Oct 24, 2025
d2599ab
Squashed commit of the following:
JohnDuprey Nov 4, 2025
66b7ef9
Create pr_check.yml
JohnDuprey Nov 4, 2025
3229544
Test Pages and Performance Improvements
redanthrax Nov 4, 2025
7b42b7f
initial add of new CI/CD workflows
JohnDuprey Nov 5, 2025
dd6cd77
Merge pull request #97 from redanthrax/PerfTestPages
JohnDuprey Nov 5, 2025
9c6a0c3
block valid badge for iframe content detection
JohnDuprey Nov 5, 2025
b4e1304
add azure.cn to microsoft domain list
JohnDuprey Nov 5, 2025
790aa74
fix regular expressions
JohnDuprey Nov 5, 2025
a177f31
fix user provided allow list
JohnDuprey Nov 5, 2025
30fc3e0
exclusion fixes
JohnDuprey Nov 5, 2025
55dc332
fix: custom detection rules URL not persisting
redanthrax Nov 5, 2025
f9f9919
pin upload-artifact action
JohnDuprey Nov 5, 2025
203a3b9
Merge pull request #98 from redanthrax/ConfigStorageFix
JohnDuprey Nov 5, 2025
4e8a0ad
move copy function to build-test-pack
JohnDuprey Nov 5, 2025
6156d85
yaml issue
JohnDuprey Nov 5, 2025
a74e92a
Update action.yml
JohnDuprey Nov 5, 2025
b71dcb4
Update action.yml
JohnDuprey Nov 5, 2025
7734df6
switch schema
JohnDuprey Nov 5, 2025
6415374
drop schema validation for now
JohnDuprey Nov 5, 2025
b339f9a
fix admx conflict
JohnDuprey Nov 5, 2025
73b636d
update rule regexes
JohnDuprey Oct 11, 2025
ef75cec
fix custom rules being reset
JohnDuprey Oct 12, 2025
368300e
Cosmetic updates
Oct 16, 2025
22983e8
GITBOOK-62: docs: Rule Playground
bmsimp Oct 24, 2025
f8787ee
Squashed commit of the following:
JohnDuprey Nov 4, 2025
93e6e42
Create pr_check.yml
JohnDuprey Nov 4, 2025
48234a5
initial add of new CI/CD workflows
JohnDuprey Nov 5, 2025
e1aa3d2
Test Pages and Performance Improvements
redanthrax Nov 4, 2025
7176a60
block valid badge for iframe content detection
JohnDuprey Nov 5, 2025
b2a8b9a
add azure.cn to microsoft domain list
JohnDuprey Nov 5, 2025
674cc6f
fix regular expressions
JohnDuprey Nov 5, 2025
816effd
fix user provided allow list
JohnDuprey Nov 5, 2025
df2961e
exclusion fixes
JohnDuprey Nov 5, 2025
6108f6a
pin upload-artifact action
JohnDuprey Nov 5, 2025
a57d00c
fix: custom detection rules URL not persisting
redanthrax Nov 5, 2025
ddd78a1
move copy function to build-test-pack
JohnDuprey Nov 5, 2025
ca0b031
yaml issue
JohnDuprey Nov 5, 2025
cadf2c5
Update action.yml
JohnDuprey Nov 5, 2025
2c6fe6e
Update action.yml
JohnDuprey Nov 5, 2025
03ed433
switch schema
JohnDuprey Nov 5, 2025
b228445
drop schema validation for now
JohnDuprey Nov 5, 2025
1642114
Merge branch 'dev' of https://github.com/CyberDrain/Check into dev
JohnDuprey Nov 5, 2025
b22f12e
add github.com
JohnDuprey Nov 5, 2025
3c7a942
tweak rule
JohnDuprey Nov 5, 2025
0551f63
tweak rules
JohnDuprey Nov 5, 2025
c692450
feat: add generic webhook actions
redanthrax Nov 5, 2025
aad258b
GITBOOK-63: Replace Docs Link with Dev
bmsimp Nov 7, 2025
e261c9a
Include refreshToken in Google Refresh Token workflow
JohnDuprey Nov 7, 2025
2ee0d5b
Update build-assets-on-release.yml for permissions
JohnDuprey Nov 14, 2025
0a3cc67
Add script to remove Chrome and Edge extension settings
rvdwegen Nov 17, 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
42 changes: 42 additions & 0 deletions .github/workflows/actions/build-test-pack/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Assumes that:
# 1. the following env variables are set:
# - ZIP_FILE_PATH
# - EXTENSION_DIR
# 2. repository checked out
# Effects:
# - builds and tests an extension, fails on error
# - packed extension.zip saved to env.ZIP_FILE_PATH if inputs.doNotPackZip == 'false'

name: "Build, test and pack WebExtension"
description: "Builds, tests, and packs extension dir into zip file"

inputs:
doNotPackZip:
description: 'Set `true` to omit pack step'
required: false

runs:
using: "composite"
steps:
# Add additional build and test steps here

- name: Copy extension to folder
shell: bash
run: |
mkdir -p ${{ env.EXTENSION_DIR }}
cp manifest.json ${{ env.EXTENSION_DIR }}
cp blocked.html ${{ env.EXTENSION_DIR }}
cp -r config/ ${{ env.EXTENSION_DIR }}
cp -r images/ ${{ env.EXTENSION_DIR }}
cp -r options/ ${{ env.EXTENSION_DIR }}
cp -r popup/ ${{ env.EXTENSION_DIR }}
cp -r rules/ ${{ env.EXTENSION_DIR }}
cp -r scripts/ ${{ env.EXTENSION_DIR }}
cp -r styles/ ${{ env.EXTENSION_DIR }}

- name: Pack directory to zip
if: inputs.doNotPackZip != 'true'
uses: cardinalby/webext-buildtools-pack-extension-dir-action@28fdcac9860fb08555580587cab0d33afe4a341d
with:
extensionDir: ${{ env.EXTENSION_DIR }}
zipFilePath: ${{ env.ZIP_FILE_PATH }}
67 changes: 67 additions & 0 deletions .github/workflows/actions/get-zip-asset/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Assumes that:
# 1. the following env variables are set:
# - ZIP_ASSET_NAME
# - ZIP_FILE_PATH
# - ZIP_FILE_NAME
# - EXTENSION_DIR
# 2. repository checked out
# Effects:
# - extension.zip saved to env.ZIP_FILE_PATH
# - outputs.releaseUploadUrl is set if ref_type == 'tag' and release exists
# - extension.zip uploaded as build artifact to the job if it wasn't found in release

name: "Obtain extension.zip asset"
description: "Downloads zip asset from a release (if exists) or builds it from the scratch"
inputs:
githubToken:
description: GitHub token
required: true
outputs:
releaseUploadUrl:
description: Release upload url, if exists
value: ${{ steps.getRelease.outputs.upload_url }}
runs:
using: "composite"
steps:
- name: Get release
id: getRelease
if: github.ref_type == 'tag'
uses: cardinalby/git-get-release-action@cedef2faf69cb7c55b285bad07688d04430b7ada
env:
GITHUB_TOKEN: ${{ inputs.githubToken }}
with:
tag: ${{ github.ref_name }}
doNotFailIfNotFound: true

- name: Find out zip asset id from assets JSON
if: steps.getRelease.outputs.assets
id: readAssetIdFromRelease
uses: cardinalby/js-eval-action@b34865f1d9cfdf35356013627474857cfe0d5091
env:
ASSETS_JSON: ${{ steps.getRelease.outputs.assets }}
ASSET_NAME: ${{ env.ZIP_ASSET_NAME }}
with:
expression: |
JSON.parse(env.ASSETS_JSON)
.find(asset => asset.name == env.ZIP_ASSET_NAME)?.id || ''

- name: Download found zip release asset
id: downloadZipAsset
if: steps.readAssetIdFromRelease.outputs.result
uses: cardinalby/download-release-asset-action@8fe4ec3a876fe25b72086c8de1faddfaeb6512ff
with:
token: ${{ inputs.githubToken }}
assetId: ${{ steps.readAssetIdFromRelease.outputs.result }}
targetPath: ${{ env.ZIP_FILE_PATH }}

- name: Build and pack zip
id: buildZip
if: steps.downloadZipAsset.outcome != 'success'
uses: ./.github/workflows/actions/build-test-pack

- name: Upload zip file artifact
if: steps.buildZip.outcome == 'success'
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: ${{ env.ZIP_FILE_NAME }}
path: ${{ env.ZIP_FILE_PATH }}
32 changes: 32 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and test
on:
pull_request:
push:
branches:
- 'main'
- 'dev'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: cardinalby/export-env-action@66657b34899a2d695434ed060d9f2215db9b4035
with:
envFile: './.github/workflows/constants.env'
expand: true

- name: Build, test and pack to zip
id: build
uses: ./.github/workflows/actions/build-test-pack
with:
# pack zip only for pull requests or workflow_dispatch events
doNotPackZip: ${{ github.event_name == 'push' && 'true' || 'false'}}

- name: Upload zip file artifact
if: github.event_name != 'push'
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: ${{ env.ZIP_FILE_NAME }}
path: ${{ env.ZIP_FILE_PATH }}
Comment on lines +11 to +32

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI about 1 month ago

The best way to fix the problem is to add a permissions block at the root of the workflow file (just under the name and prior to the on: block, or right after the on: block), specifying only the minimum permissions required. In most cases, contents: read is sufficient for build/test jobs. If all steps in this workflow only need to checkout code and upload artifacts, contents: read suffices. Add this block to the top of .github/workflows/build-and-test.yml. No other steps, methods, imports, or variable definitions are required.


Suggested changeset 1
.github/workflows/build-and-test.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -1,4 +1,6 @@
 name: Build and test
+permissions:
+  contents: read
 on:
   pull_request:
   push:
EOF
@@ -1,4 +1,6 @@
name: Build and test
permissions:
contents: read
on:
pull_request:
push:
Copilot is powered by AI and may make mistakes. Always verify output.
96 changes: 96 additions & 0 deletions .github/workflows/build-assets-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# On release published:
# - if no built extension.zip asset attached to release, does that
# - builds and attaches signed crx asset to release
# - builds and attaches signed xpi asset to release
name: Build release assets

on:
release:
# Creating draft releases will not trigger it
types: [published]
jobs:
# Find out asset id of existing extension.zip asset in a release or
# build and attach it to the release and use its asset id
ensure-zip:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
zipAssetId: |
${{ steps.getZipAssetId.outputs.result ||
steps.uploadZipAsset.outputs.id }}
steps:
- uses: actions/checkout@v4

- uses: cardinalby/export-env-action@66657b34899a2d695434ed060d9f2215db9b4035
with:
envFile: './.github/workflows/constants.env'
expand: true

- name: Find out "extension.zip" asset id from the release
id: getZipAssetId
uses: cardinalby/js-eval-action@b34865f1d9cfdf35356013627474857cfe0d5091
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ASSETS_URL: ${{ github.event.release.assets_url }}
ASSET_NAME: ${{ env.ZIP_FILE_NAME }}
with:
expression: |
(await octokit.request("GET " + env.ASSETS_URL)).data
.find(asset => asset.name == env.ASSET_NAME)?.id || ''

- name: Build, test and pack
if: '!steps.getZipAssetId.outputs.result'
id: buildPack
uses: ./.github/workflows/actions/build-test-pack

- name: Upload "extension.zip" asset to the release
id: uploadZipAsset
if: '!steps.getZipAssetId.outputs.result'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ZIP_FILE_PATH }}
asset_name: ${{ env.ZIP_FILE_NAME }}
asset_content_type: application/zip

build-signed-crx-asset:
needs: ensure-zip
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: cardinalby/export-env-action@66657b34899a2d695434ed060d9f2215db9b4035
with:
envFile: './.github/workflows/constants.env'
expand: true

- name: Download zip release asset
uses: cardinalby/download-release-asset-action@8fe4ec3a876fe25b72086c8de1faddfaeb6512ff
with:
token: ${{ secrets.GITHUB_TOKEN }}
assetId: ${{ needs.ensure-zip.outputs.zipAssetId }}
targetPath: ${{ env.ZIP_FILE_PATH }}

- name: Build offline crx
id: buildOfflineCrx
uses: cardinalby/webext-buildtools-chrome-crx-action@200e7173cbdb5acb91d381cf9f7a30080b025047
with:
zipFilePath: ${{ env.ZIP_FILE_PATH }}
crxFilePath: ${{ env.OFFLINE_CRX_FILE_PATH }}
privateKey: ${{ secrets.CHROME_CRX_PRIVATE_KEY }}

- name: Upload offline crx release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.OFFLINE_CRX_FILE_PATH }}
asset_name: ${{ env.OFFLINE_CRX_FILE_NAME }}
asset_content_type: application/x-chrome-extension

11 changes: 11 additions & 0 deletions .github/workflows/constants.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
EXTENSION_DIR=extension/
BUILD_DIR=build/

ZIP_FILE_NAME=extension.zip
ZIP_FILE_PATH=${BUILD_DIR}${ZIP_FILE_NAME}

WEBSTORE_CRX_FILE_NAME=extension.webstore.crx
WEBSTORE_CRX_FILE_PATH=${BUILD_DIR}${WEBSTORE_CRX_FILE_NAME}

OFFLINE_CRX_FILE_NAME=extension.offline.crx
OFFLINE_CRX_FILE_PATH=${BUILD_DIR}${OFFLINE_CRX_FILE_NAME}
14 changes: 14 additions & 0 deletions .github/workflows/google-refresh-token.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Google Refresh Token
on:
schedule:
- cron: '0 3 2 * *' # At 03:00 on day-of-month 2
workflow_dispatch:
jobs:
fetchToken:
runs-on: ubuntu-latest
steps:
- uses: cardinalby/google-api-fetch-token-action@24c99245e2a2494cc4c4b1037203d319a184b15b
with:
clientId: ${{ secrets.G_CLIENT_ID }}
clientSecret: ${{ secrets.G_CLIENT_SECRET }}
refreshToken: ${{ secrets.G_REFRESH_TOKEN }}
Comment on lines +8 to +14

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI about 1 month ago

To fix the problem, you need to add a permissions block to the workflow. Since the shown job only fetches a Google API token and does not interact with the GitHub API for creating/modifying content or PRs, it needs a minimal permissions grant—contents: read or possibly even none in some cases. The safest fix is to add permissions: contents: read at the workflow root, which will ensure the job token can only read repository contents and cannot perform any write operations. This block should be inserted just after the workflow name and before the on: key.


Suggested changeset 1
.github/workflows/google-refresh-token.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/google-refresh-token.yml b/.github/workflows/google-refresh-token.yml
--- a/.github/workflows/google-refresh-token.yml
+++ b/.github/workflows/google-refresh-token.yml
@@ -1,4 +1,6 @@
 name: Google Refresh Token
+permissions:
+  contents: read
 on:
   schedule:
     - cron:  '0 3 2 * *' # At 03:00 on day-of-month 2
EOF
@@ -1,4 +1,6 @@
name: Google Refresh Token
permissions:
contents: read
on:
schedule:
- cron: '0 3 2 * *' # At 03:00 on day-of-month 2
Copilot is powered by AI and may make mistakes. Always verify output.
59 changes: 59 additions & 0 deletions .github/workflows/pr_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: PR Branch Check

on:
# Using pull_request_target instead of pull_request for secure handling of fork PRs
pull_request_target:
# Only run on these PR events
types: [opened, synchronize, reopened]
# Only check PRs targeting these branches
branches:
- main
- master

permissions:
pull-requests: write
issues: write

jobs:
check-branch:
runs-on: ubuntu-latest
steps:
- name: Check and Comment on PR
# Only process fork PRs with specific branch conditions
# Must be a fork AND (source is main/master OR target is main/master)
if: |
github.event.pull_request.head.repo.fork == true &&
((github.event.pull_request.head.ref == 'main' || github.event.pull_request.head.ref == 'master') ||
(github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'master'))
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let message = '';

// Check if PR is targeting main/master
if (context.payload.pull_request.base.ref === 'main' || context.payload.pull_request.base.ref === 'master') {
message += '⚠️ PRs cannot target the main branch directly. If you are attempting to contribute code please PR to the dev branch.\n\n';
}

// Check if PR is from a fork's main/master branch
if (context.payload.pull_request.head.repo.fork &&
(context.payload.pull_request.head.ref === 'main' || context.payload.pull_request.head.ref === 'master')) {
message += '⚠️ This PR cannot be merged because it originates from your fork\'s main/master branch. If you are attempting to contribute code please PR from your dev branch or another non-main/master branch.\n\n';
}

message += '🔒 This PR will now be automatically closed due to the above rules.';

// Post the comment
await github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: message
});

// Close the PR
await github.rest.pulls.update({
...context.repo,
pull_number: context.issue.number,
state: 'closed'
});
Loading
Loading