Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Sanitizer {
* Multiple flags can be combined with bitwise OR (e.g., 1 | 2 = 3)
* @param sendConcernLimit Maximum number of concerns to send.
* @param insertWarningAtProblemLocation Insert warnings at problem location (true) or prepend (false).
* @param bypassSitePathChecks When true, IsSitePath and IsSitePathLoose checks are bypassed.
* @return true if initialization was successful, false otherwise.
*/
private static native boolean nativeInitialize(long loggerNativePtr,
Expand All @@ -29,7 +30,8 @@ private static native boolean nativeInitialize(long loggerNativePtr,
String[] emailDomains,
int analyzerOptions,
int sendConcernLimit,
boolean insertWarningAtProblemLocation);
boolean insertWarningAtProblemLocation,
boolean bypassSitePathChecks);
/**
* Initializes the sanitizer with the provided configuration.
*
Expand Down Expand Up @@ -70,7 +72,8 @@ public static boolean initialize(SanitizerConfiguration config, String[] urlDoma
emailDomains,
analyzerOptions,
sendConcernLimit,
config.isInsertWarningAtProblemLocation());
config.isInsertWarningAtProblemLocation(),
config.isBypassSitePathChecks());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ public class SanitizerConfiguration {
*/
private boolean insertWarningAtProblemLocation = false;

/**
* Flag to control whether site path checks are bypassed.
* When true, IsSitePath and IsSitePathLoose checks are skipped.
* Optional. Defaults to false (site path checks are active).
*/
private boolean bypassSitePathChecks = false;

/**
* Constructs a new SanitizerConfiguration with the specified logger.
*
Expand Down Expand Up @@ -97,4 +104,22 @@ public boolean isInsertWarningAtProblemLocation() {
public void setInsertWarningAtProblemLocation(boolean insertAtLocation) {
this.insertWarningAtProblemLocation = insertAtLocation;
}

/**
* Returns whether site path checks are bypassed.
*
* @return true if site path checks are bypassed, false if active
*/
public boolean isBypassSitePathChecks() {
return bypassSitePathChecks;
}

/**
* Sets whether site path checks should be bypassed.
*
* @param bypass true to bypass site path checks, false to keep them active
*/
public void setBypassSitePathChecks(boolean bypass) {
this.bypassSitePathChecks = bypass;
}
}
6 changes: 3 additions & 3 deletions lib/include/public/Version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define MAT_VERSION_HPP
// WARNING: DO NOT MODIFY THIS FILE!
// This file has been automatically generated, manual changes will be lost.
#define BUILD_VERSION_STR "3.10.23.1"
#define BUILD_VERSION 3,10,23,1
#define BUILD_VERSION_STR "3.10.40.1"
#define BUILD_VERSION 3,10,40,1

