Skip to content

docs: add baseline security audit for Workstream 4 - #329

Open
raaidrushdy wants to merge 3 commits into
mainfrom
sec/baseline-audit-week4
Open

docs: add baseline security audit for Workstream 4#329
raaidrushdy wants to merge 3 commits into
mainfrom
sec/baseline-audit-week4

Conversation

@raaidrushdy

Copy link
Copy Markdown
Contributor

Summary

Adds a baseline security audit document for Workstream 4 (Secrets and Identity, lead) and part of Workstream 1 (CI Architecture, secondary). This is an audit-only PR, with no code or config changes, documenting the current state of the repo so implementation PRs later this trimester have something concrete to reference and measure against.

Type of Change

  • Documentation
  • Security

Affected Components

  • /docs

Motivation

Per the DevSecOps workstream plan, Weeks 4–5 are audit-only: each owner reviews their area and produces a shared baseline before any fixes land. This covers Planner task 26T2-SEC-RR-001. Findings include hardcoded credentials in docker-compose.yml (with exact line numbers), tracked repo hygiene issues (.DS_Store, output.json), workflows missing top-level permissions blocks, and a gap in secret scanning coverage, including a critical finding (full history gitleaks scan) of a live GCP service account private key in engine/test-sa-key.json, which is flagged as the most urgent outstanding item from this audit.

Testing Done

  • No tests required — explain why: this is a markdown-only documentation change; no code or config was modified.

Security Considerations

This PR documents existing security issues; it does not fix them or introduce new exposure. The credential values referenced in section 1 (e.g. the docker-compose.yml SECRET_KEY/ENCRYPTION_KEY) are already present in the repo's committed history; this doc doesn't expose anything that wasn't already there. The full gitleaks scan output (which does contain raw key material for some findings) is intentionally not included in this PR or the doc; only summary counts are referenced. The critical private-key finding (section 4a) has not yet been escalated for revocation; this is the most urgent outstanding item from this audit and needs to happen independently of this PR's review cycle, not gated on it.

Breaking Changes

  • No breaking changes

Rollback Plan

  • Revert commit is sufficient

Checklist

  • Code follows project conventions
  • No secrets, credentials, or tokens committed
  • Relevant documentation updated (if applicable)
  • CI/CD workflows pass on this branch
  • PR is focused on one thing

@raaidrushdy
raaidrushdy requested a review from a team as a code owner August 16, 2026 13:44
@github-actions

Copy link
Copy Markdown
Contributor

Preview Environment

A preview environment can be spun up on demand for this PR.

Action Label Includes
Spin up preview deploy-preview Frontend, backend, database, Redis, OPA, worker
Spin up preview with M365 deploy-preview-m365 Everything above + PowerShell service for Exchange/Teams scan testing
Tear down preview teardown-preview Stops the environment early

The environment will also be torn down automatically when the PR is closed or merged.
Preview URLs will appear in a follow-up comment once the deploy completes (~5–8 min).
M365 scans require real tenant credentials added through the frontend UI.

@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: e85a14b71b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/DevSecOps/baseline-audit.md Outdated

## 4a. Critical finding — live GCP service account private key in history

`engine/test-sa-key.json`, added in commit `4fe952c` (2025-09-03, "added code in collecter to extract compute networks config"), contains a full unencrypted RSA private key for a GCP service account. Unlike the docker-compose credentials, this isn't a placeholder — it's a real key that's been sitting in a public repo for close to a year. I escalated this out-of-band on 2026-08-16 for immediate revocation in GCP IAM, rather than waiting on the normal PR review cycle, since a public repo means the key can't be assumed uncompromised just because nothing's happened yet.

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 Correct the unperformed key escalation status

The commit's own Security Considerations states that this private-key finding has not yet been escalated, while the audit records that escalation as completed. For a potentially active GCP credential, this contradictory status can cause responders to assume revocation is already underway and leave the key enabled; either perform and verify the escalation before making this claim or record it as outstanding.

Useful? React with 👍 / 👎.

Comment thread docs/DevSecOps/baseline-audit.md Outdated

- **Line 32** — `POSTGRES_PASSWORD: autoaudit_dev_password`. It has a `# pragma: allowlist secret` comment next to it, which tells detect-secrets to ignore it, so it won't get flagged even though it's a real password sitting in the file.
- **Line 107** — `SECRET_KEY=dev-secret-key-change-in-production`. This is the JWT signing key for backend-api.
- **Line 126** — `ENCRYPTION_KEY=Ps-HiS3ww5QzQPc_Mdu5-JyA_jCNbdFHMdiwWSlAfgM=`. This one's worse than the other two because it's not a placeholder — it's an actual Fernet key currently being used to encrypt stored M365/AWS/Azure/GCP credentials. It's also repeated on **line 166** in the worker service, since both services need the same key to decrypt the same data.

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 Redact the Fernet key from the audit

This line commits another verbatim copy of the value that the audit identifies as a non-placeholder key currently used for credential encryption. Even though the value already exists in docker-compose.yml, duplicating it in a new blob expands the secret's footprint and means removing or history-rewriting the compose occurrence will still leave the key exposed here; identify the location without reproducing the key.

Useful? React with 👍 / 👎.

Comment on lines +21 to +23
Checked all 15 workflow files under `.github/workflows` for a top-level `permissions:` block. Seven don't have one, which means they're running with whatever the default token permissions are instead of something explicit and minimal:

`ci.backend-api.yml`, `ci.engine.yml`, `ci.frontend.yml`, `ci.security.yml`, `ci.validate-alerts.yml`, `ops.collector.yml`, `ops.short-test.yml`

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 Account for job-level workflow permissions

Absence of a top-level block does not mean every listed workflow uses the repository defaults: in the inspected ops.collector.yml, its only job explicitly grants only contents: write, and the four listed CI workflows also define permissions on their analysis and reporting jobs. The audit therefore conflates top-level and effective job permissions; distinguish jobs that actually inherit defaults so subsequent hardening targets the real gaps.

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.

1 participant