Repository navigation
Publish shared community policies and read-only security drift audit #1
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
5 commits
Select commit
Hold shift + click to select a range
bb84273
chore: publish community policies and public baseline audit
Kvrnn 97bb8b0
fix: preserve drift audit evidence on API failures and verify public …
Kvrnn d3e30ff
test: cover audit API failures and rule parsing
Kvrnn f5d4cb5
fix: parse workflow YAML and preserve scheduled audit evidence
Kvrnn 7fe600b
fix: combine tag protections and use direct private reporting
Kvrnn 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # Default maintainer; reviews are advisory where a solo-maintainer exception applies. | ||
| * @Kvrnn |
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,32 @@ | ||
| name: Bug report | ||
| description: Report a reproducible problem without sensitive data. | ||
| body: | ||
| - type: markdown | ||
| attributes: | ||
| value: "For suspected vulnerabilities, follow SECURITY.md instead of opening a public issue. Never include credentials or customer data." | ||
| - type: input | ||
| id: version | ||
| attributes: | ||
| label: Version or commit | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: environment | ||
| attributes: | ||
| label: Environment | ||
| description: Relevant OS, runtime and installation method. Exclude private infrastructure details. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: reproduction | ||
| attributes: | ||
| label: Minimal reproduction | ||
| description: Use synthetic data and list the steps to reproduce. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: behavior | ||
| attributes: | ||
| label: Expected and actual behavior | ||
| validations: | ||
| required: true |
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,5 @@ | ||
| blank_issues_enabled: false | ||
| contact_links: | ||
| - name: Private security report | ||
| url: https://github.com/NightSquawk/.github/security/advisories/new | ||
| about: Follow the private reporting instructions; do not publish vulnerability details here. |
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,16 @@ | ||
| name: Feature request | ||
| description: Suggest an improvement and describe the need. | ||
| body: | ||
| - type: textarea | ||
| id: problem | ||
| attributes: | ||
| label: Problem to solve | ||
| description: Explain the use case without customer or personal information. | ||
| validations: | ||
| required: true | ||
| - type: textarea | ||
| id: proposal | ||
| attributes: | ||
| label: Proposed behavior and alternatives | ||
| validations: | ||
| required: true |
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,17 @@ | ||
| ## Change | ||
|
|
||
| Describe the problem, resulting behavior and any related issue. | ||
|
|
||
| ## Validation | ||
|
|
||
| List checks run and their results. Explain checks that could not run. | ||
|
|
||
| ## Compatibility and security | ||
|
|
||
| Describe breaking changes, migration steps, new dependencies, permission changes and security effects. Report undisclosed vulnerabilities privately before opening a public PR. | ||
|
|
||
| - [ ] I have authority to contribute the included work and have checked applicable repository contribution terms. | ||
| - [ ] I preserved required licenses and notices and identified new dependencies. | ||
| - [ ] I excluded secrets, customer data and private diagnostics. | ||
| - [ ] I updated documentation and added meaningful tests where appropriate. | ||
| - [ ] I disclosed material AI assistance and reviewed the resulting changes. |
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,12 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 5 | ||
| - package-ecosystem: pip | ||
| directory: /automation | ||
| schedule: | ||
| interval: weekly | ||
| open-pull-requests-limit: 5 |
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 @@ | ||
| name: Public repository baseline audit | ||
| on: | ||
| schedule: | ||
| - cron: '0 15 * * 1' | ||
| workflow_dispatch: | ||
| pull_request: | ||
| paths: | ||
| - automation/** | ||
| - .github/workflows/public-repo-drift.yml | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| audit: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Install pinned audit parser | ||
| run: python -m pip install --require-hashes -r automation/requirements.txt | ||
| - name: Check script syntax | ||
| run: python -m unittest discover -s automation -p "*_test.py" -v | ||
| - name: Verify read-only access to public audit targets | ||
| if: github.event_name == 'pull_request' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| gh api 'users/NightSquawk/repos?type=owner&per_page=100' --jq length | ||
| gh api repos/NightSquawk/mcp-core/rules/branches/v1.0.0 --jq length | ||
| gh api repos/Kvrnn/CodeTimer/rules/branches/main --jq length | ||
| gh api repos/Kvrnn/CodeTimer/git/trees/main --jq .sha | ||
| - name: Audit public baseline | ||
| if: github.event_name != 'pull_request' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
|
Kvrnn marked this conversation as resolved.
Resolved
|
||
| run: python automation/public_repo_drift.py --output "$RUNNER_TEMP/public-repo-drift.json" | ||
| - name: Upload audit evidence | ||
| if: always() && github.event_name != 'pull_request' | ||
| uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 | ||
| with: | ||
| name: public-repo-drift | ||
| path: ${{ runner.temp }}/public-repo-drift.json | ||
| retention-days: 30 | ||
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,11 @@ | ||
| # Community code of conduct | ||
|
|
||
| Treat contributors and users with respect. Welcome questions, give constructive feedback and discuss technical disagreements without personal attacks. | ||
|
|
||
| Harassment, threats, discriminatory abuse, sexual harassment, impersonation, spam, and publishing someone's private information are not acceptable. Do not pressure others to disclose personal information or continue an unwanted interaction. | ||
|
|
||
| This policy applies to repository issues, pull requests, discussions and other project-managed spaces, and when representing the project publicly. | ||
|
|
||
| Report concerns privately to hello@nightsquawk.tech with links and the information needed to assess the incident. Do not post private evidence publicly. If a report concerns a maintainer, identify that concern so it can be routed away from the subject where possible. A separate independent escalation contact is not currently designated. | ||
|
|
||
| Maintainers consider context, impact and repeated behavior. Responses may include a request to change behavior, content removal, a warning, temporary restrictions or exclusion. Reports are handled with discretion, but absolute confidentiality cannot be guaranteed. Good-faith reports must not lead to retaliation. |
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,23 @@ | ||
| # Contributing | ||
|
|
||
| Thank you for helping improve the project. Start with its README, existing issues and repository-specific development instructions. For substantial changes, discuss the approach in an issue before implementation. Report vulnerabilities through SECURITY.md rather than a public issue. | ||
|
|
||
| ## Issues | ||
|
|
||
| Describe the problem, affected version, environment, expected result and a minimal reproduction. Use synthetic data and remove credentials, personal information and internal infrastructure details. Search for an existing report before opening a duplicate. | ||
|
|
||
| ## Pull requests | ||
|
|
||
| 1. Create a focused branch from the repository's documented contribution base. Its default branch may be named differently from main. | ||
| 2. Follow the project's installation and development instructions. Run its applicable build, formatting, lint, type and test checks. State which checks ran and any that could not run. | ||
| 3. Explain the behavior change, compatibility impact and relevant issue. Add meaningful tests for behavior changes and update user documentation where needed. | ||
| 4. Preserve license headers, attribution and third-party notices. Discuss new dependencies and their licenses. Keep generated artifacts consistent with the project's existing conventions. | ||
| 5. Submit a focused PR and respond to review. Do not include unrelated changes, live secrets, customer data or unlicensed copied material. Disclose material AI assistance and verify the resulting code and its provenance yourself. | ||
|
|
||
| ## Contribution rights | ||
|
|
||
| The affected repository's license and any applicable contributor agreement govern contributions. Submit only work you are authorized to contribute, including any required employer permission. This shared guide does not grant software usage rights or change an existing license. | ||
|
|
||
| Projects using separate personal and commercial licenses may require an additional contributor agreement before acceptance. Maintainers must publish that agreement and its acceptance process before accepting contributions that depend on additional commercial licensing rights. A PR checklist or sign-off alone does not establish those rights. | ||
|
|
||
| Follow CODE_OF_CONDUCT.md in project interactions. Community review and support are provided as maintainer availability permits. |
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,17 @@ | ||
| # Security policy | ||
|
|
||
| Please report suspected vulnerabilities privately. Do not include exploit details, credentials, personal information or client data in public issues or pull requests. | ||
|
|
||
| ## Reporting | ||
|
|
||
| Use **Security → Advisories → Report a vulnerability** in the affected repository when available. If that route is unavailable, use the [central private reporting form](https://github.com/NightSquawk/.github/security/advisories/new) and identify the affected repository. Do not include live credentials or personal data. | ||
|
|
||
| Include reproduction steps using a test environment, expected and actual behavior, impact, and any proposed fix. Use synthetic examples and redact secrets. Do not access others' data, disrupt services or test systems without authorization. | ||
|
|
||
| ## Supported versions | ||
|
|
||
| Follow the affected project's documented support policy. Where no release support table exists, maintainers assess reports against the current default branch and latest release; this does not promise maintenance of older versions. Upstream projects may have separate reporting and support policies. | ||
|
|
||
| ## Handling and disclosure | ||
|
|
||
| Maintainers assess scope and impact, coordinate remediation and discuss disclosure timing with the reporter. Security fixes may be developed privately before a public advisory or release. We do not promise a fixed response time, bounty or legal authorization to test third-party systems. |
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,7 @@ | ||
| # Support | ||
|
|
||
| Read the project's README, documentation and existing issues first. For reproducible bugs or feature requests, use the affected repository's issue templates when available. For general questions, use its Discussions area if enabled; otherwise follow its README support instructions. | ||
|
|
||
| Community help is provided as maintainers are available and does not include a response-time commitment. For paid support or commercial licensing inquiries, contact hello@nightsquawk.tech. A paid software license includes only the support expressly stated in its agreement. | ||
|
|
||
| Use SECURITY.md to report suspected vulnerabilities privately. Never post live credentials, personal information, customer data or unredacted diagnostic bundles in public support requests. |
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,113 @@ | ||
| #!/usr/bin/env python3 | ||
| """Read-only public repository baseline audit; no credentials or alert payloads emitted.""" | ||
| import argparse, base64, concurrent.futures, datetime, json, re, subprocess | ||
| from pathlib import Path | ||
| from urllib.parse import quote | ||
| import yaml | ||
|
|
||
| def action_references(body): | ||
| workflow=yaml.safe_load(body) | ||
| if not isinstance(workflow,dict):return [] | ||
| refs=[] | ||
| for job in workflow.get('jobs',{}).values(): | ||
| if not isinstance(job,dict):continue | ||
| if isinstance(job.get('uses'),str):refs.append(job['uses']) | ||
| for step in job.get('steps',[]): | ||
| if isinstance(step,dict) and isinstance(step.get('uses'),str):refs.append(step['uses']) | ||
| return refs | ||
|
|
||
| def may_exclude_version_tags(pattern): | ||
| if pattern=='~ALL':return True | ||
| literal=re.split(r'[*?\[]',pattern,maxsplit=1)[0] | ||
| version_prefix='refs/tags/v' | ||
| return version_prefix.startswith(literal) or literal.startswith(version_prefix) | ||
|
|
||
| def api(path,paginate=False): | ||
| args=['gh','api',path] | ||
| if paginate:args+=['--paginate','--slurp'] | ||
| try: | ||
| p=subprocess.run(args,capture_output=True,text=True,timeout=60) | ||
| except subprocess.TimeoutExpired: | ||
| return {'unavailable':'timeout'} | ||
| except OSError: | ||
| return {'unavailable':'client-unavailable'} | ||
| if p.returncode: | ||
| match=re.search(r'HTTP (\d+)',p.stderr) | ||
| return {'unavailable':match.group(1) if match else 'request-failed'} | ||
| try:value=json.loads(p.stdout) | ||
| except json.JSONDecodeError:return {'unavailable':'invalid-response'} | ||
| return [v for page in value for v in page] if paginate and isinstance(value,list) else value | ||
|
|
||
| def audit(repo): | ||
| name=repo['full_name'];branch=repo['default_branch'];root='repos/'+name | ||
| result={'repository':name,'default_branch':branch,'drift':[],'unknown':[]} | ||
| rules=api(root+'/rules/branches/'+quote(branch,safe='')) | ||
| if isinstance(rules,list): | ||
| types={r['type'] for r in rules} | ||
| for required in ['deletion','non_fast_forward','pull_request']: | ||
| if required not in types:result['drift'].append('missing-default-rule:'+required) | ||
| if not any(r.get('type')=='pull_request' and r.get('parameters',{}).get('required_review_thread_resolution') for r in rules): | ||
| result['drift'].append('unresolved-review-threads-permitted') | ||
| else:result['unknown'].append('effective-branch-rules:'+rules['unavailable']) | ||
| sets=api(root+'/rulesets?includes_parents=true&per_page=100',True) | ||
| if isinstance(sets,list): | ||
| tag_sets=[s for s in sets if s.get('target')=='tag' and s.get('enforcement')=='active'] | ||
| effective_tag_rules=set() | ||
| uncertain_tag_conditions=False | ||
| for ruleset in tag_sets: | ||
| detail=api(root+'/rulesets/'+str(ruleset['id'])) | ||
| if 'unavailable' in detail: | ||
| result['unknown'].append('tag-ruleset:'+detail['unavailable']);continue | ||
| included=detail.get('conditions',{}).get('ref_name',{}).get('include',[]) | ||
| excluded=detail.get('conditions',{}).get('ref_name',{}).get('exclude',[]) | ||
| types={r['type'] for r in detail.get('rules',[])} | ||
| covers_versions=any(p in included for p in ['refs/tags/v*','refs/tags/*','refs/tags/**','~ALL']) | ||
| if covers_versions: | ||
| if any(may_exclude_version_tags(p) for p in excluded): | ||
| uncertain_tag_conditions=True | ||
| else:effective_tag_rules.update(types) | ||
| if not {'update','deletion'}<=effective_tag_rules: | ||
| if uncertain_tag_conditions:result['unknown'].append('version-tag-exclusions-need-review') | ||
| else:result['drift'].append('missing-version-tag-protection') | ||
| else:result['unknown'].append('tag-rulesets:'+sets['unavailable']) | ||
| tree=api(root+'/git/trees/'+quote(branch,safe='')+'?recursive=1') | ||
| if tree.get('truncated') or 'unavailable' in tree: | ||
| result['unknown'].append('workflow-tree-unavailable-or-truncated') | ||
| else: | ||
| for entry in tree.get('tree',[]): | ||
| path=entry['path'] | ||
| if entry.get('type')!='blob' or not path.startswith('.github/workflows/') or not path.endswith(('.yml','.yaml')):continue | ||
| blob=api(root+'/git/blobs/'+entry['sha']) | ||
| if 'unavailable' in blob: | ||
| result['unknown'].append('workflow-read:'+path);continue | ||
| body=base64.b64decode(blob.get('content','')).decode() | ||
| try:references=action_references(body) | ||
| except yaml.YAMLError: | ||
| result['unknown'].append('invalid-workflow-yaml:'+path);continue | ||
| for action in references: | ||
| if action.startswith(('./','docker://')):continue | ||
| if not re.search(r'@[0-9a-f]{40}$',action):result['drift'].append('unpinned-workflow-reference:'+path) | ||
| return result | ||
|
|
||
| def main(): | ||
| p=argparse.ArgumentParser(description=__doc__) | ||
| p.add_argument('--owners',nargs='+',default=['NightSquawk','Kvrnn']) | ||
| p.add_argument('--output',default='public-repo-drift.json') | ||
| args=p.parse_args();inventory=[];errors=[] | ||
| for owner in args.owners: | ||
| data=api('users/'+owner+'/repos?type=owner&per_page=100',True) | ||
| if not isinstance(data,list):errors.append(owner+':'+data['unavailable']);continue | ||
| inventory.extend(r for r in data if not r.get('private') and not r.get('archived') and r['owner']['login'].lower()==owner.lower()) | ||
| def guarded_audit(repo): | ||
| try:return audit(repo) | ||
| except Exception: | ||
| return {'repository':repo['full_name'],'default_branch':repo['default_branch'],'drift':[],'unknown':['audit-error']} | ||
| with concurrent.futures.ThreadPoolExecutor(max_workers=4) as pool:results=list(pool.map(guarded_audit,inventory)) | ||
| report={'observed_at_utc':datetime.datetime.now(datetime.timezone.utc).isoformat(),'scope':'Active public repositories; default-branch rules, version-tag rules and workflow SHA references only. Security feature/admin settings need an administrator audit.','inventory_errors':errors,'repositories':results} | ||
| Path(args.output).write_text(json.dumps(report,indent=2)+'\n') | ||
| for r in results:print(r['repository']+': '+str(len(r['drift']))+' drift, '+str(len(r['unknown']))+' unknown') | ||
| failed=bool(errors or any(r['drift'] or r['unknown'] for r in results)) | ||
| print('Baseline audit '+('requires attention' if failed else 'passed')+'; no settings were changed.') | ||
| return int(failed) | ||
|
|
||
| if __name__=='__main__':raise SystemExit(main()) |
Oops, something went wrong.
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.