#ifndef RESOURCE_COMPILER_INVOKED
#include "ctmacros.hpp"
Expand All @@ -18,7 +18,7 @@ namespace MAT_NS_BEGIN {
uint64_t const Version =
((uint64_t)3 << 48) |
((uint64_t)10 << 32) |
((uint64_t)23 << 16) |
((uint64_t)40 << 16) |
((uint64_t)1);

} MAT_NS_END
Expand Down
5 changes: 4 additions & 1 deletion lib/jni/Sanitizer_jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Java_com_microsoft_applications_events_Sanitizer_isInitialized(const JNIEnv *env
* Multiple flags can be combined with bitwise OR (e.g., 1 | 2 = 3)
* @param sendConcernLimit Maximum number of concerns to send. 0 = no concerns sent, 65536+ = all concerns sent.
* @param insertWarningAtProblemLocation Insert warnings at problem location (true) or prepend (false).
* @param bypassSitePathChecks When true, IsSitePath and IsSitePathLoose checks are bypassed.
* **/
extern "C"
JNIEXPORT jboolean JNICALL
Expand All @@ -50,7 +51,8 @@ Java_com_microsoft_applications_events_Sanitizer_isInitialized(const JNIEnv *env
jobjectArray emailDomains,
jint analyzerOptions,
jint sendConcernLimit, // number of concerns to upload. Set to 0 to upload none, greater than 65536 uploads everything.
jboolean insertWarningAtProblemLocation
jboolean insertWarningAtProblemLocation,
jboolean bypassSitePathChecks
) {

if (spSanitizer != nullptr) {
Expand Down Expand Up @@ -92,6 +94,7 @@ Java_com_microsoft_applications_events_Sanitizer_isInitialized(const JNIEnv *env

sanitizerConfig.SetAllWarningsToSanitizations = static_cast<bool>(warningsToSanitization);
sanitizerConfig.InsertWarningAtProblemLocation = static_cast<bool>(insertWarningAtProblemLocation);
sanitizerConfig.BypassSitePathChecks = static_cast<bool>(bypassSitePathChecks);

spSanitizer = std::make_shared<Sanitizer>(sanitizerConfig);
return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/modules
2 changes: 2 additions & 0 deletions wrappers/obj-c/ODWSanitizer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ +(void)initializeSanitizer:(ILogger *)logger withODWSanitizerInitConfig:(ODWSani
config.SetAllWarningsToSanitizations = initConfigObject.setWarningsToSanitization;
config.SendConcernLimit = static_cast<size_t>(initConfigObject.sendConcernLimit);
config.InsertWarningAtProblemLocation = initConfigObject.insertWarningAtProblemLocation;
config.BypassSitePathChecks = initConfigObject.bypassSitePathChecks;

_sanitizerPtr = std::make_shared<Sanitizer>(config);
LogManager::GetInstance()->SetDataInspector(_sanitizerPtr);
Expand Down Expand Up @@ -75,6 +76,7 @@ +(void)initializeSanitizer:(ILogger *)logger withODWSanitizerInitConfig:(ODWSani
config.SetAllWarningsToSanitizations = initConfigObject.setWarningsToSanitization;
config.SendConcernLimit = static_cast<size_t>(initConfigObject.sendConcernLimit);
config.InsertWarningAtProblemLocation = initConfigObject.insertWarningAtProblemLocation;
config.BypassSitePathChecks = initConfigObject.bypassSitePathChecks;

_sanitizerPtr = std::make_shared<Sanitizer>(config);
LogManager::GetInstance()->SetDataInspector(_sanitizerPtr);
Expand Down
7 changes: 7 additions & 0 deletions wrappers/obj-c/ODWSanitizerInitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property(readwrite, nonatomic) BOOL insertWarningAtProblemLocation;

/*!
@brief (OPTIONAL) When YES, IsSitePath and IsSitePathLoose checks are bypassed.
Site paths will not be flagged or sanitized.
Default value is `NO` (site path checks are active).
*/
@property(readwrite, nonatomic) BOOL bypassSitePathChecks;

// Initializer
- (instancetype)init;

Expand Down
1 change: 1 addition & 0 deletions wrappers/obj-c/ODWSanitizerInitConfig.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ - (instancetype)init {
_setWarningsToSanitization = YES; // Default to true
_sendConcernLimit = 65536; // Default to 65536 (upload all concerns)
_insertWarningAtProblemLocation = NO; // Default to NO (prepend warnings)
_bypassSitePathChecks = NO; // Default to NO (site path checks active)
}
return self;
}
Expand Down
12 changes: 12 additions & 0 deletions wrappers/swift/Sources/OneDSSwift/SanitizerInitConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ public final class SanitizerInitConfig {
}
}

/// (OPTIONAL) When true, IsSitePath and IsSitePathLoose checks are bypassed.
/// Site paths will not be flagged or sanitized.
/// Default value is `false` (site path checks are active).
public var bypassSitePathChecks: Bool {
get {
odwSanitizerInitConfig.bypassSitePathChecks
}
set {
odwSanitizerInitConfig.bypassSitePathChecks = newValue
}
}

/**
Returns the Obj-C object of the wrapper.

Expand Down
Loading