Skip to content

Commit

Permalink
Merge branch 'master' into SNOW-715524-SSO-Token-Cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf authored Apr 18, 2024
2 parents 15a58be + 47235fb commit 632a6b0
Show file tree
Hide file tree
Showing 27 changed files with 1,574 additions and 150 deletions.
61 changes: 61 additions & 0 deletions .EditorConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
root = true
# All files
[*.*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
max_line_length=150

# Interfaces should start with I and PascalCase
dotnet_naming_rule.interfaces_begin_with_I.severity = warning
dotnet_naming_rule.interfaces_begin_with_I.symbols = interfaces
dotnet_naming_rule.interfaces_begin_with_I.style = prefix_and_pascal_case
dotnet_naming_rule.interfaces_begin_with_I.required_prefix = I
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_diagnostic.interfaces_begin_with_I.severity = warning
dotnet_diagnostic.interfaces_begin_with_I.enabled = true

# Static fields should start with _s
dotnet_naming_rule.static_fields_begin_with_s.severity = warning
dotnet_naming_rule.static_fields_begin_with_s.symbols = static_fields
dotnet_naming_rule.static_fields_begin_with_s.style = custom
dotnet_naming_rule.static_fields_begin_with_s.custom_recommended_prefix = _r
dotnet_naming_rule.static_fields_begin_with_s.required_prefix = _r
dotnet_naming_rule.static_fields_begin_with_s.capitalization = camel_case
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.applicable_accessibilities = public, internal, private, protected, protected_internal
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_diagnostic.static_fields_begin_with_s.severity = warning
dotnet_diagnostic.static_fields_begin_with_s.enabled = true

# Enforce use of Pascal case in enums, classes, const and methods
dotnet_naming_rule.enforce_pascal_case.severity = suggestion
dotnet_naming_rule.enforce_pascal_case.symbols = methods, enums, consts, public_methods, public_classes
dotnet_naming_rule.enforce_pascal_case.style = pascal_case
dotnet_naming_symbols.methods.applicable_kinds = method
dotnet_naming_symbols.enums.applicable_kinds = enum
dotnet_naming_symbols.consts.applicable_kinds = field
dotnet_naming_symbols.consts.applicable_modifiers = const
dotnet_naming_symbols.public_methods.applicable_kinds = method
dotnet_naming_symbols.public_methods.applicable_accessibilities = public
dotnet_naming_symbols.public_classes.applicable_kinds = class
dotnet_naming_symbols.public_classes.applicable_accessibilities = public
dotnet_diagnostic.enforce_pascal_case.severity = suggestion
dotnet_diagnostic.enforce_pascal_case.enabled = true

# private and internal members should start with underscore
dotnet_naming_rule.private_and_internal_members_start_with_underscore.severity = warning
dotnet_naming_rule.private_and_internal_members_start_with_underscore.symbols = private_fields, internal_fields, private_properties, internal_properties, private_methods, internal_methods
dotnet_naming_rule.private_and_internal_members_start_with_underscore.style = underscore_prefix
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_properties.applicable_kinds = property
dotnet_naming_symbols.internal_properties.applicable_kinds = property
dotnet_naming_symbols.private_methods.applicable_kinds = method
dotnet_naming_symbols.internal_methods.applicable_kinds = method
dotnet_naming_symbols.private_methods.applicable_accessibilities = private
dotnet_naming_symbols.internal_methods.applicable_accessibilities = internal
dotnet_diagnostic.private_and_internal_members_start_with_underscore.severity = warning
dotnet_diagnostic.private_and_internal_members_start_with_underscore.enabled = true
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Please explain the changes you made here.

### Checklist
- [ ] Code compiles correctly
- [ ] Code is formatted according to [Coding Conventions](../CodingConventions.md)
- [ ] Code is formatted according to [Coding Conventions](../blob/master/CodingConventions.md)
- [ ] Created tests which fail without the change (if possible)
- [ ] All tests passing (`dotnet test`)
- [ ] Extended the README / documentation, if necessary
- [ ] Provide JIRA issue id (if possible) or GitHub issue id in PR name
- [ ] Provide JIRA issue id (if possible) or GitHub issue id in PR name
43 changes: 43 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Code standards check

# Triggers the workflow on pull request events but only for the master branch
on:
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
logLevel:
default: warning
description: "Log level"
required: true
tags:
description: "Linter"
required: false

concurrency:
# older builds for the same pull request number or branch should be cancelled
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
DOTNET_VERSION: 6.0
DOTNET_LEGACY_VERSION: 4.7.1

jobs:
run-linter:
name: Run linter
runs-on: windows-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Set up .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0.x"
dotnet-quality: 'ga'
- name: Run linters
uses: wearerequired/lint-action@v2
with:
dotnet_format: true
continue_on_error: true
check_name: ${linter} run
3 changes: 2 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ jobs:
dotnet: ['net6.0', 'net472', 'net471']
cloud_env: ['AZURE', 'GCP', 'AWS']
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Dotnet
uses: actions/setup-dotnet@v3
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -309,3 +309,6 @@ whitesource/
Snowflake.Data.Tests/macos_*_performance.csv
Snowflake.Data.Tests/windows_*_performance.csv
Snowflake.Data.Tests/unix_*_performance.csv

# Ignore Mac files
**/.DS_Store
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ The following table lists all valid connection properties:
| PROXYPORT | Depends | The port number of the proxy server. <br/> <br/> If USEPROXY is set to `true`, you must set this parameter. <br/> <br/> This parameter was introduced in v2.0.4. |
| PROXYUSER | No | The username for authenticating to the proxy server. <br/> <br/> This parameter was introduced in v2.0.4. |
| PROXYPASSWORD | Depends | The password for authenticating to the proxy server. <br/> <br/> If USEPROXY is `true` and PROXYUSER is set, you must set this parameter. <br/> <br/> This parameter was introduced in v2.0.4. |
| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard. <br/> <br/> This parameter was introduced in v2.0.4. |
| NONPROXYHOSTS | No | The list of hosts that the driver should connect to directly, bypassing the proxy server. Separate the hostnames with a pipe symbol (\|). You can also use an asterisk (`*`) as a wildcard. <br/> The host target value should fully match with any item from the proxy host list to bypass the proxy server. <br/> <br/> This parameter was introduced in v2.0.4. |
| FILE_TRANSFER_MEMORY_THRESHOLD | No | The maximum number of bytes to store in memory used in order to provide a file encryption. If encrypting/decrypting file size exceeds provided value a temporary file will be created and the work will be continued in the temporary file instead of memory. <br/> If no value provided 1MB will be used as a default value (that is 1048576 bytes). <br/> It is possible to configure any integer value bigger than zero representing maximal number of bytes to reside in memory. |
| CLIENT_CONFIG_FILE | No | The location of the client configuration json file. In this file you can configure easy logging feature. |
| ALLOWUNDERSCORESINHOST | No | Specifies whether to allow underscores in account names. This impacts PrivateLink customers whose account names contain underscores. In this situation, you must override the default value by setting allowUnderscoresInHost to true. |
Expand Down Expand Up @@ -377,6 +377,22 @@ using (IDbConnection conn = new SnowflakeDbConnection())
}
```

The NONPROXYHOSTS property could be set to specify if the server proxy should be bypassed by an specified host. This should be defined using the full host url or including the url + `*` wilcard symbol.

Examples:

- `*` (Bypassed all hosts from the proxy server)
- `*.snowflakecomputing.com` ('Bypass all host that ends with `snowflakecomputing.com`')
- `https:\\testaccount.snowflakecomputing.com` (Bypass proxy server using full host url).
- `*.myserver.com | *testaccount*` (You can specify multiple regex for the property divided by `|`)


> Note: The nonproxyhost value should match the full url including the http or https section. The '*' wilcard could be added to bypass the hostname successfully.

- `myaccount.snowflakecomputing.com` (Not bypassed).
- `*myaccount.snowflakecomputing.com` (Bypassed).


## Using Connection Pools

Instead of creating a connection each time your client application needs to access Snowflake, you can define a cache of Snowflake connections that can be reused as needed. Connection pooling usually reduces the lag time to make a connection. However, it can slow down client failover to an alternative DNS when a DNS problem occurs.
Expand Down
4 changes: 4 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Security Policy

Please refer to the Snowflake [HackerOne program](https://hackerone.com/snowflake?type=team) for our security policies and for reporting any security vulnerabilities.
For other security related questions and concerns, please contact the Snowflake security team at [email protected]
160 changes: 80 additions & 80 deletions Snowflake.Data.Tests/App.config
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2012-2017 Snowflake Computing Inc. All rights reserved.
-->
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="test_%property{framework}.log" />
<appendToFile value="true"/>
<rollingStyle value="Size" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<!-- <header value="[DateTime] [Thread] [Level] [ClassName] Message&#13;&#10;" /> -->
<conversionPattern value="[%date] [%t] [%-5level] [%logger] %message%newline" />
</layout>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] [%-5level] [%ClassName:%line] - %message%newline" />
</layout>
</appender>
</appender>

<root>
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
</root>
<root>
<level value="WARN" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>

<!-- used in SFDbFactoryIT.cs to test registering DbProviderFactoryClass -->
<system.data>
<DbProviderFactories>
<add name="Snowflake" invariant="Snowflake.Data"
type="Snowflake.Data.Client.SnowflakeDbFactory, Snowflake.Data, Culture=neutral, PublicKeyToken=null"
description="Snowflake Provider" />
</DbProviderFactories>
</system.data>

<!--
=========== Enable Network debug log ===============
<system.diagnostics>
<sources>
<source name="System.Net" tracemode="includehex" maxdatasize="1024">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
<source name="System.Net.Sockets">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
<source name="System.Net.Cache">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
</sources>
<switches>
<add name="System.Net" value="Verbose"/>
<add name="System.Net.Sockets" value="Verbose"/>
<add name="System.Net.Cache" value="Verbose"/>
</switches>
<sharedListeners>
<add name="System.Net"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\Temp\network.log" />
</sharedListeners>
<trace autoflush="true"/>
</system.diagnostics> -->
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright (c) 2012-2017 Snowflake Computing Inc. All rights reserved.
-->
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>

<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file type="log4net.Util.PatternString" value="test_%property{framework}.log" />
<appendToFile value="true"/>
<rollingStyle value="Size" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<!-- <header value="[DateTime] [Thread] [Level] [ClassName] Message&#13;&#10;" /> -->
<conversionPattern value="[%date] [%t] [%-5level] [%logger] %message%newline" />
</layout>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] [%-5level] [%ClassName:%line] - %message%newline" />
</layout>
</appender>
</appender>

<root>
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
</root>
<root>
<level value="WARN" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>

<!-- used in SFDbFactoryIT.cs to test registering DbProviderFactoryClass -->
<system.data>
<DbProviderFactories>
<add name="Snowflake" invariant="Snowflake.Data"
type="Snowflake.Data.Client.SnowflakeDbFactory, Snowflake.Data, Culture=neutral, PublicKeyToken=null"
description="Snowflake Provider" />
</DbProviderFactories>
</system.data>

<!--
=========== Enable Network debug log ===============
<system.diagnostics>
<sources>
<source name="System.Net" tracemode="includehex" maxdatasize="1024">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
<source name="System.Net.Sockets">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
<source name="System.Net.Cache">
<listeners>
<add name="System.Net"/>
</listeners>
</source>
</sources>
<switches>
<add name="System.Net" value="Verbose"/>
<add name="System.Net.Sockets" value="Verbose"/>
<add name="System.Net.Cache" value="Verbose"/>
</switches>
<sharedListeners>
<add name="System.Net"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\Temp\network.log" />
</sharedListeners>
<trace autoflush="true"/>
</system.diagnostics> -->
</configuration>
Loading

0 comments on commit 632a6b0

Please sign in to comment.