Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
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
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
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
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
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.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
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
17 changes: 17 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
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.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
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
47 changes: 47 additions & 0 deletions .github/workflows/public-repo-drift.yml
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
Comment thread
Kvrnn marked this conversation as resolved.
Resolved
- name: Audit public baseline
if: github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
Comment thread
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
11 changes: 11 additions & 0 deletions CODE_OF_CONDUCT.md
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.
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
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.
17 changes: 17 additions & 0 deletions SECURITY.md
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.
7 changes: 7 additions & 0 deletions SUPPORT.md
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.
113 changes: 113 additions & 0 deletions automation/public_repo_drift.py
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())
Loading
Loading