Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

basic functionality of replay log working #62

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

darrelmiller
Copy link
Contributor

@darrelmiller darrelmiller commented Dec 5, 2023

This change as the replaylog command to the KibaliTool

dotnet run -- replay-log --fo <path to workload Permissions folder> --lf ..\..\graphlog.json --count 1000

Using a logfile as described in the logentry.cs file, this command will compare the permissions required by the model vs permissions used by requests recorded in the log.

Microsoft Reviewers: Open in CodeFlow

public string Url;
public string Claims;

private Regex scpRegex = new Regex(@"scp=([^\;]+)", RegexOptions.Compiled);

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field 'scpRegex' can be 'readonly'.
public string Claims;

private Regex scpRegex = new Regex(@"scp=([^\;]+)", RegexOptions.Compiled);
private Regex rolesRegex = new Regex(@"roles=([^\;]+)", RegexOptions.Compiled);

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field 'rolesRegex' can be 'readonly'.

private Regex scpRegex = new Regex(@"scp=([^\;]+)", RegexOptions.Compiled);
private Regex rolesRegex = new Regex(@"roles=([^\;]+)", RegexOptions.Compiled);
private Regex roleRegex = new Regex("\"(.*?)\"", RegexOptions.Compiled);

Check notice

Code scanning / CodeQL

Missed 'readonly' opportunity Note

Field 'roleRegex' can be 'readonly'.
Comment on lines +182 to +184
} catch (Exception e) {
Console.WriteLine("Failed to add resource to tree: " + resource.Key + " " + e.Message);
}

Check notice

Code scanning / CodeQL

Generic catch clause Note

Generic catch clause.
[Fact]
public void ParseLog()
{
var logstream = new FileStream(@"C:\Users\darrmi\src\github\microsoftgraph\kibali\graphlog.json", FileMode.Open);

Check warning

Code scanning / CodeQL

Missing Dispose call on local IDisposable Warning test

Disposable 'FileStream' is created but not disposed.

if (failReason == null )
{
acceptablePermissions = acceptableClaims.Select(c => c.Permission).ToList();

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
acceptableClaims
may be null at this access because of
this
assignment.
failReason = "No matching method";
}

if (failReason == null && !supportedSchemes.TryGetValue(entry.Scheme, out acceptableClaims))

Check warning

Code scanning / CodeQL

Dereferenced variable may be null Warning

Variable
supportedSchemes
may be null at this access because of
this
assignment.
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.

1 participant