{"id":19861190,"url":"https://github.com/paractmol/cuttable","last_synced_at":"2025-02-28T22:45:06.473Z","repository":{"id":62556593,"uuid":"117119303","full_name":"paractmol/cuttable","owner":"paractmol","description":"Escape SQL injection when you order with params","archived":false,"fork":false,"pushed_at":"2018-01-12T10:22:07.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T13:51:18.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paractmol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-11T15:49:53.000Z","updated_at":"2018-01-11T15:52:27.000Z","dependencies_parsed_at":"2022-11-03T06:15:18.924Z","dependency_job_id":null,"html_url":"https://github.com/paractmol/cuttable","commit_stats":null,"previous_names":["rudkovskyi/cuttable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Fcuttable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Fcuttable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Fcuttable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Fcuttable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paractmol","download_url":"https://codeload.github.com/paractmol/cuttable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241263404,"owners_count":19936057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T15:08:16.393Z","updated_at":"2025-02-28T22:45:06.446Z","avatar_url":"https://github.com/paractmol.png","language":"Ruby","readme":"# cuttable\nEscape SQL injection when you order with params\n\n## Getting started\n\n1. Add inside your Gemfile\n\n       gem 'cuttable'\n\n\n2. Include concern and execute default_order to set default order for\nsanitize_order method.\n\n  ```ruby\n  class User \u003c ActiveRecord::Base\n    include Cuttable        # include concern\n    default_order 'id desc' # set default order for sanitize_order method\n  end\n  ```\n\n## Usage\n\n```ruby\n# good queries\nparams[:order] = 'id DESC'\nUser.sanitize_order(params[:order])\n\nparams[:order] = 'id, username DESC'\nUser.sanitize_order(params[:order])\n\n# bad query\nparams[:order] = 'id, (select sleep(2000) from dual where database() like database())#'\n# it should back off to the default query you set with default_order\nUser.sanitize_order(params[:order])\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparactmol%2Fcuttable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparactmol%2Fcuttable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparactmol%2Fcuttable/lists"}