-
Notifications
You must be signed in to change notification settings - Fork 0
Security hardening: demo fix, overflow guard, SECURITY.md, CodeQL, CI pinning #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
934ecfc
fix(demo): theme the xterm viewport background to remove the black ba…
Alpaq92 e80f184
fix(security): guard against 32-bit overflow when sizing ciphertext b…
Alpaq92 9b9da50
feat(security): add SECURITY.md, CodeQL scanning, and CI least-privil…
Alpaq92 7244aaa
fix(security): address CodeQL workflow review feedback
Alpaq92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: CodeQL | ||
|
|
||
| # Static analysis for the C# surface of this repo — runs on every push/PR to | ||
| # master plus a weekly schedule, so newly-added CodeQL query patterns get a | ||
| # chance to flag existing code, not just new diffs. | ||
| # | ||
| # Scoped to net10.0 on ubuntu-latest via CI_TFMS (the same mechanism | ||
| # ci.yml's ubuntu leg uses): CodeQL needs one successful build to extract | ||
| # from, and the platform TFMs (ios/android/macos/browser) need workloads | ||
| # and runners this leg doesn't have — build-platform-tfms.yml and | ||
| # release.yml already compile-check those separately. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
| schedule: | ||
| - cron: '24 3 * * 1' # weekly, Monday 03:24 UTC | ||
|
|
||
| concurrency: | ||
| group: codeql-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| analyze: | ||
| name: Analyze (C#) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 20 | ||
| # Job-level permissions replace (not merge with) any workflow-level | ||
| # block, so both grants live here even though only one job exists — | ||
| # scoping them to the job that actually needs them, not the workflow. | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| env: | ||
| CI_TFMS: net10.0 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5 | ||
|
|
||
| - name: Initialize CodeQL | ||
| uses: github/codeql-action/init@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v4 | ||
| with: | ||
| languages: csharp | ||
|
|
||
| - name: Restore | ||
| run: dotnet restore | ||
|
|
||
| - name: Build | ||
| run: dotnet build TopSecret.ProtectedString.sln --configuration Release --no-restore | ||
|
|
||
| - name: Perform CodeQL analysis | ||
| uses: github/codeql-action/analyze@54f647b7e1bb85c95cddabcd46b0c578ec92bc1a # v4 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Security Policy | ||
|
|
||
| ## Supported versions | ||
|
|
||
| Only the latest published version of each package (currently `2.x`) receives | ||
| security fixes. There is no LTS branch — given the release cadence, upgrading | ||
| is expected to be the fix. | ||
|
|
||
| ## Reporting a vulnerability | ||
|
|
||
| Please **do not open a public GitHub issue** for a suspected vulnerability — | ||
| in the memory-protection guarantees (secrets recoverable from a memory or | ||
| core dump, a key-wrapping tier not doing what it claims, a timing | ||
| side-channel in a comparison, a wipe that doesn't happen on some exit path) | ||
| or in the supply chain (a CI/release workflow that could be tricked into | ||
| running untrusted code or exfiltrating secrets). | ||
|
|
||
| Instead, use GitHub's private vulnerability reporting for this repository: | ||
| [Report a vulnerability](https://github.com/Alpaq92/TopSecret.ProtectedString/security/advisories/new). | ||
|
|
||
| Include, where you can: | ||
|
|
||
| - The affected package(s) and version. | ||
| - A description of the weakness and, if possible, a minimal repro. | ||
| - The platform/TFM it applies to, if platform-specific — this library's | ||
| security guarantees differ by key-at-rest tier; see the README's | ||
| [Security model](README.md#security-model) section. | ||
|
|
||
| ## Response | ||
|
|
||
| This is a solo-maintained project with no formal SLA. Reports are triaged | ||
| and acknowledged as soon as reasonably possible, and a confirmed | ||
| vulnerability is prioritized over new feature work. | ||
|
|
||
| ## Scope | ||
|
|
||
| **In scope:** the packages in this repository (`TopSecret.ProtectedString`, | ||
| `TopSecret.ProtectedBlob`, the TPM/Configuration satellites, and the Roslyn | ||
| analyzer) and the GitHub Actions workflows that build, test, and release | ||
| them. | ||
|
|
||
| **Out of scope:** the demo apps (`TopSecret.Demo`, `TopSecret.Demo.Wasm`) | ||
| except where a demo bug points at a real library issue, and anything already | ||
| documented as a known, deliberate limitation in the README's | ||
| ["What this library does **not** do"](README.md#what-this-library-does-not-do-and-why) | ||
| section — those are accepted trade-offs, not vulnerabilities, unless you can | ||
| show the trade-off is worse in practice than documented. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.