Skip to content

Commit

Permalink
added git directory exclusion logic
Browse files Browse the repository at this point in the history
  • Loading branch information
raianand committed Sep 6, 2024
1 parent 3a8cfc5 commit 9c3ee09
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions src/audit_summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,15 @@ async function getBuildEnvironmentTamperingActions() {
}

async function checkForBuildTampering() {
const workingDir = process.env.GITHUB_WORKSPACE
const gitDir = path.join(workingDir, '.git')
const absPathGitDir = path.resolve(gitDir)
const audit = await generateTestResults('audit.json')

const processChangingSourceFiles = audit.filter(
a =>
a.tags?.includes('bolt_monitored_wd_changes') &&
a.summary?.action === 'opened-file'
(a.summary?.action === 'opened-file' || a.summary?.action === 'renamed')
)

const filePIDMap = {}
Expand All @@ -94,9 +97,6 @@ async function checkForBuildTampering() {
const cwd = log.process?.cwd
const filePath = log.file?.path

console.log(filePath)
console.log(log)

if (!filePath || !cwd || !pid) {
continue
}
Expand All @@ -106,6 +106,12 @@ async function checkForBuildTampering() {
? filePath
: path.join(cwd, filePath)

const absPath = path.resolve(fullFilePath)

if (absPath.startsWith(absPathGitDir)) {
continue
}

if (pid && fullFilePath) {
if (!filePIDMap[fullFilePath]) {
filePIDMap[fullFilePath] = []
Expand Down
4 changes: 1 addition & 3 deletions src/scripts/audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ mv audit.rules /etc/audit/rules.d/
# Restart auditd service to apply the new rules
service auditd restart

auditctl -a never,exit -F "dir=$workingDir/.git"

auditctl -w "$workingDir" -p wa -k bolt_monitored_wd_changes

# auditctl -e 2
auditctl -e 2
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const releaseVersion = 'v1.7.0-rc.13'
const releaseVersion = 'v1.7.0-rc.14'

module.exports = {
releaseVersion
Expand Down

0 comments on commit 9c3ee09

Please sign in to comment.