Skip to content

fix(baseline): recognize lowercase license and security policy file names - #730

Open
Daniel-park10 wants to merge 1 commit into
darnitdevorg:mainfrom
Daniel-park10:fix/license-security-lowercase-files
Open

Daniel-park10 wants to merge 1 commit into
darnitdevorg:mainfrom
Daniel-park10:fix/license-security-lowercase-files

Conversation

@Daniel-park10

Copy link
Copy Markdown
Contributor

Summary

GitHub recognizes lowercase filename conventions across repositories (such as license, licence, copying, and .github/security.md). On repositories using lowercase naming like sindresorhus/slash, darnit currently fails license and security checks because locators, pattern matchers, and auto-detection functions only search for uppercase variants (LICENSE, SECURITY.md, etc.).

This PR adds lowercase filenames and standard path variants (.github/security.md, docs/security.md) across baseline license and security controls, hint sources, and detect_license_type(). It also adds regression tests covering all casing and directory combinations, including the exact sindresorhus/slash layout.

Fixes #717

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)

Framework Changes Checklist

If this PR modifies the darnit framework (packages/darnit/):

  • Updated framework spec (docs/architecture/framework-design.md) if behavior changed
  • Ran uv run python scripts/validate_sync.py --verbose and it passes

Control/TOML Changes Checklist

If this PR modifies controls or TOML configuration:

  • Control metadata defined in TOML (not Python code)
  • SARIF fields (description, severity, help_url) included where appropriate
  • Ran validation to confirm TOML schema compliance

Testing

  • Tests pass locally (uv run pytest tests/ -v)
  • Added tests for new functionality (if applicable)
  • Linting passes (uv run ruff check .)

AI assistance

  • No AI assistance was used
  • AI assistance was used

Additional Notes

None.

…ames (fixes darnitdevorg#717)

- Add lowercase file variants to discover in OSPS-LE-01.01 and OSPS-LE-03.01
- Add lowercase and uppercase globs to OSPS-LE-02.01 regex pass
- Add lowercase and directory variants to OSPS-VM-01.01, OSPS-VM-02.01, OSPS-VM-03.01, OSPS-VM-04.02, OSPS-VM-05.01, OSPS-VM-06.01, OSPS-BR-07.02, OSPS-SA-03.01, STAGE1-REF-SECURITY-01, and context.security_contact
- Update detect_license_type() in auto_detect to recognize lowercase license files
- Update FIELD_FILE_LOCATIONS in test_project_reference.py
- Add regression tests covering all casing and directory variants, including sindresorhus/slash repository layout

Signed-off-by: Daniel-park10 <dev10.tennyson@gmail.com>
@Daniel-park10
Daniel-park10 force-pushed the fix/license-security-lowercase-files branch from bcd79f4 to d7ca0ec Compare November 7, 2026 11:13
@Marc-cn

Marc-cn commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

CI failure is the feature-036 golden, not the change: tests/darnit/fixtures/error_class_baseline/baseline.md snapshots an audit of a repo without a license, and OSPS-LE-03.01's 'None of the required files found' line now lists the lowercase names too. Please run uv run python tests/darnit/fixtures/error_class_baseline/capture_baseline.py and commit the three regenerated files (md, json, sarif) — the baseline was refreshed the same way in #552 and #603 for intentional message changes, and nothing here touches error_class. Checked on the VM: with the regenerated gold, context + controls + sieve + happy-path tests pass (837). Follow-up, not for this PR: listing the directory and matching case-insensitively would cover Security.md / License.MD and every other spelling in one place, instead of growing these lists.

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.

License and security checks miss lowercase file names GitHub recognizes

2 participants