Install gitleaks

This commit is contained in:
Trevi Awater
2024-11-21 10:51:46 +01:00
parent b92331d904
commit 6ee1e09671
5 changed files with 66 additions and 17 deletions

13
.gitleaks.toml Normal file
View File

@@ -0,0 +1,13 @@
title = "Gitleaks Configuration"
[[rules]]
id = "generic-api-key" # Add a unique ID for the rule
description = "Generic API Key"
regex = '''(?i)(api_key|apikey|auth_token|access_token|secret)[:=]["']?[a-z0-9]{32,}'''
tags = ["apikey", "secret"]
[allowlist]
paths = [
".env", # Matches .env file in any directory
".gitignore" # Matches .gitignore file
]

6
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.19.0
hooks:
- id: gitleaks
args: ["--config=.gitleaks.toml"]

View File

@@ -2,7 +2,6 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

View File

@@ -6,7 +6,7 @@ namespace Xamarin.Neo4j.Tests
public class QueryHelperTests
{
[Test]
public void TestWithUnlabeledRelationship()
public void ConvertsQueryWithUnlabeledRelationshipToAddDisplayVariable()
{
const string query = "MATCH (t:Tender)-[]->(z) RETURN t, z";
const string expected = "MATCH (t:Tender)-[display_variable_1]->(z) RETURN display_variable_1, t, z";
@@ -17,7 +17,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithLabeledWithoutAliasRelationship()
public void ConvertsLabeledRelationshipWithoutAliasToAddDisplayVariable()
{
const string query = "MATCH (t:Tender)-[:LAST]->(z) RETURN t, z";
const string expected = "MATCH (t:Tender)-[display_variable_1:LAST]->(z) RETURN display_variable_1, t, z";
@@ -28,7 +28,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithLabeledAndAliasedRelationship()
public void LeavesLabeledAndAliasedRelationshipQueryUnchanged()
{
const string query = "MATCH (t:Tender)-[y:LAST]->(z) RETURN t, z, y";
var expected = query;
@@ -39,7 +39,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithLabeledAndAliasedReturnAll()
public void ConvertsLabeledRelationshipWithReturnAllToAddDisplayVariable()
{
const string query = "MATCH (t:Tender)-[:LAST]->(z) RETURN *";
const string expected = "MATCH (t:Tender)-[display_variable_1:LAST]->(z) RETURN *";
@@ -50,7 +50,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithUnlabeledReturnAll()
public void ConvertsUnlabeledRelationshipWithReturnAllToAddDisplayVariable()
{
const string query = "MATCH (t:Tender)-[]->(z) RETURN *";
const string expected = "MATCH (t:Tender)-[display_variable_1]->(z) RETURN *";
@@ -61,7 +61,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithLabeledAndAliasedReturnAllWithMultipleRelationships()
public void ConvertsMultipleLabeledRelationshipsWithReturnAllToAddDisplayVariables()
{
const string query = "MATCH (t:Tender)-[:LAST]->(z)-[:NEXT]->(x) RETURN *";
const string expected = "MATCH (t:Tender)-[display_variable_1:LAST]->(z)-[display_variable_2:NEXT]->(x) RETURN *";
@@ -72,7 +72,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithNoReturn()
public void LeavesQueryWithNoReturnClauseUnchanged()
{
const string query = "MATCH (t:Tender)-[:LAST]->(z)";
var expected = query;
@@ -83,7 +83,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithMultipleUnlabeledRelationships()
public void ConvertsMultipleUnlabeledRelationshipsToAddDisplayVariables()
{
const string query = "MATCH (t:Tender)-[]->(z)-[]->(x) RETURN t, z, x";
const string expected =
@@ -95,7 +95,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestBackwardsDirection()
public void ConvertsBackwardsRelationshipToAddDisplayVariable()
{
const string query = "MATCH (tv:TenderVersion)<-[:HAS_VERSION]-(t:Tender) RETURN tv, t";
const string expected =
@@ -107,7 +107,7 @@ namespace Xamarin.Neo4j.Tests
}
[Test]
public void TestWithMultipleLabeledRelationships()
public void ConvertsMultipleLabeledRelationshipsToAddDisplayVariables()
{
const string query = "MATCH (t:Tender)-[:LAST]->(z)-[:NEXT]->(x) RETURN t, z, x";
const string expected =
@@ -118,6 +118,37 @@ namespace Xamarin.Neo4j.Tests
Assert.AreEqual(expected, actual);
}
[Test]
public void LeavesQueryWithMultipleLabeledRelationshipsAndReturnAllWithAliasUnchanged()
{
const string query = "MATCH (t:Tender)-[y:LAST]->(z)-[x:NEXT]->(x) RETURN *";
var expected = query;
var actual = QueryHelper.ToDisplayQuery(query);
Assert.AreEqual(expected, actual);
}
[Test]
public void LeavesComplexQueryWithMultipleRelationshipsAndAliasesUnchanged()
{
const string query = "MATCH (t:Tender)-[y:LAST]->(z)-[x:NEXT]->(x)-[]->(y) RETURN *";
const string expected = "MATCH (t:Tender)-[y:LAST]->(z)-[x:NEXT]->(x)-[display_variable_1]->(y) RETURN *";
var actual = QueryHelper.ToDisplayQuery(query);
Assert.AreEqual(expected, actual);
}
[Test]
public void AdjustsComplexQueryWithLimitToAddDisplayVariable()
{
const string query = "MATCH (t:Tender)-[y:LAST]->(z)-[x:NEXT]->(x)-[]->(y) RETURN * LIMIT 10";
const string expected = "MATCH (t:Tender)-[y:LAST]->(z)-[x:NEXT]->(x)-[display_variable_1]->(y) RETURN * LIMIT 10";
var actual = QueryHelper.ToDisplayQuery(query);
Assert.AreEqual(expected, actual);
}
}
}

View File

@@ -138,12 +138,6 @@
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2196" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Neo4j\Xamarin.Neo4j.csproj">
<Project>{756232D0-DBB0-4AEB-B1CF-1F5CA12CAC85}</Project>
<Name>Xamarin.Neo4j</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BundleResource Include="Resources\iconize-fontawesome-brands.ttf" />
<BundleResource Include="Resources\iconize-fontawesome-regular.ttf" />
@@ -154,5 +148,11 @@
<ItemGroup>
<BundleResource Include="Resources\roboto-mono-regular.ttf" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Neo4j\Xamarin.Neo4j.csproj">
<Project>{756232d0-dbb0-4aeb-b1cf-1f5ca12cac85}</Project>
<Name>Xamarin.Neo4j</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>