gear-complex-codeIgnore Directive

Arnica provides the ability to exclude specific files from secret scanning using the Ignore Directive function. This functionality is particularly useful in staging or testing environments, as it allows you to completely skip entire files during the scanning process.

To configure it for a specific file, simply add the @arnica-ignore string anywhere in the file. Once added, the entire file will be excluded from secret scanning.

Please keep the following in mind:

  • Although the default string is @arnica-ignore, it is fully customizable upon request.

  • The string can be placed anywhere within the file and will be treated equally regardless of its location.

  • While it is recommended to follow best practices by placing the Ignore Directive string next to a secret within the file, it will function correctly no matter where it is located.

-Example of a JWT with Ignore Directive configured:

 describe("LastLoginIpComponent", () => {
  it("should set Last-Login IP from JWT as trusted HTML", () => {
    // @arnica-ignore
    localStorage.setItem("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Imxhc3RMb2dpbklwIjoiMS4yLjMuNCJ9fQ.RAkmdqwNypuOxv3SDjPO4xMKvd1CddKvDFYDBfUt3bg");
    component.ngOnInit();
    expect(sanitizer.bypassSecurityTrustHtml).toHaveBeenCalledWith("<small>1.2.3.4</small>");
  });
  it("should not set Last-Login IP if none is present in JWT", () => {
    // @arnica-ignore
    localStorage.setItem("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fX0.bVBhvll6IaeR3aUdoOeyR8YZe2S2DfhGAxTGfd9enLw");
    component.ngOnInit();
    expect(component.lastLoginIp).toBe("?");
  });
});

Last updated

Was this helpful?