{"id":21561612,"url":"https://github.com/dwarry/rowlevelauditpoc","last_synced_at":"2025-10-17T21:57:13.790Z","repository":{"id":162100406,"uuid":"636572609","full_name":"dwarry/RowLevelAuditPoC","owner":"dwarry","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-05T06:48:23.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T11:28:51.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/dwarry.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-05T06:46:54.000Z","updated_at":"2023-05-05T12:20:39.000Z","dependencies_parsed_at":"2023-06-19T07:38:19.675Z","dependency_job_id":null,"html_url":"https://github.com/dwarry/RowLevelAuditPoC","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwarry%2FRowLevelAuditPoC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwarry%2FRowLevelAuditPoC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwarry%2FRowLevelAuditPoC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dwarry%2FRowLevelAuditPoC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dwarry","download_url":"https://codeload.github.com/dwarry/RowLevelAuditPoC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244159990,"owners_count":20408019,"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-24T09:27:18.827Z","updated_at":"2025-10-17T21:57:08.747Z","avatar_url":"https://github.com/dwarry.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using Row Level Security to Log Access\n\nThis repo comprises an attempt to (ab)use the Row-Level Security (RLS) functionality in SQL Server 2016 to log\naccess to the data in a table. For familiarity, it's based on the AdventureWorks2016 sample database. \n\n## RowAuditRecorder.cs\nContains a fairly trivial static class that contains a method that logs\na message to a text file. The location of the text file is specified by \nan environment variable `SQL_ROW_AUDIT_FILE_LOCATION`, so this will need to be\nset at the system level and the SQL Server service restarted before running it\nfor the first time. \n\nThe function takes three parameters - the user name, the table name being\nlogged, and a message. The table name is used for the filename, and each call\nwrites a line to this file containing the ISO8601 timestamp, the user name and\nthe message, with tab as the delimiter. \n\nAs the Assembly that will be built to hold this is going to be registered with\nSQL Server as an assembly with External Access permission (probably has to be\nUnsafe in later versions of SQL Server), it will need to be signed with a key\nwith a password set.\n\n## CodeAsymmetricKey.sql\nThis creates an asymmetric key from the assembly, and a server-level login associated with it which has permission to use external access assemblies.\n\n## CreateAssembly.sql\nThis loads the assembly into the target database.\n\n## LogRowLevelAudit.sql\nThis creates a wrapper T-SQL function that invokes the C# method. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwarry%2Frowlevelauditpoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwarry%2Frowlevelauditpoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwarry%2Frowlevelauditpoc/lists"}