Skip to content

paiml/responsible-ai-dev

Repository files navigation

Responsible AI Development Tools

CI Status License

A collection of static analysis tools for validating AI-generated code and detecting security vulnerabilities. These tools help ensure code quality, security, and best practices in AI-assisted development workflows.

🎯 Overview

This repository contains four specialized tools for code analysis and security scanning:

  1. flaw-detector - Detects import violations and unreachable code
  2. security - Finds SQL injection and hardcoded credentials
  3. challenge - Scans for leaked AWS and OpenAI API keys
  4. validation - Example code demonstrating TypeScript validation

πŸ“¦ Installation

Prerequisites

  • Deno 1.x or higher (installation guide)
  • Make (standard on Linux/macOS, use WSL on Windows)
  • Git for version control

Install Deno

# macOS/Linux
curl -fsSL https://deno.land/install.sh | sh

# Windows (PowerShell)
irm https://deno.land/install.ps1 | iex

# Verify installation
deno --version

Clone the Repository

git clone https://github.com/paiml/responsible-ai-dev.git
cd responsible-ai-dev

# Verify setup
make help

πŸš€ Quick Start

Run All Quality Checks

# Run all linting, type checks, and tests
make validate

# Run individual checks
make lint      # Lint all projects
make check     # Type check all projects
make test      # Run all tests
make coverage  # Generate coverage reports

Run Individual Tools

Each tool is self-contained with its own README and Makefile:

# Run any tool
cd flaw-detector
make all          # Run tests, linting, and coverage
make run          # Scan current directory

# Same pattern for all tools
cd security && make all
cd challenge && make all

Project-Specific Targets

# Run tests for a specific project
make challenge-test
make security-lint
make flaw-detector-coverage

# Build executable binaries
make build

Usage

This section provides detailed usage instructions for each tool in the repository.

Command-Line Interface

All tools support a common CLI pattern:

# General pattern
deno run --allow-read <tool>.ts <directory>

# Or use compiled binaries
make build
./<project>/<tool_name> <directory>

Scan for Security Issues

# Scan for SQL injection and hardcoded credentials
cd security
make run

# Scan for leaked API keys
cd challenge
make run

# Detect code flaws
cd flaw-detector
make run

Generate Coverage Reports

# Generate coverage for all projects
make coverage

# View HTML coverage report
deno coverage challenge/cov_profile --html

πŸ—οΈ Project Structure

responsible-ai-dev/
β”œβ”€β”€ challenge/           # Secret scanner for API keys
β”‚   β”œβ”€β”€ secret_scanner.ts
β”‚   β”œβ”€β”€ secret_scanner_test.ts
β”‚   β”œβ”€β”€ Makefile
β”‚   └── README.md
β”œβ”€β”€ flaw-detector/       # Code flaw detector
β”‚   β”œβ”€β”€ flaw_detector.ts
β”‚   β”œβ”€β”€ flaw_detector_test.ts
β”‚   β”œβ”€β”€ Makefile
β”‚   └── README.md
β”œβ”€β”€ security/            # Security scanner
β”‚   β”œβ”€β”€ security_scanner.ts
β”‚   β”œβ”€β”€ security_scanner_test.ts
β”‚   β”œβ”€β”€ Makefile
β”‚   └── README.md
β”œβ”€β”€ validation/          # Validation examples
β”‚   β”œβ”€β”€ validating_code.ts
β”‚   β”œβ”€β”€ Makefile
β”‚   └── README.md
β”œβ”€β”€ .github/workflows/   # CI/CD pipelines
β”œβ”€β”€ Makefile             # Root Makefile (orchestrates all projects)
└── README.md            # This file

πŸ”§ Development

Running Tests

# Run all tests
make test

# Run fast tests only (<5 min)
make test-fast

# Run project-specific tests
make challenge-test

Code Quality

# Run all quality gates
make validate

# Individual checks
make lint              # Deno lint + bashrs
make check             # TypeScript type checking
make coverage          # Coverage reports

Building Executables

# Build all projects
make build

# Build specific project
make challenge-build

Contributing

We welcome contributions from everyone! This project follows a comprehensive contribution workflow to ensure quality and consistency.

How to Contribute

  1. Fork the repository on GitHub
  2. Clone your fork locally:
    git clone https://github.com/YOUR_USERNAME/responsible-ai-dev.git
    cd responsible-ai-dev
  3. Create a feature branch:
    git checkout -b feature/amazing-feature
  4. Make your changes and ensure all tests pass:
    make validate  # Runs lint, check, test, coverage
  5. Commit your changes with a descriptive message:
    git commit -m 'Add amazing feature: detailed description'
  6. Push to your fork:
    git push origin feature/amazing-feature
  7. Open a Pull Request on GitHub with a clear description

Contribution Guidelines

Code Quality Requirements

  • βœ… All code must pass make validate (lint, type-check, tests, coverage)
  • βœ… Maintain or improve test coverage (target: 70%+ minimum)
  • βœ… Add comprehensive tests for new features
  • βœ… Update documentation as needed
  • βœ… Follow existing code style (enforced by deno fmt)
  • βœ… Keep commits atomic and well-described
  • βœ… No breaking changes without discussion

Testing Requirements

  • Write unit tests for all new functions
  • Include integration tests for new features
  • Test edge cases and error conditions
  • Run make test before committing
  • Ensure coverage doesn't decrease

Documentation Requirements

  • Update README.md for user-facing changes
  • Add inline code comments for complex logic
  • Update tool-specific READMEs in each directory
  • Include usage examples for new features

Pull Request Process

  1. Ensure all CI checks pass (GitHub Actions will run automatically)
  2. Request review from maintainers
  3. Address review feedback promptly
  4. Squash commits if requested
  5. Keep PR focused on a single feature/fix

Reporting Issues

Found a bug or have a feature request?

  1. Check existing issues to avoid duplicates
  2. Create a new issue with:
    • Clear, descriptive title
    • Steps to reproduce (for bugs)
    • Expected vs actual behavior
    • Environment details (Deno version, OS)
    • Code samples if applicable

Development Setup

# Install dependencies
make install

# Run tests
make test

# Run linting
make lint

# Generate coverage
make coverage

# Run all quality checks
make validate

Code of Conduct

  • Be respectful and inclusive
  • Provide constructive feedback
  • Focus on the code, not the person
  • Help others learn and grow
  • Follow the project's coding standards

Questions?

πŸ“‹ Quality Standards

This project follows strict quality standards:

  • βœ… Linting: Deno lint + bashrs for Makefiles
  • βœ… Type Safety: Full TypeScript type checking
  • βœ… Testing: Comprehensive test coverage (target: 70%+)
  • βœ… CI/CD: Automated testing on all PRs and commits
  • βœ… Security: Regular secret scanning and vulnerability checks

Quality Metrics

  • Repository Score: Run make repo-score to see current health metrics
  • Test Coverage: Run make coverage to generate coverage reports
  • CI Status: All tests must pass before merging

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2025 PAIML

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

πŸ™ Acknowledgments

  • Built with Deno for secure TypeScript execution
  • Quality enforcement powered by PMAT
  • Makefile linting via bashrs

πŸ“ž Support

  • Issues: Report bugs via GitHub Issues
  • Discussions: Join conversations in GitHub Discussions
  • Documentation: See individual tool READMEs for detailed usage

Made with ❀️ by the PAIML Team

About

Responsible AI Development with GitHub Copilot Course

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors